Message ID | 0a379d46-934b-4978-8935-f4c19a6035fd@EXCHANGE-3K.hds.local |
---|---|
State | New |
Headers | show |
On 7 July 2015 at 19:25, Alex Zuepke <alexander.zuepke@hs-rm.de> wrote: > > Signed-off-by: Alex Zuepke <alexander.zuepke@hs-rm.de> > --- > 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; You can drop this part (see remarks on previous patch). > 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. */ You don't need this comment, it doesn't tell us anything that's not obvious from the code. > + if ((env->v7m.ccr & CCR_STKALIGN) && (env->regs[13] & 4)) { > env->regs[13] -= 4; > xpsr |= 0x200; > } thanks -- PMM
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; }
Signed-off-by: Alex Zuepke <alexander.zuepke@hs-rm.de> --- hw/intc/armv7m_nvic.c | 2 +- target-arm/helper.c | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-)