From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KkLM0-0000RV-AO for qemu-devel@nongnu.org; Mon, 29 Sep 2008 12:12:08 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KkLLy-0000QV-It for qemu-devel@nongnu.org; Mon, 29 Sep 2008 12:12:07 -0400 Received: from [199.232.76.173] (port=46220 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KkLLy-0000QO-12 for qemu-devel@nongnu.org; Mon, 29 Sep 2008 12:12:06 -0400 Received: from an-out-0708.google.com ([209.85.132.243]:6840) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KkLLy-0001u7-9W for qemu-devel@nongnu.org; Mon, 29 Sep 2008 12:12:06 -0400 Received: by an-out-0708.google.com with SMTP id d18so107987and.130 for ; Mon, 29 Sep 2008 09:12:02 -0700 (PDT) Message-ID: <48E0FE12.5080408@codemonkey.ws> Date: Mon, 29 Sep 2008 11:10:58 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [5318] SYSENTER/SYSEXIT IA-32e implementation (Alexander Graf). References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Alexander Graf 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. Regards, Anthony Liguori