diff options
author | Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 2014-09-29 18:48:50 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2014-09-29 18:48:50 +0100 |
commit | 35979d71c40180a33242bf396a16b302f025fb82 (patch) | |
tree | eef6d1ae9410d77d8be30e9a964eeebc8b5783a1 /target-arm/helper.c | |
parent | 2dd081ae7642d54470225ea8c3f5cd4ef62fc732 (diff) |
target-arm: A64: Emulate the HVC insn
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Message-id: 1411718914-6608-8-git-send-email-edgar.iglesias@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'target-arm/helper.c')
-rw-r--r-- | target-arm/helper.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/target-arm/helper.c b/target-arm/helper.c index 25477bd8af..4d5a65329c 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -3769,7 +3769,25 @@ void switch_mode(CPUARMState *env, int mode) */ unsigned int arm_excp_target_el(CPUState *cs, unsigned int excp_idx) { - return 1; + ARMCPU *cpu = ARM_CPU(cs); + CPUARMState *env = &cpu->env; + unsigned int cur_el = arm_current_pl(env); + unsigned int target_el; + + if (!env->aarch64) { + /* TODO: Add EL2 and 3 exception handling for AArch32. */ + return 1; + } + + switch (excp_idx) { + case EXCP_HVC: + target_el = 2; + break; + default: + target_el = MAX(cur_el, 1); + break; + } + return target_el; } static void v7m_push(CPUARMState *env, uint32_t val) |