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 ++++-- kernel/main.c | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'kernel') 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) diff --git a/kernel/main.c b/kernel/main.c index c51adc9..93bfc29 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -29,7 +29,6 @@ int kernel_main(u32 magic, u32 addr, u32 esp) multiboot_init(magic, addr); memory_install(); - memory_switch_dir(virtual_kernel_dir()); cpu_enable_features(); cpu_print(); -- cgit v1.2.3