There is no need to explicitly specify the CR4_VMXE bit when writing to guest
CR4. This bit is specific to the Intel VTX and removing it makes the library more portable to AMD/SVM. In the Intel VTX implementation, the hypervisor will ensure that this bit is always set. See vmx_fix_cr4() for details. Suggested by: grehan
This commit is contained in:
parent
d40b98f60b
commit
19e3bb399c
@ -49,10 +49,6 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include "vmmapi.h"
|
#include "vmmapi.h"
|
||||||
#include "mptable.h"
|
#include "mptable.h"
|
||||||
|
|
||||||
#ifndef CR4_VMXE
|
|
||||||
#define CR4_VMXE (1UL << 13)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define BIOS_ROM_BASE (0xf0000)
|
#define BIOS_ROM_BASE (0xf0000)
|
||||||
#define BIOS_ROM_SIZE (0x10000)
|
#define BIOS_ROM_SIZE (0x10000)
|
||||||
|
|
||||||
@ -536,7 +532,7 @@ vcpu_reset(struct vmctx *vmctx, int vcpu)
|
|||||||
if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_CR3, zero)) != 0)
|
if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_CR3, zero)) != 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
cr4 = CR4_VMXE;
|
cr4 = 0;
|
||||||
if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_CR4, cr4)) != 0)
|
if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_CR4, cr4)) != 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
|
@ -37,10 +37,6 @@ __FBSDID("$FreeBSD$");
|
|||||||
|
|
||||||
#include "vmmapi.h"
|
#include "vmmapi.h"
|
||||||
|
|
||||||
#ifndef CR4_VMXE
|
|
||||||
#define CR4_VMXE (1UL << 13)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DESC_UNUSABLE 0x00010000
|
#define DESC_UNUSABLE 0x00010000
|
||||||
|
|
||||||
#define GUEST_NULL_SEL 0
|
#define GUEST_NULL_SEL 0
|
||||||
@ -74,7 +70,7 @@ vm_setup_freebsd_registers(struct vmctx *vmctx, int vcpu,
|
|||||||
if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_CR0, cr0)) != 0)
|
if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_CR0, cr0)) != 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
cr4 = CR4_PAE | CR4_VMXE;
|
cr4 = CR4_PAE;
|
||||||
if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_CR4, cr4)) != 0)
|
if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_CR4, cr4)) != 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user