|
@@ -2635,39 +2635,6 @@ uint64_t arm_hcr_el2_eff_secstate(CPUARMState *env, ARMSecuritySpace space);
|
|
|
uint64_t arm_hcr_el2_eff(CPUARMState *env);
|
|
|
uint64_t arm_hcrx_el2_eff(CPUARMState *env);
|
|
|
|
|
|
-/* Return true if the specified exception level is running in AArch64 state. */
|
|
|
-static inline bool arm_el_is_aa64(CPUARMState *env, int el)
|
|
|
-{
|
|
|
- /* This isn't valid for EL0 (if we're in EL0, is_a64() is what you want,
|
|
|
- * and if we're not in EL0 then the state of EL0 isn't well defined.)
|
|
|
- */
|
|
|
- assert(el >= 1 && el <= 3);
|
|
|
- bool aa64 = arm_feature(env, ARM_FEATURE_AARCH64);
|
|
|
-
|
|
|
- /* The highest exception level is always at the maximum supported
|
|
|
- * register width, and then lower levels have a register width controlled
|
|
|
- * by bits in the SCR or HCR registers.
|
|
|
- */
|
|
|
- if (el == 3) {
|
|
|
- return aa64;
|
|
|
- }
|
|
|
-
|
|
|
- if (arm_feature(env, ARM_FEATURE_EL3) &&
|
|
|
- ((env->cp15.scr_el3 & SCR_NS) || !(env->cp15.scr_el3 & SCR_EEL2))) {
|
|
|
- aa64 = aa64 && (env->cp15.scr_el3 & SCR_RW);
|
|
|
- }
|
|
|
-
|
|
|
- if (el == 2) {
|
|
|
- return aa64;
|
|
|
- }
|
|
|
-
|
|
|
- if (arm_is_el2_enabled(env)) {
|
|
|
- aa64 = aa64 && (env->cp15.hcr_el2 & HCR_RW);
|
|
|
- }
|
|
|
-
|
|
|
- return aa64;
|
|
|
-}
|
|
|
-
|
|
|
/*
|
|
|
* Function for determining whether guest cp register reads and writes should
|
|
|
* access the secure or non-secure bank of a cp register. When EL3 is
|
|
@@ -2699,39 +2666,6 @@ static inline bool arm_v7m_is_handler_mode(CPUARMState *env)
|
|
|
return env->v7m.exception != 0;
|
|
|
}
|
|
|
|
|
|
-/* Return the current Exception Level (as per ARMv8; note that this differs
|
|
|
- * from the ARMv7 Privilege Level).
|
|
|
- */
|
|
|
-static inline int arm_current_el(CPUARMState *env)
|
|
|
-{
|
|
|
- if (arm_feature(env, ARM_FEATURE_M)) {
|
|
|
- return arm_v7m_is_handler_mode(env) ||
|
|
|
- !(env->v7m.control[env->v7m.secure] & 1);
|
|
|
- }
|
|
|
-
|
|
|
- if (is_a64(env)) {
|
|
|
- return extract32(env->pstate, 2, 2);
|
|
|
- }
|
|
|
-
|
|
|
- switch (env->uncached_cpsr & 0x1f) {
|
|
|
- case ARM_CPU_MODE_USR:
|
|
|
- return 0;
|
|
|
- case ARM_CPU_MODE_HYP:
|
|
|
- return 2;
|
|
|
- case ARM_CPU_MODE_MON:
|
|
|
- return 3;
|
|
|
- default:
|
|
|
- if (arm_is_secure(env) && !arm_el_is_aa64(env, 3)) {
|
|
|
- /* If EL3 is 32-bit then all secure privileged modes run in
|
|
|
- * EL3
|
|
|
- */
|
|
|
- return 3;
|
|
|
- }
|
|
|
-
|
|
|
- return 1;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
/**
|
|
|
* write_list_to_cpustate
|
|
|
* @cpu: ARMCPU
|