Commit 4003963d authored by Nadav Amit's avatar Nadav Amit Committed by Paolo Bonzini
Browse files

x86: emulator: additional smsw test-case



An additional test case for the emulator was added to test smsw which is
trapped by the emulator.  The other existing test-cases occur in the guest (at
least on VMX), since the values are read directly from the CR0 read shadow.

Signed-off-by: default avatarNadav Amit <namit@cs.technion.ac.il>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent b393fe28
......@@ -336,7 +336,7 @@ void test_incdecnotneg(void *mem)
report("lock notb", *mb == vb);
}
void test_smsw(void)
void test_smsw(uint64_t *h_mem)
{
char mem[16];
unsigned short msw, msw_orig, *pmsw;
......@@ -355,6 +355,12 @@ void test_smsw(void)
if (i != 4 && pmsw[i])
zero = 0;
report("smsw (2)", msw == pmsw[4] && zero);
/* Trigger exit on smsw */
*h_mem = 0x12345678abcdeful;
asm volatile("smsw %0" : "=m"(*h_mem));
report("smsw (3)", msw == (unsigned short)*h_mem &&
(*h_mem & ~0xfffful) == 0x12345678ab0000ul);
}
void test_lmsw(void)
......@@ -998,7 +1004,7 @@ int main()
test_cr8();
test_smsw();
test_smsw(mem);
test_lmsw();
test_ljmp(mem);
test_stringio();
......
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