kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] test: emulator: lmsw may not clear cr0.pe
@ 2010-05-12  8:00 Avi Kivity
  2010-05-13 22:02 ` Marcelo Tosatti
  0 siblings, 1 reply; 2+ messages in thread
From: Avi Kivity @ 2010-05-12  8:00 UTC (permalink / raw)
  To: Marcelo Tosatti, kvm

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] test: emulator: lmsw may not clear cr0.pe
  2010-05-12  8:00 [PATCH] test: emulator: lmsw may not clear cr0.pe Avi Kivity
@ 2010-05-13 22:02 ` Marcelo Tosatti
  0 siblings, 0 replies; 2+ messages in thread
From: Marcelo Tosatti @ 2010-05-13 22:02 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm

On Wed, May 12, 2010 at 11:00:10AM +0300, Avi Kivity wrote:
> Signed-off-by: Avi Kivity <avi@redhat.com>
> ---
>  kvm/user/test/x86/emulator.c |    9 +++++++++
>  1 files changed, 9 insertions(+), 0 deletions(-)

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-05-14 18:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-12  8:00 [PATCH] test: emulator: lmsw may not clear cr0.pe Avi Kivity
2010-05-13 22:02 ` Marcelo Tosatti

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).