From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IQUeZ-0002sL-FC for qemu-devel@nongnu.org; Wed, 29 Aug 2007 17:00:43 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IQUeU-0002ir-DV for qemu-devel@nongnu.org; Wed, 29 Aug 2007 17:00:43 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IQUeU-0002ih-BU for qemu-devel@nongnu.org; Wed, 29 Aug 2007 17:00:38 -0400 Received: from sp604003mt.neufgp.fr ([84.96.92.56] helo=smTp.neuf.fr) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IQUeU-0006Yh-3U for qemu-devel@nongnu.org; Wed, 29 Aug 2007 17:00:38 -0400 Received: from [84.102.211.186] by sp604003mt.gpm.neuf.ld (Sun Java System Messaging Server 6.2-5.05 (built Feb 16 2006)) with ESMTP id <0JNJ00ATMZL94QM2@sp604003mt.gpm.neuf.ld> for qemu-devel@nongnu.org; Wed, 29 Aug 2007 22:58:22 +0200 (CEST) Date: Wed, 29 Aug 2007 22:58:00 +0200 From: Fabrice Bellard Subject: Re: [Qemu-devel] CC_DST problem In-reply-to: <46D59E6B.1000606@suse.de> Message-id: <46D5DDD8.3080804@bellard.org> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7BIT References: <46D59E6B.1000606@suse.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 Alexander Graf wrote: > Hi, > > I'm still trying to implement SVM correctly and hit a serious problem. > If I set CC_OP to EFLAGS / DYNAMIC after each instruction (so most > conditional operations are based on EFLAGS) everything works as expected. > If using CC_OP==CC_OP_EFLAGS only CC_SRC should be used and CC_DST is > supposed to be completely ignored. > > So I set CC_DST to 0 (this happens when leaving and rejoining the > virtual machine, so this is the real problem) and if I do that, I get > funny segmentation faults in x86_64 guest userspace programs running in > the virtual machine (this is exactly what I see in kvm with my current > patchset as well), while 32 bit userspace programs simply hang. > So I guess this is the real problem. > > Is there any logical reason CC_DST could be used with CC_OP==CC_OP_EFLAGS? > > Attached to this email you will find a small patch that triggers this > problem. > > Thanks for any reply that could help on this, > > Alexander Graf If you play with the CC_OP logic, it is better to disable the eflags optimization code in the translator (optimize_flags() function). Regarding the implementation for SVM, you can look at how the CC are handled in SMM (do_smm_enter and helper_rsm). I see no particular problem here. I suggest to try to suppress the additions in the static translator state as I feel most of the SVM intercepts can be tested in helpers where speed is not critical. Regards, Fabrice.