]> Git Repo - qemu.git/commitdiff
target/arm: Start AArch32 CPUs with EL2 but not EL3 in Hyp mode
authorPeter Maydell <[email protected]>
Tue, 25 Sep 2018 13:02:33 +0000 (14:02 +0100)
committerPeter Maydell <[email protected]>
Tue, 25 Sep 2018 14:13:24 +0000 (15:13 +0100)
The ARMv8 architecture defines that an AArch32 CPU starts
in SVC mode, unless EL2 is the highest available EL, in
which case it starts in Hyp mode. (In ARMv7 a CPU with EL2
but not EL3 was not a valid configuration, but we don't
specifically reject this if the user asks for one.)

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: 20180823135047[email protected]

target/arm/cpu.c

index 258ba6dcaad8719547fd85d25d5edce59d8d1a4a..b5e61cc177556ad5372985ebf1a5878c1d19b0b9 100644 (file)
@@ -199,8 +199,18 @@ static void arm_cpu_reset(CPUState *s)
         env->cp15.c15_cpar = 1;
     }
 #else
-    /* SVC mode with interrupts disabled.  */
-    env->uncached_cpsr = ARM_CPU_MODE_SVC;
+
+    /*
+     * If the highest available EL is EL2, AArch32 will start in Hyp
+     * mode; otherwise it starts in SVC. Note that if we start in
+     * AArch64 then these values in the uncached_cpsr will be ignored.
+     */
+    if (arm_feature(env, ARM_FEATURE_EL2) &&
+        !arm_feature(env, ARM_FEATURE_EL3)) {
+        env->uncached_cpsr = ARM_CPU_MODE_HYP;
+    } else {
+        env->uncached_cpsr = ARM_CPU_MODE_SVC;
+    }
     env->daif = PSTATE_D | PSTATE_A | PSTATE_I | PSTATE_F;
 
     if (arm_feature(env, ARM_FEATURE_M)) {
This page took 0.032361 seconds and 4 git commands to generate.