From 1b88764676695c6934c201e1874e1452312d0805 Mon Sep 17 00:00:00 2001 From: Achilleas Anagnostopoulos Date: Wed, 14 Jun 2017 17:22:31 +0100 Subject: [PATCH] Enable support for the no-execute (NX) bit --- arch/x86_64/asm/rt0_32.s | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86_64/asm/rt0_32.s b/arch/x86_64/asm/rt0_32.s index 4e6fc3f..59ffdc2 100644 --- a/arch/x86_64/asm/rt0_32.s +++ b/arch/x86_64/asm/rt0_32.s @@ -297,10 +297,11 @@ _rt0_enter_long_mode: or eax, 1 << 5 mov cr4, eax - ; Now enable long mode by modifying the EFER MSR + ; Now enable long mode (bit 8) and the no-execute support (bit 11) by + ; modifying the EFER MSR mov ecx, 0xc0000080 rdmsr ; read msr value to eax - or eax, 1 << 8 + or eax, (1 << 8) | (1<<11) wrmsr ; Finally enable paging