From 82c6dd1e23cc4f174cb9c71e26a9bc942596e96d Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Tue, 8 Dec 2015 22:55:56 +0100 Subject: [PATCH] add the support for the MSR IA32_FEATURE_CONTROL - this MSR controlls the usage of VMXON - per dedault HermitCore allows the usage of VMXON outside of SMX --- hermit/arch/x86/include/asm/processor.h | 1 + hermit/arch/x86/kernel/processor.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hermit/arch/x86/include/asm/processor.h b/hermit/arch/x86/include/asm/processor.h index 3806b650e..09ef6f1ec 100644 --- a/hermit/arch/x86/include/asm/processor.h +++ b/hermit/arch/x86/include/asm/processor.h @@ -195,6 +195,7 @@ extern "C" { #define MSR_KERNEL_GS_BASE 0xc0000102 #define MSR_IA32_MISC_ENABLE 0x000001a0 +#define MSR_IA32_FEATURE_CONTROL 0x0000003a // MSR EFER bits #define EFER_SCE (1 << 0) diff --git a/hermit/arch/x86/kernel/processor.c b/hermit/arch/x86/kernel/processor.c index 6c9f29712..618468b26 100644 --- a/hermit/arch/x86/kernel/processor.c +++ b/hermit/arch/x86/kernel/processor.c @@ -318,6 +318,9 @@ int cpu_detection(void) { if (has_nx()) wrmsr(MSR_EFER, rdmsr(MSR_EFER) | EFER_NXE); + if (has_vmx()) + wrmsr(MSR_IA32_FEATURE_CONTROL, rdmsr(MSR_IA32_FEATURE_CONTROL) | 0x5); + writefs(0); #if MAX_CORES > 1 writegs(atomic_int32_read(¤t_boot_id) * ((size_t) &percore_end0 - (size_t) &percore_start)); @@ -417,8 +420,10 @@ int cpu_detection(void) { if (first_time) { kprintf("CR0 0x%llx, CR4 0x%llx\n", read_cr0(), read_cr4()); kprintf("size of xsave_t: %d\n", sizeof(xsave_t)); - if (has_msr()) + if (has_msr()) { kprintf("IA32_MISC_ENABLE 0x%llx\n", rdmsr(MSR_IA32_MISC_ENABLE)); + kprintf("IA32_FEATURE_CONTROL 0x%llx\n", rdmsr(MSR_IA32_FEATURE_CONTROL)); + } } return 0;