* Pratik Vyas <p...@openbsd.org> [2020-04-08 01:32:56 -0600]:

CVSROOT:        /cvs
Module name:    src
Changes by:     p...@cvs.openbsd.org    2020/04/08 01:32:56

Modified files:
        sys/arch/amd64/amd64: vmm.c
        sys/arch/amd64/include: vmmvar.h

Log message:
vmm(4): handle cr0 writes more correctly for vmx

* Switch to using vcpu->vc_vmx_cr0_fixed[1|0] to check must be 0|1 bits,
rather than the cpu capabilities.

* Add the checks on the new values as per the SDM 2.5 CONTROL REGISTERS.

2.1 Bits 63:32 of CR0 and CR4 are reserved and must be written with zeros.
Writing a nonzero value to any of the upper 32 bits results in a
general-protection exception, #GP(0).

2.2 setting the PG flag when the PE flag is clear causes a general-protection
exception (#GP).

11.5.1 Cache Control Registers and Bits, Table 11-5. Cache Operating Modes

2.3 CD: 0, NW: 1, Invalid setting. Generates a general-protection exception
(#GP) with an error code of 0.

*. Don't alway assume, if the guest is not disabling paging, they are
enabling it, check the guest is actually enabling paging. also only read
cr4 when we actually need it, not right at the start.

ok mpi@

Patch from Adam Steen <a...@adamsteen.com.au>


Also, with help and review from Mike Larkin

Reply via email to