diff options
| author | Phil Dennis-Jordan <phil@philjordan.eu> | 2024-11-05 16:57:59 +0100 |
|---|---|---|
| committer | Paolo Bonzini <pbonzini@redhat.com> | 2024-11-09 08:34:07 +0100 |
| commit | 04858f95fa4b318bb662e046ab090179a1eeeebb (patch) | |
| tree | 29d3788bf5160cf5c8ae0c8e4a4469bfb111ec67 | |
| parent | 3a75ba650c4b4fc11c29f77c57fc30fd282c5ae9 (diff) | |
| download | focaccia-qemu-04858f95fa4b318bb662e046ab090179a1eeeebb.tar.gz focaccia-qemu-04858f95fa4b318bb662e046ab090179a1eeeebb.zip | |
i386/hvf: Raise exception on error setting APICBASE
When setting the APICBASE MSR to an illegal value, the APIC implementation will return an error. This change forwards that report to the guest as an exception rather than ignoring it when using the hvf accelerator. Signed-off-by: Phil Dennis-Jordan <phil@philjordan.eu> Link: https://lore.kernel.org/r/20241105155800.5461-5-phil@philjordan.eu Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| -rw-r--r-- | target/i386/hvf/x86_emu.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/target/i386/hvf/x86_emu.c b/target/i386/hvf/x86_emu.c index be675bcfb7..015f760acb 100644 --- a/target/i386/hvf/x86_emu.c +++ b/target/i386/hvf/x86_emu.c @@ -794,9 +794,16 @@ void simulate_wrmsr(CPUX86State *env) switch (msr) { case MSR_IA32_TSC: break; - case MSR_IA32_APICBASE: - cpu_set_apic_base(cpu->apic_state, data); + case MSR_IA32_APICBASE: { + int r; + + r = cpu_set_apic_base(cpu->apic_state, data); + if (r < 0) { + raise_exception(env, EXCP0D_GPF, 0); + } + break; + } case MSR_APIC_START ... MSR_APIC_END: { int ret; int index = (uint32_t)env->regs[R_ECX] - MSR_APIC_START; |