From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JeqTl-0004KO-9K for qemu-devel@nongnu.org; Thu, 27 Mar 2008 07:41:09 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JeqTi-0004K5-GB for qemu-devel@nongnu.org; Thu, 27 Mar 2008 07:41:07 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JeqTi-0004Jy-A0 for qemu-devel@nongnu.org; Thu, 27 Mar 2008 07:41:06 -0400 Received: from gmp-eb-inf-1.sun.com ([192.18.6.21]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1JeqTh-0007nS-IP for qemu-devel@nongnu.org; Thu, 27 Mar 2008 07:41:06 -0400 Received: from fe-emea-10.sun.com (gmp-eb-lb-2-fe3.eu.sun.com [192.18.6.12]) by gmp-eb-inf-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id m2RBewPR001430 for ; Thu, 27 Mar 2008 11:40:59 GMT Received: from conversion-daemon.fe-emea-10.sun.com by fe-emea-10.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) id <0JYD00E01ZRWUQ00@fe-emea-10.sun.com> (original mail from jakub@jermar.eu) for qemu-devel@nongnu.org; Thu, 27 Mar 2008 11:40:58 +0000 (GMT) Received: from [78.102.148.56] by fe-emea-10.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) with ESMTPSA id <0JYE00L5J0G6T850@fe-emea-10.sun.com> for qemu-devel@nongnu.org; Thu, 27 Mar 2008 11:40:55 +0000 (GMT) Date: Thu, 27 Mar 2008 12:38:46 +0100 From: Jakub Jermar Subject: Re: [Qemu-devel] [PATCH] Bug in AMD64 emulation Was: [AMD64] Possible problem with the DF flag during the SYSCALL instruction In-reply-to: <422A6204-1716-4ACF-B725-67159D165825@csgraf.de> Sender: Jakub.Jermar@Sun.COM Message-id: <47EB8746.9070802@jermar.eu> MIME-version: 1.0 Content-type: multipart/mixed; boundary="Boundary_(ID_kzWela6jH2sP/xds73mK4w)" References: <47E95661.9090905@jermar.eu> <422A6204-1716-4ACF-B725-67159D165825@csgraf.de> 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 This is a multi-part message in MIME format. --Boundary_(ID_kzWela6jH2sP/xds73mK4w) Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7BIT Alexander Graf wrote: > Hi, > > On Mar 25, 2008, at 8:45 PM, Jakub Jermar wrote: > >> as no one has picked my previous report up yet, I am resending my >> patch again. The patch fixes a bug in the way QEMU emulates AMD64 >> instruction called SYSCALL. The problem appears to be stale DF variable. > > Sorry I didn't have a look at it before. Good catch though! ... > I believe you're searching for load_eflags(), which automatically > updates the DF flag. Take a look at the SVM code for that issue as well > (helper.c:helper_vmrun). The included patch updates the DF flag in helper_syscall() using the load_eflags(). I thought of doing this as simply as possible and here's probably the result. When the first parameter of load_eflags() has the same value as env->eflags, the second argument doesn't matter, that's why it is 0. Will you consider this for applying? Thanks, Jakub --Boundary_(ID_kzWela6jH2sP/xds73mK4w) Content-type: text/plain; name=patch Content-transfer-encoding: 7BIT Content-disposition: inline; filename=patch diff -ru qemu-0.9.1/target-i386/helper.c qemu-0.9.1-jj/target-i386/helper.c --- qemu-0.9.1/target-i386/helper.c 2008-01-06 20:38:45.000000000 +0100 +++ qemu-0.9.1-jj/target-i386/helper.c 2008-03-27 12:27:37.000000000 +0100 @@ -1008,6 +1008,7 @@ DESC_S_MASK | DESC_W_MASK | DESC_A_MASK); env->eflags &= ~env->fmask; + load_eflags(env->eflags, 0); if (code64) env->eip = env->lstar; else --Boundary_(ID_kzWela6jH2sP/xds73mK4w)--