Skip to content

Commit

Permalink
Set CR4[18] OSXSAVE in cr4_guest_host_mask
Browse files Browse the repository at this point in the history
During boot Windows 11 as a guest VM was
faulting on XSETBV instruction because
CR4[18] OSXSAVE was not set. (XSETBEV is
undefined if CR4[18] OSXSAVE is not set.)

This patch sets cr4_guest_host_mask[18]
causing the the corresponding cr4 shadow
register to virtualize the state of
CR4[18].  This results in a more robust
CR4 implementation and removes the chance
of CR4[18] OSXSAVE corruption.

Co-authored-by: Christopher Pelloux <[email protected]>
  • Loading branch information
clydergriffin and chp-io committed Dec 13, 2024
1 parent 329ee9d commit 5531a0c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion deps/hypervisor/bfvmm/src/hve/arch/intel_x64/vcpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ vcpu::vcpu(
m_vpid_handler.enable();
m_nmi_handler.enable_exiting();
m_control_register_handler.enable_wrcr0_exiting(0);
m_control_register_handler.enable_wrcr4_exiting(0);
m_control_register_handler.enable_wrcr4_exiting(::intel_x64::cr4::osxsave::mask);
}

//==============================================================================
Expand Down

0 comments on commit 5531a0c

Please sign in to comment.