qemu-devel
[Top][All Lists]
Advanced

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

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


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH 3/6] ARM: Cortex-M3/M4: honor STKALIGN in CCR
Date: Tue, 14 Jul 2015 17:58:30 +0100

On 7 July 2015 at 19:25, Alex Zuepke <address@hidden> wrote:
>
> 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;

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



reply via email to

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