qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 3/6] ARM: Cortex-M3/M4: honor STKALIGN in CCR


From: Alex Zuepke
Subject: [Qemu-devel] [PATCH 3/6] ARM: Cortex-M3/M4: honor STKALIGN in CCR
Date: Tue, 7 Jul 2015 20:25:50 +0200

Signed-off-by: Alex Zuepke <address@hidden>
---
 hw/intc/armv7m_nvic.c |    2 +-
 target-arm/helper.c   |    5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
index e6ae047..369ef94 100644
--- a/hw/intc/armv7m_nvic.c
+++ b/hw/intc/armv7m_nvic.c
@@ -373,7 +373,7 @@ static void nvic_writel(nvic_state *s, uint32_t offset, 
uint32_t value)
         break;
     case 0xd14: /* Configuration Control.  */
         cpu = ARM_CPU(current_cpu);
-        cpu->env.v7m.ccr = value & 0; /* TODO: add used bits */
+        cpu->env.v7m.ccr = value & CCR_STKALIGN;
         break;
     case 0xd24: /* System Handler Control.  */
         /* TODO: Real hardware allows you to set/clear the active bits
diff --git a/target-arm/helper.c b/target-arm/helper.c
index aa34159..812204f 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -4579,9 +4579,8 @@ void arm_v7m_cpu_do_interrupt(CPUState *cs)
     }
 
     /* Align stack pointer.  */
-    /* ??? Should only do this if Configuration Control Register
-       STACKALIGN bit is set.  */
-    if (env->regs[13] & 4) {
+    /* Do this only if Configuration Control Register STKALIGN bit is set. */
+    if ((env->v7m.ccr & CCR_STKALIGN) && (env->regs[13] & 4)) {
         env->regs[13] -= 4;
         xpsr |= 0x200;
     }
-- 
1.7.9.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]