mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-03-23 06:25:12 +00:00
target-arm: Don't report presence of EL2 if it doesn't exist
We already modify the processor feature bits to not report EL3 support to the guest if EL3 isn't enabled for the CPU we're emulating. Add similar support for not reporting EL2 unless it is enabled. This is necessary because real world guest code running at EL3 (trusted firmware or bootloaders) will query the ID registers to determine whether it should start a guest Linux kernel in EL2 or EL3. Backports commit 3c2f7bb32b4c597925c5c7411307d51f1a56045d from qemu
This commit is contained in:
parent
3ea1b2a84c
commit
61a59665d6
|
@ -530,6 +530,15 @@ static int arm_cpu_realizefn(struct uc_struct *uc, DeviceState *dev, Error **err
|
|||
cpu->id_aa64pfr0 &= ~0xf000;
|
||||
}
|
||||
|
||||
if (!arm_feature(env, ARM_FEATURE_EL2)) {
|
||||
/* Disable the hypervisor feature bits in the processor feature
|
||||
* registers if we don't have EL2. These are id_pfr1[15:12] and
|
||||
* id_aa64pfr0_el1[11:8].
|
||||
*/
|
||||
cpu->id_aa64pfr0 &= ~0xf00;
|
||||
cpu->id_pfr1 &= ~0xf000;
|
||||
}
|
||||
|
||||
if (!cpu->has_mpu) {
|
||||
unset_feature(env, ARM_FEATURE_MPU);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue