From: Andrew Cooper Date: Tue, 30 Jan 2018 15:39:55 +0000 (+0000) Subject: x86/emul: Introduce a test covering legacy byte ops X-Git-Tag: archive/raspbian/4.11.1-1+rpi1~1^2~66^2~657 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=95f64ae3c97613a13f24ab12f9910580b048c112;p=xen.git x86/emul: Introduce a test covering legacy byte ops Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c index 7a8df419cd..1b3406ce43 100644 --- a/tools/tests/x86_emulator/test_x86_emulator.c +++ b/tools/tests/x86_emulator/test_x86_emulator.c @@ -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;