From ee3166c21bdfbe449bd5bfa236fd671901e7c06b Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Mon, 30 Jun 2014 01:47:33 +0200 Subject: [PATCH] enabled paging by using a transparent idendity paging during boot --- arch/x86/kernel/entry.asm | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/entry.asm b/arch/x86/kernel/entry.asm index f664e55..7765620 100644 --- a/arch/x86/kernel/entry.asm +++ b/arch/x86/kernel/entry.asm @@ -76,10 +76,12 @@ stublet: ; This will set up the x86 control registers: ; Caching and the floating point unit are enabled +; Bootstrap page tables are loaded and page size +; extensions (huge pages) enabled. global cpu_init cpu_init: -; clears the current pgd entry - xor eax, eax +; Set CR3 + mov eax, boot_pgd mov cr3, eax ; Set CR4 @@ -319,5 +321,18 @@ ALIGN 4096 boot_stack: TIMES (KERNEL_STACK_SIZE) DB 0xcd +; Bootstrap page tables are used during the initialization. +; These tables do a simple identity paging and will +; be replaced in page_init() by more fine-granular mappings. +global boot_map +ALIGN 4096 +boot_map: +boot_pgd: + %assign i 0 + %rep 1024 + DD (i << 12) | 0x083 + %assign i i+1 + %endrep + ; add some hints to the ELF file SECTION .note.GNU-stack noalloc noexec nowrite progbits