@@ -500,7 +500,7 @@ static void contextidr_write(CPUARMState *env, const ARMCPRegInfo *ri,
ARMCPU *cpu = arm_env_get_cpu(env);
if (raw_read(env, ri) != value && !arm_feature(env, ARM_FEATURE_PMSA)
- && !extended_addresses_enabled(env)) {
+ && !extended_addresses_enabled(env, arm_current_el(env))) {
/* For VMSA (when not using the LPAE long descriptor page table
* format) this register includes the ASID, so do a TLB flush.
* For PMSA it is purely a process ID and no action is needed.
@@ -2162,7 +2162,7 @@ static uint64_t do_ats_write(CPUARMState *env, uint64_t value,
ret = get_phys_addr(env, value, access_type, mmu_idx,
&phys_addr, &attrs, &prot, &page_size, &fsr, &fi);
- if (extended_addresses_enabled(env)) {
+ if (extended_addresses_enabled(env, arm_current_el(env))) {
/* fsr is a DFSR/IFSR value for the long descriptor
* translation table format, but with WnR always clear.
* Convert it to a 64-bit PAR.
@@ -217,10 +217,10 @@ static inline unsigned int arm_pamax(ARMCPU *cpu)
* This is always the case if our translation regime is 64 bit,
* but depends on TTBCR.EAE for 32 bit.
*/
-static inline bool extended_addresses_enabled(CPUARMState *env)
+static inline bool extended_addresses_enabled(CPUARMState *env, unsigned int el)
{
- TCR *tcr = &env->cp15.tcr_el[arm_is_secure(env) ? 3 : 1];
- return arm_el_is_aa64(env, 1) ||
+ TCR *tcr = &env->cp15.tcr_el[el];
+ return arm_el_is_aa64(env, el) ||
(arm_feature(env, ARM_FEATURE_LPAE) && (tcr->raw_tcr & TTBCR_EAE));
}
@@ -1378,7 +1378,7 @@ void arm_debug_excp_handler(CPUState *cs)
cs->watchpoint_hit = NULL;
- if (extended_addresses_enabled(env)) {
+ if (extended_addresses_enabled(env, arm_debug_target_el(env))) {
env->exception.fsr = (1 << 9) | 0x22;
} else {
env->exception.fsr = 0x2;
@@ -1402,7 +1402,7 @@ void arm_debug_excp_handler(CPUState *cs)
return;
}
- if (extended_addresses_enabled(env)) {
+ if (extended_addresses_enabled(env, arm_debug_target_el(env))) {
env->exception.fsr = (1 << 9) | 0x22;
} else {
env->exception.fsr = 0x2;