Commit 0a5701ed authored by Nadav Amit's avatar Nadav Amit Committed by Paolo Bonzini
Browse files

x86: test mov DR with ignored mod bits



Tests whether the emulator ignores the mod bits on mov DR instruction.  The
test performs regular mov to DR0 and reads back the data using custom mov from
DR0 while mod bits are set to zero. The expected result is obviously the value
which was written to DR0 before.

The test is performed in realmode and is only expected to fail if the CPU does
not support unrestricted mode. Note that mov-CR/DR in protected mode are
usually not handled by the emulator, as their data is available in the exit
information fields.

Signed-off-by: default avatarNadav Amit <namit@cs.technion.ac.il>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 333af1b4
......@@ -1636,6 +1636,16 @@ static void test_perf_memory_rmw(void)
print_serial(" cycles/emulated memory RMW instruction\n");
}
void test_dr_mod(void)
{
MK_INSN(drmod, "movl %ebx, %dr0\n\t"
".byte 0x0f \n\t .byte 0x21 \n\t .byte 0x0\n\t");
inregs.eax = 0xdead;
inregs.ebx = 0xaced;
exec_in_big_real_mode(&insn_drmod);
report("mov dr with mod bits", R_AX | R_BX, outregs.eax == 0xaced);
}
void realmode_start(void)
{
test_null();
......@@ -1681,6 +1691,7 @@ void realmode_start(void)
test_xlat();
test_salc();
test_fninit();
test_dr_mod();
test_nopl();
test_perf_loop();
test_perf_mov();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment