summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorneel <neel@FreeBSD.org>2012-08-04 02:14:27 +0000
committerneel <neel@FreeBSD.org>2012-08-04 02:14:27 +0000
commit19e3bb399c65527fcc13a4ae345b71ee6c5fee84 (patch)
tree27a8bc92d6956c519d4a2baf76cd0c196fe8c143
parentd40b98f60b39af7a76f82076ee5e53f389dc3cba (diff)
downloadFreeBSD-src-19e3bb399c65527fcc13a4ae345b71ee6c5fee84.zip
FreeBSD-src-19e3bb399c65527fcc13a4ae345b71ee6c5fee84.tar.gz
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
-rw-r--r--lib/libvmmapi/vmmapi.c6
-rw-r--r--lib/libvmmapi/vmmapi_freebsd.c6
2 files changed, 2 insertions, 10 deletions
diff --git a/lib/libvmmapi/vmmapi.c b/lib/libvmmapi/vmmapi.c
index a33a94e..077a46b 100644
--- a/lib/libvmmapi/vmmapi.c
+++ b/lib/libvmmapi/vmmapi.c
@@ -49,10 +49,6 @@ __FBSDID("$FreeBSD$");
#include "vmmapi.h"
#include "mptable.h"
-#ifndef CR4_VMXE
-#define CR4_VMXE (1UL << 13)
-#endif
-
#define BIOS_ROM_BASE (0xf0000)
#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)
goto done;
- cr4 = CR4_VMXE;
+ cr4 = 0;
if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_CR4, cr4)) != 0)
goto done;
diff --git a/lib/libvmmapi/vmmapi_freebsd.c b/lib/libvmmapi/vmmapi_freebsd.c
index c4ad989..9bd2988 100644
--- a/lib/libvmmapi/vmmapi_freebsd.c
+++ b/lib/libvmmapi/vmmapi_freebsd.c
@@ -37,10 +37,6 @@ __FBSDID("$FreeBSD$");
#include "vmmapi.h"
-#ifndef CR4_VMXE
-#define CR4_VMXE (1UL << 13)
-#endif
-
#define DESC_UNUSABLE 0x00010000
#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)
goto done;
- cr4 = CR4_PAE | CR4_VMXE;
+ cr4 = CR4_PAE;
if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_CR4, cr4)) != 0)
goto done;
OpenPOWER on IntegriCloud