]> xenbits.xensource.com Git - people/andrewcoop/xen.git/commit
x86/emul: Emulate %cr8 accesses
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 17 Mar 2025 17:48:51 +0000 (17:48 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 26 Mar 2025 11:54:59 +0000 (11:54 +0000)
commit14fd9b5642cd4805b49fbe716bf2cd577e724169
tree3ad8ebc13ac743e697fe9f6314f2f16b0e56c68d
parentb7264a15c28d30bb994ec9e58eba38932be231ec
x86/emul: Emulate %cr8 accesses

Petr reports:

  (XEN) MMIO emulation failed (1): d12v1 64bit @ 0010:fffff8057ba7dfbf -> 45 0f 20 c2 ...

during introspection.

This is MOV %cr8, which is wired up for hvm_mov_{to,from}_cr(); the VMExit
fastpaths, but not for the full emulation slowpaths.

Xen's handling of %cr8 turns out to be quite wrong.  At a minimum, we need
storage for %cr8 separate to APIC_TPR, and to alter intercepts based on
whether the vLAPIC is enabled or not.  But that's more work than there is time
for in the short term, so make a stopgap fix.

Extend hvmemul_{read,write}_cr() with %cr8 cases.  Unlike hvm_mov_to_cr(),
hardware hasn't filtered out invalid values (#GP checks are ahead of
intercepts), so introduce X86_CR8_VALID_MASK.

Reported-by: Petr Beneš <w1benny@gmail.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/hvm/emulate.c
xen/arch/x86/include/asm/x86-defns.h