From 45bfdffcb2e00fda595b3f9318469f6b0d29cbe4 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Tue, 18 May 2021 22:06:59 +0200 Subject: Fixed issues with intel emulation --- kernel/drivers/cpu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'kernel/drivers/cpu.c') diff --git a/kernel/drivers/cpu.c b/kernel/drivers/cpu.c index 5d53bef..296e73a 100644 --- a/kernel/drivers/cpu.c +++ b/kernel/drivers/cpu.c @@ -179,12 +179,14 @@ CLEAR void cpu_enable_features(void) void clac(void) { - __asm__ volatile("clac" ::: "cc"); + if (cpu_extended_features.ebx & CPUID_EXT_FEAT_EBX_SMAP) + __asm__ volatile("clac" ::: "cc"); } void stac(void) { - __asm__ volatile("stac" ::: "cc"); + if (cpu_extended_features.ebx & CPUID_EXT_FEAT_EBX_SMAP) + __asm__ volatile("stac" ::: "cc"); } CLEAR void cli(void) -- cgit v1.2.3