From: Phil Dennis-Jordan <phil@philjordan.eu>
To: qemu-devel@nongnu.org
Cc: dirty@apple.com, rbolshakov@ddn.com, pbonzini@redhat.com,
Phil Dennis-Jordan <phil@philjordan.eu>
Subject: [PATCH 4/5] i386/hvf: Raise exception on error setting APICBASE
Date: Tue, 5 Nov 2024 16:57:59 +0100 [thread overview]
Message-ID: <20241105155800.5461-5-phil@philjordan.eu> (raw)
In-Reply-To: <20241105155800.5461-1-phil@philjordan.eu>
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>
---
target/i386/hvf/x86_emu.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/target/i386/hvf/x86_emu.c b/target/i386/hvf/x86_emu.c
index be675bcfb71..015f760acb3 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;
--
2.39.3 (Apple Git-145)
next prev parent reply other threads:[~2024-11-05 16:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-05 15:57 [PATCH 0/5] i386/hvf: x2apic support and some small fixes Phil Dennis-Jordan
2024-11-05 15:57 ` [PATCH 1/5] i386/hvf: Integrates x2APIC support with hvf accel Phil Dennis-Jordan
2024-11-06 10:44 ` Roman Bolshakov
2024-11-05 15:57 ` [PATCH 2/5] i386/hvf: Fix for UB in handling CPUID function 0xD Phil Dennis-Jordan
2024-11-06 14:01 ` Roman Bolshakov
2024-11-05 15:57 ` [PATCH 3/5] i386/hvf: Fixes startup memory leak (vmcs caps) Phil Dennis-Jordan
2024-11-06 14:03 ` Roman Bolshakov
2024-11-05 15:57 ` Phil Dennis-Jordan [this message]
2024-11-06 14:04 ` [PATCH 4/5] i386/hvf: Raise exception on error setting APICBASE Roman Bolshakov
2024-11-05 15:58 ` [PATCH 5/5] i386/hvf: Removes duplicate/shadowed variables in hvf_vcpu_exec Phil Dennis-Jordan
2024-11-06 14:05 ` Roman Bolshakov
2024-11-06 15:26 ` [PATCH 0/5] i386/hvf: x2apic support and some small fixes Roman Bolshakov
2024-11-06 18:45 ` Phil Dennis-Jordan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241105155800.5461-5-phil@philjordan.eu \
--to=phil@philjordan.eu \
--cc=dirty@apple.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rbolshakov@ddn.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).