diff mbox

[v1,03/16] target-arm: A64: Respect SPSEL when taking exceptions

Message ID 1401434911-26992-4-git-send-email-edgar.iglesias@gmail.com
State New
Headers show

Commit Message

Edgar E. Iglesias May 30, 2014, 7:28 a.m. UTC
From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
 target-arm/helper-a64.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Alex Bennée June 2, 2014, 9:55 a.m. UTC | #1
Edgar E. Iglesias writes:

> From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> ---
>  target-arm/helper-a64.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/target-arm/helper-a64.c b/target-arm/helper-a64.c
> index cccda74..bc153cb 100644
> --- a/target-arm/helper-a64.c
> +++ b/target-arm/helper-a64.c
> @@ -489,8 +489,7 @@ void aarch64_cpu_do_interrupt(CPUState *cs)
>  
>      if (is_a64(env)) {
>          env->banked_spsr[aarch64_banked_spsr_index(1)] = pstate_read(env);
> -        env->sp_el[arm_current_pl(env)] = env->xregs[31];
> -        env->xregs[31] = env->sp_el[1];
> +        aarch64_save_sp(env, arm_current_pl(env));
>          env->elr_el[1] = env->pc;
>      } else {
>          env->banked_spsr[0] = cpsr_read(env);
> @@ -508,6 +507,7 @@ void aarch64_cpu_do_interrupt(CPUState *cs)
>  
>      pstate_write(env, PSTATE_DAIF | PSTATE_MODE_EL1h);
>      env->aarch64 = 1;
> +    aarch64_restore_sp(env, 1);
>  
>      env->pc = addr;
>      cs->interrupt_request |= CPU_INTERRUPT_EXITTB;

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
diff mbox

Patch

diff --git a/target-arm/helper-a64.c b/target-arm/helper-a64.c
index cccda74..bc153cb 100644
--- a/target-arm/helper-a64.c
+++ b/target-arm/helper-a64.c
@@ -489,8 +489,7 @@  void aarch64_cpu_do_interrupt(CPUState *cs)
 
     if (is_a64(env)) {
         env->banked_spsr[aarch64_banked_spsr_index(1)] = pstate_read(env);
-        env->sp_el[arm_current_pl(env)] = env->xregs[31];
-        env->xregs[31] = env->sp_el[1];
+        aarch64_save_sp(env, arm_current_pl(env));
         env->elr_el[1] = env->pc;
     } else {
         env->banked_spsr[0] = cpsr_read(env);
@@ -508,6 +507,7 @@  void aarch64_cpu_do_interrupt(CPUState *cs)
 
     pstate_write(env, PSTATE_DAIF | PSTATE_MODE_EL1h);
     env->aarch64 = 1;
+    aarch64_restore_sp(env, 1);
 
     env->pc = addr;
     cs->interrupt_request |= CPU_INTERRUPT_EXITTB;