From: Gleb Natapov <g...@redhat.com>

Test that ljmp with operand in IO memory works.

Signed-off-by: Gleb Natapov <g...@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 db84c13..4967d1f 100644
--- a/kvm/user/test/x86/emulator.c
+++ b/kvm/user/test/x86/emulator.c
@@ -183,6 +183,19 @@ void test_pop(void *mem)
        report("ret", 1);
 }
 
+void test_ljmp(void *mem)
+{
+    unsigned char *m = mem;
+    volatile int res = 1;
+
+    *(unsigned long**)m = &&jmpf;
+    asm volatile ("data16/mov %%cs, %0":"=m"(*(m + sizeof(unsigned long))));
+    asm volatile ("rex64/ljmp *%0"::"m"(*m));
+    res = 0;
+jmpf:
+    report("ljmp", res);
+}
+
 unsigned long read_cr0(void)
 {
        unsigned long cr0;
@@ -258,6 +271,7 @@ int main()
 
        test_smsw();
        test_lmsw();
+        test_ljmp(mem);
 
        printf("\nSUMMARY: %d tests, %d failures\n", tests, fails);
        return fails ? 1 : 0;
--
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