From: Avi Kivity <avi@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>, kvm@vger.kernel.org
Subject: [PATCH] test: emulator: lmsw may not clear cr0.pe
Date: Wed, 12 May 2010 11:00:10 +0300 [thread overview]
Message-ID: <1273651210-29007-1-git-send-email-avi@redhat.com> (raw)
Signed-off-by: Avi Kivity <avi@redhat.com>
---
kvm/user/test/x86/emulator.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/kvm/user/test/x86/emulator.c b/kvm/user/test/x86/emulator.c
index 5406062..e677e3a 100644
--- a/kvm/user/test/x86/emulator.c
+++ b/kvm/user/test/x86/emulator.c
@@ -267,6 +267,15 @@ void test_lmsw(void)
asm("lmsw %0" : : "m"(*pmsw));
printf("before %lx after %lx\n", cr0, read_cr0());
report("lmsw (2)", cr0 == read_cr0());
+
+ /* lmsw can't clear cr0.pe */
+ msw = (cr0 & ~1ul) ^ 4; /* change EM to force trap */
+ asm("lmsw %0" : : "r"(msw));
+ report("lmsw (3)", (cr0 ^ read_cr0()) == 4 && (cr0 & 1));
+
+ /* back to normal */
+ msw = cr0;
+ asm("lmsw %0" : : "r"(msw));
}
int main()
--
1.7.0.4
next reply other threads:[~2010-05-12 8:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-12 8:00 Avi Kivity [this message]
2010-05-13 22:02 ` [PATCH] test: emulator: lmsw may not clear cr0.pe Marcelo Tosatti
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=1273651210-29007-1-git-send-email-avi@redhat.com \
--to=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
/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).