qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Bernhard Kauer <kauer@os.inf.tu-dresden.de>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] SVM IOIO intercept does not check all bits
Date: Fri, 7 Dec 2007 15:20:02 +0100	[thread overview]
Message-ID: <20071207142002.GB14192@chrom.inf.tu-dresden.de> (raw)
In-Reply-To: <653ACA19-A2D2-444F-83AC-2DB98136C16A@csgraf.de>

[-- Attachment #1: Type: text/plain, Size: 637 bytes --]

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

[-- Attachment #2: qemu_ioio.diff --]
[-- Type: text/x-diff, Size: 726 bytes --]

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	other threads:[~2007-12-07 14:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-06 19:31 [Qemu-devel] [PATCH] SVM IOIO intercept does not check all bits Bernhard Kauer
2007-12-07 13:10 ` Alexander Graf
2007-12-07 14:20   ` Bernhard Kauer [this message]
2007-12-07 15:16     ` Alexander Graf
2007-12-08 20:50       ` Bernhard Kauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071207142002.GB14192@chrom.inf.tu-dresden.de \
    --to=kauer@os.inf.tu-dresden.de \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).