summaryrefslogtreecommitdiffstats
path: root/target-arm
diff options
context:
space:
mode:
authorEdgar E. Iglesias2014-05-27 18:09:54 +0200
committerPeter Maydell2014-05-27 18:09:54 +0200
commitdb6c3cd0e7fc58dacba89bf808e2892cd6a18b28 (patch)
treee34d72a9b20e7d8dc59bdae8bfe7cd0111a6d0a0 /target-arm
parenttarget-arm: A64: Trap ERET from EL0 at translation time (diff)
downloadqemu-db6c3cd0e7fc58dacba89bf808e2892cd6a18b28.tar.gz
qemu-db6c3cd0e7fc58dacba89bf808e2892cd6a18b28.tar.xz
qemu-db6c3cd0e7fc58dacba89bf808e2892cd6a18b28.zip
target-arm: A64: Generalize ERET to various ELs
Adds support for ERET to and from AArch64 EL2 and 3. Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Message-id: 1400980132-25949-20-git-send-email-edgar.iglesias@gmail.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'target-arm')
-rw-r--r--target-arm/op_helper.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c
index e95a7f401f..50a4157acd 100644
--- a/target-arm/op_helper.c
+++ b/target-arm/op_helper.c
@@ -386,13 +386,13 @@ void HELPER(msr_i_pstate)(CPUARMState *env, uint32_t op, uint32_t imm)
void HELPER(exception_return)(CPUARMState *env)
{
- unsigned int spsr_idx = aarch64_banked_spsr_index(1);
+ int cur_el = arm_current_pl(env);
+ unsigned int spsr_idx = aarch64_banked_spsr_index(cur_el);
uint32_t spsr = env->banked_spsr[spsr_idx];
int new_el, i;
- int cur_el = arm_current_pl(env);
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];
}
@@ -400,6 +400,7 @@ void HELPER(exception_return)(CPUARMState *env)
env->exclusive_addr = -1;
if (spsr & PSTATE_nRW) {
+ /* TODO: We currently assume EL1/2/3 are running in AArch64. */
env->aarch64 = 0;
new_el = 0;
env->uncached_cpsr = 0x10;
@@ -429,7 +430,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[1];
+ env->pc = env->elr_el[cur_el];
}
return;
@@ -443,7 +444,7 @@ illegal_return:
* no change to exception level, execution state or stack pointer
*/
env->pstate |= PSTATE_IL;
- env->pc = env->elr_el[1];
+ env->pc = env->elr_el[cur_el];
spsr &= PSTATE_NZCV | PSTATE_DAIF;
spsr |= pstate_read(env) & ~(PSTATE_NZCV | PSTATE_DAIF);
pstate_write(env, spsr);