From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Graf Subject: [PATCH] Save 64-bit of the IA-32e capable sysenter MSRs Date: Mon, 28 Jul 2008 09:01:32 +0200 Message-ID: <488D6ECC.2050602@suse.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------030203000104030208070401" To: kvm@vger.kernel.org, qemu-devel@nongnu.org Return-path: Received: from ns.suse.de ([195.135.220.2]:48894 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751578AbYG1HBe (ORCPT ); Mon, 28 Jul 2008 03:01:34 -0400 Sender: kvm-owner@vger.kernel.org List-ID: This is a multi-part message in MIME format. --------------030203000104030208070401 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 --------------030203000104030208070401 Content-Type: text/x-patch; name="sysenter.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="sysenter.patch" 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; --------------030203000104030208070401--