core/x86_64: Enable the NX bit before using it
Spent an embarrassing amount of time trying to figure out why there was a page fault with "reserved bits set". Turns out, I had set the NX bit without enabling it.
This commit is contained in:
parent
36b9832053
commit
f93158645b
@ -5,10 +5,21 @@ const interrupts = @import("interrupts.zig");
|
||||
|
||||
pub const PAGE_SIZE = 4096;
|
||||
|
||||
// FIXME: Check if it's supported first.
|
||||
fn enableNX() void {
|
||||
asm volatile (
|
||||
\\ mov $0xC0000080, %rcx
|
||||
\\ rdmsr
|
||||
\\ or $0x800, %eax
|
||||
\\ wrmsr
|
||||
);
|
||||
}
|
||||
|
||||
// Initialize platform-specific components.
|
||||
pub fn platformInit() void {
|
||||
gdt.setupGDT();
|
||||
idt.setupIDT();
|
||||
enableNX();
|
||||
}
|
||||
|
||||
// Initialize platform-specific components just before beginning multitasking.
|
||||
|
Loading…
x
Reference in New Issue
Block a user