Skip to content

Commit fe791ac

Browse files
committed
mm: explicitly clear unused entries in init table
1 parent cd65867 commit fe791ac

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

boot/startup-x86_64.s

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@ init_longmode:
5656
mov cr4, eax
5757

5858
setup_paging:
59+
60+
; zero out the initial page tables (2 pages in total)
61+
mov edi, pml4
62+
clear_pt:
63+
mov byte [edi], 0
64+
inc edi
65+
cmp edi, pt_end
66+
jne clear_pt
67+
5968
; Provisional identical page mapping, using 1G huge page, therefore only 2
6069
; table levels needed. see docs/x86_paging.txt
6170

@@ -186,7 +195,7 @@ pml4:
186195
pdp:
187196
resb 4096
188197
alignb 4096
189-
198+
pt_end:
190199
; reserve 8MiB for frame alloc.
191200
; (see linker file)
192201
[SECTION .global_free_page_stack]

0 commit comments

Comments
 (0)