* [Qemu-devel] [PATCH] Save 64-bit of the IA-32e capable sysenter MSRs
@ 2008-07-28 7:01 Alexander Graf
2008-07-31 10:07 ` [Qemu-devel] " Avi Kivity
0 siblings, 1 reply; 4+ messages in thread
From: Alexander Graf @ 2008-07-28 7:01 UTC (permalink / raw)
To: kvm, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 908 bytes --]
Hi,
When transitioning from KVM to the qemu userspace, we try to get and
push a whole bunch of MSR values, including the SYSENTER ones. While
this is basically a good idea, qemu doesn't know anything about SYSENTER
on x86_64, which is an additional feature only available on Intel CPUs
and thus defines SYSENTER_EIP and SYSENTER_ESP as 32-bit values.
Because we're saving/restoring the SYSENTER values on transitions to
userspace and the values in env->cpu only hold 32 bits, they get
truncated to 32-bit. The easiest way around this is to widen the fields
to 64 bits. This should not disturb the current functionality, but
allows us to run 32-bit code on x86_64 using VMX.
As this is KVM specific for now, I'll only CC the qemu mailinglist, but
wouldn't encourage qemu to take the patch for now, as it's not necessary
when emulating an AMD CPU.
Signed-off-by: Alexander Graf <agraf@suse.de>
[-- Attachment #2: sysenter.patch --]
[-- Type: text/x-patch, Size: 411 bytes --]
diff --git a/qemu/target-i386/cpu.h b/qemu/target-i386/cpu.h
index 7e95900..61c39d4 100644
--- a/qemu/target-i386/cpu.h
+++ b/qemu/target-i386/cpu.h
@@ -542,8 +542,8 @@ typedef struct CPUX86State {
/* sysenter registers */
uint32_t sysenter_cs;
- uint32_t sysenter_esp;
- uint32_t sysenter_eip;
+ uint64_t sysenter_esp;
+ uint64_t sysenter_eip;
uint64_t efer;
uint64_t star;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Qemu-devel] Re: [PATCH] Save 64-bit of the IA-32e capable sysenter MSRs
2008-07-28 7:01 [Qemu-devel] [PATCH] Save 64-bit of the IA-32e capable sysenter MSRs Alexander Graf
@ 2008-07-31 10:07 ` Avi Kivity
2008-08-01 13:57 ` Alexander Graf
0 siblings, 1 reply; 4+ messages in thread
From: Avi Kivity @ 2008-07-31 10:07 UTC (permalink / raw)
To: Alexander Graf; +Cc: qemu-devel, kvm
Alexander Graf wrote:
> Hi,
>
> When transitioning from KVM to the qemu userspace, we try to get and
> push a whole bunch of MSR values, including the SYSENTER ones. While
> this is basically a good idea, qemu doesn't know anything about
> SYSENTER on x86_64, which is an additional feature only available on
> Intel CPUs and thus defines SYSENTER_EIP and SYSENTER_ESP as 32-bit
> values.
>
> Because we're saving/restoring the SYSENTER values on transitions to
> userspace and the values in env->cpu only hold 32 bits, they get
> truncated to 32-bit. The easiest way around this is to widen the
> fields to 64 bits. This should not disturb the current functionality,
> but allows us to run 32-bit code on x86_64 using VMX.
>
> As this is KVM specific for now, I'll only CC the qemu mailinglist,
> but wouldn't encourage qemu to take the patch for now, as it's not
> necessary when emulating an AMD CPU.
>
Applied, thanks. I imagine save/restore support needs updating as
well? That should go into qemuy btw since maintaining the save/restore
format across forks isn't possible.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Qemu-devel] Re: [PATCH] Save 64-bit of the IA-32e capable sysenter MSRs
2008-07-31 10:07 ` [Qemu-devel] " Avi Kivity
@ 2008-08-01 13:57 ` Alexander Graf
2008-08-10 8:54 ` Avi Kivity
0 siblings, 1 reply; 4+ messages in thread
From: Alexander Graf @ 2008-08-01 13:57 UTC (permalink / raw)
To: Avi Kivity; +Cc: qemu-devel, kvm
On Jul 31, 2008, at 12:07 PM, Avi Kivity wrote:
> Alexander Graf wrote:
>> Hi,
>>
>> When transitioning from KVM to the qemu userspace, we try to get
>> and push a whole bunch of MSR values, including the SYSENTER ones.
>> While this is basically a good idea, qemu doesn't know anything
>> about SYSENTER on x86_64, which is an additional feature only
>> available on Intel CPUs and thus defines SYSENTER_EIP and
>> SYSENTER_ESP as 32-bit values.
>>
>> Because we're saving/restoring the SYSENTER values on transitions
>> to userspace and the values in env->cpu only hold 32 bits, they get
>> truncated to 32-bit. The easiest way around this is to widen the
>> fields to 64 bits. This should not disturb the current
>> functionality, but allows us to run 32-bit code on x86_64 using VMX.
>>
>> As this is KVM specific for now, I'll only CC the qemu mailinglist,
>> but wouldn't encourage qemu to take the patch for now, as it's not
>> necessary when emulating an AMD CPU.
>>
>
> Applied, thanks. I imagine save/restore support needs updating as
> well?
Yes, it does. Thanks for the reminder.
> That should go into qemuy btw since maintaining the save/restore
> format across forks isn't possible.
I'll just write up a patch that implements IA-32e sysenter in qemu
after vacation. That should fix the KVM issues too. For now it's good
we have a workaround that works in "most cases" at least.
Alex
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Qemu-devel] Re: [PATCH] Save 64-bit of the IA-32e capable sysenter MSRs
2008-08-01 13:57 ` Alexander Graf
@ 2008-08-10 8:54 ` Avi Kivity
0 siblings, 0 replies; 4+ messages in thread
From: Avi Kivity @ 2008-08-10 8:54 UTC (permalink / raw)
To: Alexander Graf; +Cc: qemu-devel, kvm
Alexander Graf wrote:
>
> For now it's good we have a workaround that works in "most cases" at
> least.
That's what the DANGEROUS label is for.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-08-10 8:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-28 7:01 [Qemu-devel] [PATCH] Save 64-bit of the IA-32e capable sysenter MSRs Alexander Graf
2008-07-31 10:07 ` [Qemu-devel] " Avi Kivity
2008-08-01 13:57 ` Alexander Graf
2008-08-10 8:54 ` Avi Kivity
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).