diff mbox

[v2,08/10] target-arm: remove final users of pstate_write

Message ID 1405007407-23549-9-git-send-email-alex.bennee@linaro.org
State New
Headers show

Commit Message

Alex Bennée July 10, 2014, 3:50 p.m. UTC
This converts all users of pstate_write to use the common state
save/restore functionality.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

Comments

Riku Voipio July 15, 2014, 1:44 p.m. UTC | #1
On Thu, Jul 10, 2014 at 04:50:05PM +0100, Alex Bennée wrote:
> This converts all users of pstate_write to use the common state
> save/restore functionality.

Acked-by: Riku Voipio <riku.voipio@linaro.org>

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> 
> diff --git a/linux-user/signal.c b/linux-user/signal.c
> index b6f9ef4..b1958a5 100644
> --- a/linux-user/signal.c
> +++ b/linux-user/signal.c
> @@ -1274,7 +1274,7 @@ static int target_restore_sigframe(CPUARMState *env,
>      __get_user(env->xregs[31], &sf->uc.tuc_mcontext.sp);
>      __get_user(env->pc, &sf->uc.tuc_mcontext.pc);
>      __get_user(pstate, &sf->uc.tuc_mcontext.pstate);
> -    pstate_write(env, pstate);
> +    restore_state_from_spsr(env, pstate);
>  
>      __get_user(magic, &aux->fpsimd.head.magic);
>      __get_user(size, &aux->fpsimd.head.size);
> diff --git a/target-arm/gdbstub64.c b/target-arm/gdbstub64.c
> index 76d1b91..366335a 100644
> --- a/target-arm/gdbstub64.c
> +++ b/target-arm/gdbstub64.c
> @@ -63,7 +63,7 @@ int aarch64_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
>          return 8;
>      case 33:
>          /* SPSR */
> -        pstate_write(env, tmp);
> +        restore_state_from_spsr(env, tmp);
>          return 4;
>      }
>      /* Unknown register.  */
> diff --git a/target-arm/helper-a64.c b/target-arm/helper-a64.c
> index 03cd64f..990b084 100644
> --- a/target-arm/helper-a64.c
> +++ b/target-arm/helper-a64.c
> @@ -507,9 +507,8 @@ void aarch64_cpu_do_interrupt(CPUState *cs)
>          env->condexec_bits = 0;
>      }
>  
> -    // TODO: restore_state_from_spsr()
> -    env->aarch64 = 1;
> -    pstate_write(env, PSTATE_DAIF | PSTATE_MODE_EL1h);
> +    /* start IRQ with a clean program state */
> +    restore_state_from_spsr(env, PSTATE_DAIF | PSTATE_MODE_EL1h);
>  
>      env->pc = addr;
>      cs->interrupt_request |= CPU_INTERRUPT_EXITTB;
> diff --git a/target-arm/kvm64.c b/target-arm/kvm64.c
> index eaf6ff8..7a022a6 100644
> --- a/target-arm/kvm64.c
> +++ b/target-arm/kvm64.c
> @@ -230,7 +230,7 @@ int kvm_arch_get_registers(CPUState *cs)
>      if (ret) {
>          return ret;
>      }
> -    pstate_write(env, val);
> +    restore_state_from_spsr(env, val);
>  
>      /* KVM puts SP_EL0 in regs.sp and SP_EL1 in regs.sp_el1. On the
>       * QEMU side we keep the current SP in xregs[31] as well.
> -- 
> 2.0.1
>
diff mbox

Patch

diff --git a/linux-user/signal.c b/linux-user/signal.c
index b6f9ef4..b1958a5 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -1274,7 +1274,7 @@  static int target_restore_sigframe(CPUARMState *env,
     __get_user(env->xregs[31], &sf->uc.tuc_mcontext.sp);
     __get_user(env->pc, &sf->uc.tuc_mcontext.pc);
     __get_user(pstate, &sf->uc.tuc_mcontext.pstate);
-    pstate_write(env, pstate);
+    restore_state_from_spsr(env, pstate);
 
     __get_user(magic, &aux->fpsimd.head.magic);
     __get_user(size, &aux->fpsimd.head.size);
diff --git a/target-arm/gdbstub64.c b/target-arm/gdbstub64.c
index 76d1b91..366335a 100644
--- a/target-arm/gdbstub64.c
+++ b/target-arm/gdbstub64.c
@@ -63,7 +63,7 @@  int aarch64_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
         return 8;
     case 33:
         /* SPSR */
-        pstate_write(env, tmp);
+        restore_state_from_spsr(env, tmp);
         return 4;
     }
     /* Unknown register.  */
diff --git a/target-arm/helper-a64.c b/target-arm/helper-a64.c
index 03cd64f..990b084 100644
--- a/target-arm/helper-a64.c
+++ b/target-arm/helper-a64.c
@@ -507,9 +507,8 @@  void aarch64_cpu_do_interrupt(CPUState *cs)
         env->condexec_bits = 0;
     }
 
-    // TODO: restore_state_from_spsr()
-    env->aarch64 = 1;
-    pstate_write(env, PSTATE_DAIF | PSTATE_MODE_EL1h);
+    /* start IRQ with a clean program state */
+    restore_state_from_spsr(env, PSTATE_DAIF | PSTATE_MODE_EL1h);
 
     env->pc = addr;
     cs->interrupt_request |= CPU_INTERRUPT_EXITTB;
diff --git a/target-arm/kvm64.c b/target-arm/kvm64.c
index eaf6ff8..7a022a6 100644
--- a/target-arm/kvm64.c
+++ b/target-arm/kvm64.c
@@ -230,7 +230,7 @@  int kvm_arch_get_registers(CPUState *cs)
     if (ret) {
         return ret;
     }
-    pstate_write(env, val);
+    restore_state_from_spsr(env, val);
 
     /* KVM puts SP_EL0 in regs.sp and SP_EL1 in regs.sp_el1. On the
      * QEMU side we keep the current SP in xregs[31] as well.