test: emulator: lmsw may not clear cr0.pe
PATCH 1/1 test: emulator: lmsw may not clear cr0.pe
Signed-off-by Avi Kivity <[email protected]>
--- kvm/user/test/x86/emulator.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
kvm/user/test/x86/emulator.c +9 -0
@@ -267,6 +267,15 @@ void test_lmsw(void) asm("lmsw %0" : :"m" (*pmsw));printf ("before %lx after %lx\n" , cr0,read_cr0 ());report ("lmsw (2)" , cr0 ==read_cr0 ()); + +/* lmsw can't clear cr0.pe */ + msw = (cr0 & ~1ul ) ^4 ;/* change EM to force trap */ + asm("lmsw %0" : :"r" (msw)); +report ("lmsw (3)" , (cr0 ^read_cr0 ()) ==4 && (cr0 &1 )); + +/* back to normal */ + msw = cr0; + asm("lmsw %0" : :"r" (msw)); }int main ()
Signature · 1 line
1.7.0.4
Marcelo Tosatti
AppliedQuoted 4 lines · Avi Kivity
Signed-off-by Avi Kivity <[email protected]>--- kvm/user/test/x86/emulator.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
Applied, thanks.