aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTianhao Wang <shrik3@mailbox.org>2024-05-30 09:33:44 +0200
committerTianhao Wang <shrik3@mailbox.org>2024-06-11 15:17:11 +0200
commitfe791acbe74705b7401a19f1d85cb2f51e8ff616 (patch)
tree9197f41daee3f83c477f1c361f544bcc4dfcc374
parentcd658673a35df8b0da3551e819e26d35c18b89f2 (diff)
mm: explicitly clear unused entries in init table
-rw-r--r--boot/startup-x86_64.s11
1 files changed, 10 insertions, 1 deletions
diff --git a/boot/startup-x86_64.s b/boot/startup-x86_64.s
index a8b44c2..fb65a71 100644
--- a/boot/startup-x86_64.s
+++ b/boot/startup-x86_64.s
@@ -56,6 +56,15 @@ init_longmode:
mov cr4, eax
setup_paging:
+
+ ; zero out the initial page tables (2 pages in total)
+ mov edi, pml4
+clear_pt:
+ mov byte [edi], 0
+ inc edi
+ cmp edi, pt_end
+ jne clear_pt
+
; Provisional identical page mapping, using 1G huge page, therefore only 2
; table levels needed. see docs/x86_paging.txt
@@ -186,7 +195,7 @@ pml4:
pdp:
resb 4096
alignb 4096
-
+pt_end:
; reserve 8MiB for frame alloc.
; (see linker file)
[SECTION .global_free_page_stack]