summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMichael Davidsaver <mdavidsaver@gmail.com>2017-01-27 15:20:23 +0000
committerPeter Maydell <peter.maydell@linaro.org>2017-01-27 15:29:08 +0000
commitdc858c6633a9af8b80c1509cf6f825e4390d3ad1 (patch)
treeaa72baa92945160a912bab49b2cecb8b4c06a4b7
parente6b332097d1a4713173a82f17d039b4c78bc6f59 (diff)
downloadfocaccia-qemu-dc858c6633a9af8b80c1509cf6f825e4390d3ad1.tar.gz
focaccia-qemu-dc858c6633a9af8b80c1509cf6f825e4390d3ad1.zip
armv7m: honour CCR.STACKALIGN on exception entry
The CCR.STACKALIGN bit controls whether the CPU is supposed to force
8-alignment of the stack pointer on entry to the exception handler.

Signed-off-by: Michael Davidsaver <mdavidsaver@gmail.com>
Message-id: 1485285380-10565-6-git-send-email-peter.maydell@linaro.org
[PMM: commit message and comment tweaks]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--target/arm/helper.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/target/arm/helper.c b/target/arm/helper.c
index ce7e43bbac..7dc30f5769 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -6110,10 +6110,8 @@ void arm_v7m_cpu_do_interrupt(CPUState *cs)
         return; /* Never happens.  Keep compiler happy.  */
     }
 
-    /* Align stack pointer.  */
-    /* ??? Should only do this if Configuration Control Register
-       STACKALIGN bit is set.  */
-    if (env->regs[13] & 4) {
+    /* Align stack pointer if the guest wants that */
+    if ((env->regs[13] & 4) && (env->v7m.ccr & R_V7M_CCR_STKALIGN_MASK)) {
         env->regs[13] -= 4;
         xpsr |= 0x200;
     }