Skip to content
  • Nadav Amit's avatar
    x86: realmode: test smsw behavior with register operand · 99ee878c
    Nadav Amit authored
    
    
    The smsw instruction has an undocumented behavior, in which the high-order
    16-bits of CR0 are also saved in a 32-bit destination register.  This is
    similar to the way smsw behaves in long-mode. However, it is hard to test the
    long-mode case, since we need to cause an "invalid guest state" in long-mode.
    
    The test works as follows: it sets CR0.CD (bit 30), so any of the high 16-bits
    would be set.  It then executes smsw to register destination and compares the
    register value with that of CR0.  CR0 value is restored when the test is done.
    
    This test is expected to fail only when unrestricted mode is disabled or
    unsupported.
    
    Signed-off-by: default avatarNadav Amit <namit@cs.technion.ac.il>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    99ee878c