Skip to content
  • Nadav Har'El's avatar
    KVM: nVMX: Handling of CR0 and CR4 modifying instructions · eeadf9e7
    Nadav Har'El authored
    
    
    When L2 tries to modify CR0 or CR4 (with mov or clts), and modifies a bit
    which L1 asked to shadow (via CR[04]_GUEST_HOST_MASK), we already do the right
    thing: we let L1 handle the trap (see nested_vmx_exit_handled_cr() in a
    previous patch).
    When L2 modifies bits that L1 doesn't care about, we let it think (via
    CR[04]_READ_SHADOW) that it did these modifications, while only changing
    (in GUEST_CR[04]) the bits that L0 doesn't shadow.
    
    This is needed for corect handling of CR0.TS for lazy FPU loading: L0 may
    want to leave TS on, while pretending to allow the guest to change it.
    
    Signed-off-by: default avatarNadav Har'El <nyh@il.ibm.com>
    Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
    eeadf9e7