From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KkLTr-0004JE-7f for qemu-devel@nongnu.org; Mon, 29 Sep 2008 12:20:15 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KkLTo-0004Hh-TB for qemu-devel@nongnu.org; Mon, 29 Sep 2008 12:20:14 -0400 Received: from [199.232.76.173] (port=56130 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KkLTo-0004HV-LE for qemu-devel@nongnu.org; Mon, 29 Sep 2008 12:20:12 -0400 Received: from mx2.suse.de ([195.135.220.15]:36575) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KkLTo-0003JQ-T7 for qemu-devel@nongnu.org; Mon, 29 Sep 2008 12:20:13 -0400 Message-ID: <48E10039.8000104@suse.de> Date: Mon, 29 Sep 2008 18:20:09 +0200 From: Alexander Graf MIME-Version: 1.0 Subject: Re: [Qemu-devel] [5318] SYSENTER/SYSEXIT IA-32e implementation (Alexander Graf). References: <48E0FE12.5080408@codemonkey.ws> In-Reply-To: <48E0FE12.5080408@codemonkey.ws> Content-Type: multipart/mixed; boundary="------------060509090707030502010109" Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org This is a multi-part message in MIME format. --------------060509090707030502010109 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Anthony Liguori wrote: > Andrzej Zaborowski wrote: >> Revision: 5318 >> http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5318 >> Author: balrog >> Date: 2008-09-25 18:16:18 +0000 (Thu, 25 Sep 2008) >> >> Log Message: >> ----------- >> SYSENTER/SYSEXIT IA-32e implementation (Alexander Graf). >> >> On Intel CPUs, sysenter and sysexit are valid in 64-bit mode. This patch >> makes both 64-bit aware and enables them for Intel CPUs. >> Add cpu save/load for 64-bit wide sysenter variables. >> >> Signed-off-by: Alexander Graf >> > > This change broke save/restore. It was already broken when this > commit happened so it really just further broke it :-) > >> Modified: trunk/target-i386/cpu.h >> =================================================================== >> --- trunk/target-i386/cpu.h 2008-09-25 18:11:30 UTC (rev 5317) >> +++ trunk/target-i386/cpu.h 2008-09-25 18:16:18 UTC (rev 5318) >> @@ -549,8 +549,8 @@ >> >> /* sysenter registers */ >> uint32_t sysenter_cs; >> > > is a u32 > >> - uint32_t sysenter_esp; >> - uint32_t sysenter_eip; >> + target_ulong sysenter_esp; >> + target_ulong sysenter_eip; >> uint64_t efer; >> uint64_t star; >> > > But is being saved as a target_ulong. > >> - qemu_put_be32s(f, &env->sysenter_cs); >> - qemu_put_be32s(f, &env->sysenter_esp); >> - qemu_put_be32s(f, &env->sysenter_eip); >> + qemu_put_betls(f, &env->sysenter_cs); >> + qemu_put_betls(f, &env->sysenter_esp); >> + qemu_put_betls(f, &env->sysenter_eip); >> >> qemu_put_betls(f, &env->cr[0]); >> qemu_put_betls(f, &env->cr[2]); >> @@ -169,7 +169,7 @@ > > And loaded as a u32. > >> >> qemu_get_be32s(f, &env->sysenter_cs); >> - qemu_get_be32s(f, &env->sysenter_esp); >> - qemu_get_be32s(f, &env->sysenter_eip); >> + if (version_id >= 7) { >> + qemu_get_betls(f, &env->sysenter_esp); >> + qemu_get_betls(f, &env->sysenter_eip); >> + } else { >> + qemu_get_be32s(f, &env->sysenter_esp); >> + qemu_get_be32s(f, &env->sysenter_eip); >> + } >> > > When making changes to target-i386, please make sure to test both qemu > and qemu-system-x86_64. In this case, the code would have worked with > qemu but it doesn't work with qemu-system-x86_64. Ouch, thanks for the catch. Please double-check and apply :-). Alex --------------060509090707030502010109 Content-Type: text/x-patch; name="sysenter-save.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="sysenter-save.patch" Index: target-i386/machine.c =================================================================== --- target-i386/machine.c (revision 5350) +++ target-i386/machine.c (working copy) @@ -88,7 +88,7 @@ cpu_put_seg(f, &env->gdt); cpu_put_seg(f, &env->idt); - qemu_put_betls(f, &env->sysenter_cs); + qemu_put_be32s(f, &env->sysenter_cs); qemu_put_betls(f, &env->sysenter_esp); qemu_put_betls(f, &env->sysenter_eip); --------------060509090707030502010109--