[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 02/39] target-arm: Extend helpers to route exceptions
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PULL 02/39] target-arm: Extend helpers to route exceptions |
Date: |
Fri, 29 May 2015 14:10:08 +0100 |
From: Greg Bellows <address@hidden>
Updated the various helper routines to set the target EL as needed using a
dedicated function.
Signed-off-by: Greg Bellows <address@hidden>
Acked-by: Edgar E. Iglesias <address@hidden>
Message-id: address@hidden
[PMM: Also set target_el in fault cases in access_check_cp_reg()]
Signed-off-by: Peter Maydell <address@hidden>
---
target-arm/op_helper.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c
index 51b04bd..43e3457 100644
--- a/target-arm/op_helper.c
+++ b/target-arm/op_helper.c
@@ -33,6 +33,20 @@ static void raise_exception(CPUARMState *env, int tt)
cpu_loop_exit(cs);
}
+static int exception_target_el(CPUARMState *env)
+{
+ int target_el = MAX(1, arm_current_el(env));
+
+ /* No such thing as secure EL1 if EL3 is aarch32, so update the target EL
+ * to EL3 in this case.
+ */
+ if (arm_is_secure(env) && !arm_el_is_aa64(env, 3) && target_el == 1) {
+ target_el = 3;
+ }
+
+ return target_el;
+}
+
uint32_t HELPER(neon_tbl)(CPUARMState *env, uint32_t ireg, uint32_t def,
uint32_t rn, uint32_t maxindex)
{
@@ -306,6 +320,7 @@ void HELPER(access_check_cp_reg)(CPUARMState *env, void
*rip, uint32_t syndrome)
if (arm_feature(env, ARM_FEATURE_XSCALE) && ri->cp < 14
&& extract32(env->cp15.c15_cpar, ri->cp, 1) == 0) {
env->exception.syndrome = syndrome;
+ env->exception.target_el = exception_target_el(env);
raise_exception(env, EXCP_UDEF);
}
@@ -318,9 +333,11 @@ void HELPER(access_check_cp_reg)(CPUARMState *env, void
*rip, uint32_t syndrome)
return;
case CP_ACCESS_TRAP:
env->exception.syndrome = syndrome;
+ env->exception.target_el = exception_target_el(env);
break;
case CP_ACCESS_TRAP_UNCATEGORIZED:
env->exception.syndrome = syn_uncategorized();
+ env->exception.target_el = exception_target_el(env);
break;
default:
g_assert_not_reached();
@@ -363,6 +380,7 @@ void HELPER(msr_i_pstate)(CPUARMState *env, uint32_t op,
uint32_t imm)
* to catch that case at translate time.
*/
if (arm_current_el(env) == 0 && !(env->cp15.sctlr_el[1] & SCTLR_UMA)) {
+ env->exception.target_el = exception_target_el(env);
raise_exception(env, EXCP_UDEF);
}
@@ -422,6 +440,7 @@ void HELPER(pre_hvc)(CPUARMState *env)
if (undef) {
env->exception.syndrome = syn_uncategorized();
+ env->exception.target_el = exception_target_el(env);
raise_exception(env, EXCP_UDEF);
}
}
@@ -452,11 +471,13 @@ void HELPER(pre_smc)(CPUARMState *env, uint32_t syndrome)
} else if (!secure && cur_el == 1 && (env->cp15.hcr_el2 & HCR_TSC)) {
/* In NS EL1, HCR controlled routing to EL2 has priority over SMD. */
env->exception.syndrome = syndrome;
+ env->exception.target_el = 2;
raise_exception(env, EXCP_HYP_TRAP);
}
if (undef) {
env->exception.syndrome = syn_uncategorized();
+ env->exception.target_el = exception_target_el(env);
raise_exception(env, EXCP_UDEF);
}
}
--
1.9.1
- [Qemu-devel] [PULL 14/39] target-arm: Add WFx instruction trap support, (continued)
- [Qemu-devel] [PULL 14/39] target-arm: Add WFx instruction trap support, Peter Maydell, 2015/05/29
- [Qemu-devel] [PULL 13/39] target-arm: Don't halt on WFI unless we don't have any work, Peter Maydell, 2015/05/29
- [Qemu-devel] [PULL 29/39] hw/acpi/aml-build: Add ToUUID macro, Peter Maydell, 2015/05/29
- [Qemu-devel] [PULL 18/39] hw/arm/virt-acpi-build: Basic framework for building ACPI tables on ARM, Peter Maydell, 2015/05/29
- [Qemu-devel] [PULL 05/39] target-arm: Set exception target EL in tlb_fill, Peter Maydell, 2015/05/29
- [Qemu-devel] [PULL 09/39] target-arm: Add AArch64 CPTR registers, Peter Maydell, 2015/05/29
- [Qemu-devel] [PULL 19/39] hw/acpi/aml-build: Add aml_memory32_fixed() term, Peter Maydell, 2015/05/29
- [Qemu-devel] [PULL 08/39] target-arm: Allow cp access functions to indicate traps to EL2 or EL3, Peter Maydell, 2015/05/29
- [Qemu-devel] [PULL 03/39] target-arm: Set correct syndrome for faults on MSR DAIF*, imm, Peter Maydell, 2015/05/29
- [Qemu-devel] [PULL 10/39] target-arm: Make singlestate TB flags common between AArch32/64, Peter Maydell, 2015/05/29
- [Qemu-devel] [PULL 02/39] target-arm: Extend helpers to route exceptions,
Peter Maydell <=
- [Qemu-devel] [PULL 11/39] target-arm: Extend FP checks to use an EL, Peter Maydell, 2015/05/29
- [Qemu-devel] [PULL 24/39] hw/arm/virt-acpi-build: Generate GTDT table, Peter Maydell, 2015/05/29
- [Qemu-devel] [PULL 07/39] target-arm: Update interrupt handling to use target EL, Peter Maydell, 2015/05/29
- [Qemu-devel] [PULL 16/39] hw/arm/virt: Move common definitions to virt.h, Peter Maydell, 2015/05/29
- [Qemu-devel] [PULL 04/39] target-arm: Move setting of exception info into tlb_fill, Peter Maydell, 2015/05/29
- [Qemu-devel] [PULL 12/39] target-arm: Move TB flags down to fill gap, Peter Maydell, 2015/05/29
- [Qemu-devel] [PULL 15/39] hw/acpi/aml-build: Make enum values to be upper case to match coding style, Peter Maydell, 2015/05/29
- [Qemu-devel] [PULL 06/39] target-arm: Make raise_exception() take syndrome and target EL, Peter Maydell, 2015/05/29
- Re: [Qemu-devel] [PULL 00/39] target-arm queue, Peter Maydell, 2015/05/29