On Tue, May 6, 2014 at 4:08 PM, Edgar E. Iglesias
<edgar.igles...@gmail.com> wrote:
> From: "Edgar E. Iglesias" <edgar.igles...@xilinx.com>
>
> Adds support for ERET to Aarch64 EL2 and 3.
>
> Signed-off-by: Edgar E. Iglesias <edgar.igles...@xilinx.com>
> ---
>  target-arm/op_helper.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c
> index f1ae05e..8494f7f 100644
> --- a/target-arm/op_helper.c
> +++ b/target-arm/op_helper.c
> @@ -386,13 +386,14 @@ void HELPER(msr_i_pstate)(CPUARMState *env, uint32_t 
> op, uint32_t imm)
>
>  void HELPER(exception_return)(CPUARMState *env)
>  {
> -    unsigned int spsr_idx = arm64_banked_spsr_index(1);
> -    uint32_t spsr = env->banked_spsr[spsr_idx];
> -    int new_el, i;
>      int cur_el = arm_current_pl(env);
> +    unsigned int spsr_idx = arm64_banked_spsr_index(cur_el);
> +    uint32_t spsr;
> +    int new_el, i;
>
> +    spsr = env->banked_spsr[spsr_idx];

Why change to split declaration and assignment (amongst the other
all-in-one's above)?

Otherwise:

Reviewed-by: Peter Crosthwaite <peter.crosthwa...@xilinx.com>

>      if (env->pstate & PSTATE_SP) {
> -        env->sp_el[1] = env->xregs[31];
> +        env->sp_el[cur_el] = env->xregs[31];
>      } else {
>          env->sp_el[0] = env->xregs[31];
>      }
> @@ -428,7 +429,7 @@ void HELPER(exception_return)(CPUARMState *env)
>          env->aarch64 = 1;
>          pstate_write(env, spsr);
>          env->xregs[31] = env->sp_el[new_el];
> -        env->pc = env->elr_el[ELR_EL_IDX(1)];
> +        env->pc = env->elr_el[ELR_EL_IDX(cur_el)];
>      }
>
>      return;
> @@ -442,7 +443,7 @@ illegal_return:
>       * no change to exception level, execution state or stack pointer
>       */
>      env->pstate |= PSTATE_IL;
> -    env->pc = env->elr_el[ELR_EL_IDX(1)];
> +    env->pc = env->elr_el[ELR_EL_IDX(cur_el)];
>      spsr &= PSTATE_NZCV | PSTATE_DAIF;
>      spsr |= pstate_read(env) & ~(PSTATE_NZCV | PSTATE_DAIF);
>      pstate_write(env, spsr);
> --
> 1.8.3.2
>
>

Reply via email to