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
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;

Reply via email to