diff --git a/Kernel/Arch/x86/Processor.h b/Kernel/Arch/x86/Processor.h index 9ac15711a8..1d91328207 100644 --- a/Kernel/Arch/x86/Processor.h +++ b/Kernel/Arch/x86/Processor.h @@ -32,6 +32,7 @@ enum class ProcessorSpecificDataID { # define MSR_FS_BASE 0xc0000100 # define MSR_GS_BASE 0xc0000101 #endif +#define MSR_IA32_EFER 0xc0000080 // FIXME: Find a better place for these extern "C" void thread_context_first_enter(void); diff --git a/Kernel/Arch/x86/common/Processor.cpp b/Kernel/Arch/x86/common/Processor.cpp index 094f3fdc57..a6f25e257e 100644 --- a/Kernel/Arch/x86/common/Processor.cpp +++ b/Kernel/Arch/x86/common/Processor.cpp @@ -177,11 +177,8 @@ UNMAP_AFTER_INIT void Processor::cpu_setup() if (has_feature(CPUFeature::NX)) { // Turn on IA32_EFER.NXE - asm volatile( - "movl $0xc0000080, %ecx\n" - "rdmsr\n" - "orl $0x800, %eax\n" - "wrmsr\n"); + MSR ia32_efer(MSR_IA32_EFER); + ia32_efer.set(ia32_efer.get() | 0x800); } if (has_feature(CPUFeature::SMEP)) {