From: Avi Kivity <a...@redhat.com>

Signed-off-by: Avi Kivity <a...@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosa...@redhat.com>

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()
--
To unsubscribe from this list: send the line "unsubscribe kvm-commits" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to