From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JcSTF-0001Gl-LG for qemu-devel@nongnu.org; Thu, 20 Mar 2008 17:38:45 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JcSTD-0001F0-Sv for qemu-devel@nongnu.org; Thu, 20 Mar 2008 17:38:45 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JcSTD-0001Er-MY for qemu-devel@nongnu.org; Thu, 20 Mar 2008 17:38:43 -0400 Received: from amistad.itbs.cz ([81.0.238.226]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JcSTD-0000eN-EJ for qemu-devel@nongnu.org; Thu, 20 Mar 2008 17:38:43 -0400 Received: from localhost (localhost [127.0.0.1]) by amistad.itbs.cz (Postfix) with ESMTP id 9E5702F9729 for ; Thu, 20 Mar 2008 22:38:48 +0100 (CET) Received: from amistad.itbs.cz ([127.0.0.1]) by localhost (amistad.itbs.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 29546-04 for ; Thu, 20 Mar 2008 22:38:48 +0100 (CET) Received: from [10.0.0.14] (182.70.broadband6.iol.cz [88.101.70.182]) by amistad.itbs.cz (Postfix) with ESMTP id CDEEA2F974D for ; Thu, 20 Mar 2008 22:38:44 +0100 (CET) Message-ID: <47E2DB22.4020406@jermar.eu> Date: Thu, 20 Mar 2008 22:46:10 +0100 From: Jakub Jermar MIME-Version: 1.0 Subject: [PATCH]Re: [Qemu-devel] [AMD64] Possible problem with the DF flag during the SYSCALL instruction References: <47E23FF2.8060505@jermar.eu> In-Reply-To: <47E23FF2.8060505@jermar.eu> Content-Type: multipart/mixed; boundary="------------000102070007040808080700" 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. --------------000102070007040808080700 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Jakub Jermar wrote: > yesterday I tried to mask off the DF flag from the RFLAGS register > during the SYSCALL instruction by specifying this bit in the SFMASK MSR > register while running HelenOS. > > With QEMU, this didn't work (but it worked in Simics, for instance), so > I suspect that there is something wrong with handling RFLAGS.DF during > SYSCALL. Anyone wants to have a look? I have looked into the problem a little more and found out that the culprit here is probably a missing update of the DF variable in the helper_syscall() function, in target-i386/helper.c. See the attached patch. The patch fixes the problem for me, but is probably not complete (i.e. there might be other places that need a similar treatment), but I can't really tell since I am not a qemu expert. Jakub --------------000102070007040808080700 Content-Type: text/plain; name="patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="patch" --- helper.c 2008-01-06 20:38:45.000000000 +0100 +++ helper.c.new 2008-03-20 22:39:17.000000000 +0100 @@ -1008,6 +1008,7 @@ DESC_S_MASK | DESC_W_MASK | DESC_A_MASK); env->eflags &= ~env->fmask; + DF = 1 - (2 * ((env->eflags >> 10) & 1)); if (code64) env->eip = env->lstar; else --------------000102070007040808080700--