On 3/24/21 11:07 PM, Richard Henderson wrote: > On 3/23/21 9:46 AM, Claudio Fontana wrote: >> this function is used for kvm too, add it to the >> cpu-common module. >> >> Signed-off-by: Claudio Fontana <cfont...@suse.de> > > Reviewed-by: Richard Henderson <richard.hender...@linaro.org> > >> /* #endif TARGET_AARCH64 , see matching comment above */ >> + >> +uint64_t arm_sctlr(CPUARMState *env, int el) >> +{ >> + /* Only EL0 needs to be adjusted for EL1&0 or EL2&0. */ >> + if (el == 0) { >> + ARMMMUIdx mmu_idx = arm_mmu_idx_el(env, 0); >> + el = (mmu_idx == ARMMMUIdx_E20_0 || mmu_idx == ARMMMUIdx_SE20_0) >> + ? 2 : 1; > > I only thought of it because of the comment, but *E20_0 is aarch64 only; > aarch32 always uses el = 1 here. ;-) > > > r~
In this case, maybe we should do: uint64_t arm_sctlr(CPUARMState *env, int el) { /* Only EL0 needs to be adjusted for EL1&0 or EL2&0. */ if (el == 0) { #ifdef TARGET_AARCH64 ARMMMUIdx mmu_idx = arm_mmu_idx_el(env, 0); el = (mmu_idx == ARMMMUIdx_E20_0 || mmu_idx == ARMMMUIdx_SE20_0) ? 2 : 1; #else el = 1; #endif } return env->cp15.sctlr_el[el]; } ? Thanks, Claudio