qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v1 18/22] target-arm: A64: Generalize update_sps


From: Peter Crosthwaite
Subject: Re: [Qemu-devel] [PATCH v1 18/22] target-arm: A64: Generalize update_spsel for the various ELs
Date: Wed, 7 May 2014 16:13:09 +1000

On Tue, May 6, 2014 at 4:08 PM, Edgar E. Iglesias
<address@hidden> wrote:
> From: "Edgar E. Iglesias" <address@hidden>
>
> Signed-off-by: Edgar E. Iglesias <address@hidden>

Reviewed-by: Peter Crosthwaite <address@hidden>

> ---
>  target-arm/internals.h | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/target-arm/internals.h b/target-arm/internals.h
> index 7c39946..5d802db 100644
> --- a/target-arm/internals.h
> +++ b/target-arm/internals.h
> @@ -107,6 +107,7 @@ int arm_rmode_to_sf(int rmode);
>
>  static inline void update_spsel(CPUARMState *env, uint32_t imm)
>  {
> +    unsigned int cur_el = arm_current_pl(env);
>      /* Update PSTATE SPSel bit; this requires us to update the
>       * working stack pointer in xregs[31].
>       */
> @@ -115,17 +116,15 @@ static inline void update_spsel(CPUARMState *env, 
> uint32_t imm)
>      }
>      env->pstate = deposit32(env->pstate, 0, 1, imm);
>
> -    /* EL0 has no access rights to update SPSel, and this code
> -     * assumes we are updating SP for EL1 while running as EL1.
> -     */
> -    assert(arm_current_pl(env) == 1);
> +    /* EL0 has no access rights to update SPSel.  */
> +    assert(cur_el >= 1 && cur_el <= 3);
>      if (env->pstate & PSTATE_SP) {
>          /* Switch from using SP_EL0 to using SP_ELx */
>          env->sp_el[0] = env->xregs[31];
> -        env->xregs[31] = env->sp_el[1];
> +        env->xregs[31] = env->sp_el[cur_el];
>      } else {
>          /* Switch from SP_EL0 to SP_ELx */
> -        env->sp_el[1] = env->xregs[31];
> +        env->sp_el[cur_el] = env->xregs[31];
>          env->xregs[31] = env->sp_el[0];
>      }
>  }
> --
> 1.8.3.2
>
>



reply via email to

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