qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Josh Triplett <josh@joshtriplett.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] target-i386: GPF on invalid MSRs
Date: Thu, 26 May 2011 02:08:06 -0700	[thread overview]
Message-ID: <20110526090804.GA32647@leaf> (raw)

qemu currently returns 0 for rdmsr on invalid MSRs, and ignores wrmsr on
invalid MSRs.  Real x86 processors GPF on invalid MSRs, which allows
software to detect unavailable MSRs.  Emulate this behavior correctly in
qemu.

Bug discovered via the BIOS Implementation Test Suite
<http://biosbits.org/>; fix tested the same way, for both 32-bit and
64-bit x86.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
---
 op_helper.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff -Naur a/target-i386/op_helper.c b/target-i386/op_helper.c
--- a/target-i386/op_helper.c	2011-02-07 15:13:34.000000000 -0800
+++ b/target-i386/op_helper.c	2011-05-26 00:08:49.608636117 -0700
@@ -3135,7 +3135,7 @@
                 env->mce_banks[offset] = val;
             break;
         }
-        /* XXX: exception ? */
+        raise_exception(EXCP0D_GPF);
         break;
     }
 }
@@ -3266,7 +3266,7 @@
             val = env->mce_banks[offset];
             break;
         }
-        /* XXX: exception ? */
+        raise_exception(EXCP0D_GPF);
         val = 0;
         break;
     }

             reply	other threads:[~2011-05-26  9:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-26  9:08 Josh Triplett [this message]
2011-05-26  9:12 ` [Qemu-devel] [PATCH] target-i386: GPF on invalid MSRs Alexander Graf
2011-05-27 15:13   ` Josh Triplett
2011-05-27 15:16     ` Alexander Graf
2011-05-27 15:46       ` Josh Triplett

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=20110526090804.GA32647@leaf \
    --to=josh@joshtriplett.org \
    --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).