From 8f4fdc955930bb395ceaa35a924dd40f1ca78aaf Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Tue, 8 Dec 2015 22:14:52 +0100 Subject: [PATCH] add detection of VMX --- hermit/arch/x86/include/asm/processor.h | 5 +++++ hermit/arch/x86/kernel/processor.c | 3 ++- 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 12ab0d521..3806b650e 100644 --- a/hermit/arch/x86/include/asm/processor.h +++ b/hermit/arch/x86/include/asm/processor.h @@ -63,6 +63,7 @@ extern "C" { // feature list 0x00000001 (ecx) #define CPU_FEATURE_MWAIT (1 << 3) +#define CPU_FEATURE_VMX (1 << 5) #define CPU_FEATURE_SSE3 (1 << 9) #define CPU_FEATURE_FMA (1 << 12) #define CPU_FEATURE_DCA (1 << 18) @@ -261,6 +262,10 @@ inline static uint32_t has_mwait(void) { return (cpu_info.feature2 & CPU_FEATURE_MWAIT); } +inline static uint32_t has_vmx(void) { + return (cpu_info.feature2 & CPU_FEATURE_VMX); +} + inline static uint32_t has_sse3(void) { return (cpu_info.feature2 & CPU_FEATURE_SSE3); } diff --git a/hermit/arch/x86/kernel/processor.c b/hermit/arch/x86/kernel/processor.c index c5aea2ac4..91d60011c 100644 --- a/hermit/arch/x86/kernel/processor.c +++ b/hermit/arch/x86/kernel/processor.c @@ -349,7 +349,7 @@ int cpu_detection(void) { a = b = c = d = 0; cpuid(1, &a, &b, &cpu_info.feature2, &cpu_info.feature1); - kprintf("CPU features: %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", + kprintf("CPU features: %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", has_sse() ? "SSE " : "", has_sse2() ? "SSE2 " : "", has_sse3() ? "SSE3 " : "", @@ -364,6 +364,7 @@ int cpu_detection(void) { has_fxsr() ? "FXSR " : "", has_xsave() ? "XSAVE " : "", has_osxsave() ? "OSXSAVE " : "", + has_vmx() ? "VMX " : "", has_rdtscp() ? "RDTSCP " : "", has_fsgsbase() ? "FSGSBASE " : "", has_mwait() ? "MWAIT " : "",