From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1J0eSi-0005ZU-34 for qemu-devel@nongnu.org; Fri, 07 Dec 2007 09:45:56 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1J0eSg-0005ZI-Rw for qemu-devel@nongnu.org; Fri, 07 Dec 2007 09:45:55 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J0eSg-0005ZF-MI for qemu-devel@nongnu.org; Fri, 07 Dec 2007 09:45:54 -0500 Received: from os.inf.tu-dresden.de ([141.76.48.99]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1J0eSg-0001Sm-87 for qemu-devel@nongnu.org; Fri, 07 Dec 2007 09:45:54 -0500 Received: from erwin.inf.tu-dresden.de ([141.76.48.80] helo=chrom.inf.tu-dresden.de) by os.inf.tu-dresden.de with esmtps (TLSv1:AES256-SHA:256) (Exim 4.68) id 1J0eSd-0001Kb-4u for qemu-devel@nongnu.org; Fri, 07 Dec 2007 15:45:51 +0100 Received: from kauer by chrom.inf.tu-dresden.de with local (Exim 4.68) (envelope-from ) id 1J0e3e-0003zF-Bc for qemu-devel@nongnu.org; Fri, 07 Dec 2007 15:20:02 +0100 Date: Fri, 7 Dec 2007 15:20:02 +0100 From: Bernhard Kauer Subject: Re: [Qemu-devel] [PATCH] SVM IOIO intercept does not check all bits Message-ID: <20071207142002.GB14192@chrom.inf.tu-dresden.de> References: <20071206193147.GA4033@chrom.inf.tu-dresden.de> <653ACA19-A2D2-444F-83AC-2DB98136C16A@csgraf.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="HlL+5n6rz5pIUxbD" Content-Disposition: inline In-Reply-To: <653ACA19-A2D2-444F-83AC-2DB98136C16A@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 --HlL+5n6rz5pIUxbD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Dec 07, 2007 at 02:10:35PM +0100, Alexander Graf wrote: > Could you please make this more readable? Not easy by a one liner. I splitted the mask calculation in a separate line. Is it better now? > Apart from that the patch is fine if the highest bit in the IOIO vector is > to be set. I could not find that in the documentation. I did not understand your comment. Perhaps you mean the following sentence from the AMD vol. 2: >> For IN/OUT instructions that access more than a single byte, the >> permission bits for all bytes are checked; if any bit is set to 1, >> the I/O operation is intercepted. Greetings, Bernhard --HlL+5n6rz5pIUxbD Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="qemu_ioio.diff" Index: target-i386/helper.c =================================================================== RCS file: /sources/qemu/qemu/target-i386/helper.c,v retrieving revision 1.95 diff -u -r1.95 helper.c --- target-i386/helper.c 18 Nov 2007 01:44:38 -0000 1.95 +++ target-i386/helper.c 7 Dec 2007 14:10:57 -0000 @@ -4250,7 +4331,8 @@ uint64_t addr = ldq_phys(env->vm_vmcb + offsetof(struct vmcb, control.iopm_base_pa)); uint16_t port = (uint16_t) (param >> 16); - if(ldub_phys(addr + port / 8) & (1 << (port % 8))) + uint8_t mask = (1 << ((param >> 4) & 0x7)) - 1; + if(ldub_phys(addr + port / 8) & (mask << (port % 8))) vmexit(type, param); } break; --HlL+5n6rz5pIUxbD--