From bfd302c6559a7bcf334e2170a8d70109ac63bcbc Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Wed, 8 Jul 2015 20:08:53 +0200 Subject: [PATCH] clear NW bit in CR0 because it is not allowed in long mode --- hermit/arch/x86/kernel/entry.asm | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/hermit/arch/x86/kernel/entry.asm b/hermit/arch/x86/kernel/entry.asm index b6ed1035a..d6d4e5c38 100644 --- a/hermit/arch/x86/kernel/entry.asm +++ b/hermit/arch/x86/kernel/entry.asm @@ -302,20 +302,18 @@ Lno_remap: or eax, (1 << 0) ; set present bit mov cr3, eax - ; Set CR4 + ; Set CR4 (PAE is already set) mov eax, cr4 and eax, 0xfffbf9ff ; disable SSE - or eax, (1 << 4) ; enable PSE - or eax, (1 << 5) ; enable PAE or eax, (1 << 7) ; enable PGE mov cr4, eax - ; Set CR0 + ; Set CR0 (PM-bit is already set) mov eax, cr0 and eax, ~(1 << 30) ; enable caching + and eax, ~(1 << 29) ; disable write through caching and eax, ~(1 << 16) ; allow kernel write access to read-only pages or eax, (1 << 31) ; enable paging - or eax, (1 << 0) ; long mode also needs PM-bit set mov cr0, eax lgdt [GDT64.Pointer] ; Load the 64-bit global descriptor table.