]> xenbits.xensource.com Git - people/dariof/xen.git/commitdiff
x86/emul: Introduce a test covering legacy byte ops
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 30 Jan 2018 15:39:55 +0000 (15:39 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 31 Jan 2018 12:23:11 +0000 (12:23 +0000)
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
tools/tests/x86_emulator/test_x86_emulator.c

index 7a8df419cd02bc2f516896762776b7354b436538..1b3406ce4396db4b15799ba5a29a7f8c22134566 100644 (file)
@@ -442,6 +442,21 @@ int main(int argc, char **argv)
         goto fail;
     printf("okay\n");
 
+    printf("%-40s", "Testing xchg %bl,%ah...");
+    instr[0] = 0x86; instr[1] = 0xdc;
+    regs.eflags = X86_EFLAGS_IF;
+    regs.eip    = (unsigned long)&instr[0];
+    regs.eax    = 0xaaaabbcc;
+    regs.ebx    = 0xddddeeff;
+    rc = x86_emulate(&ctxt, &emulops);
+    if ( (rc != X86EMUL_OKAY) ||
+         (regs.eax != 0xaaaaffcc) ||
+         (regs.ebx != 0xddddeebb) ||
+         (regs.eflags != X86_EFLAGS_IF) ||
+         (regs.eip != (unsigned long)&instr[2]) )
+        goto fail;
+    printf("okay\n");
+
     printf("%-40s", "Testing lock cmpxchgl %ecx,(%ebx)...");
     instr[0] = 0xf0; instr[1] = 0x0f; instr[2] = 0xb1; instr[3] = 0x0b;
     regs.eflags = 0x200;