File tree Expand file tree Collapse file tree 2 files changed +8
-51
lines changed
Expand file tree Collapse file tree 2 files changed +8
-51
lines changed Original file line number Diff line number Diff line change @@ -19,30 +19,6 @@ _start:
1919
2020 mov [ boot_params ], rsi
2121
22- # initialize page tables
23- # map kernel 1 : 1
24- push rdi
25- push rbx
26- push rcx
27- movabs rcx , OFFSET loader_start
28- movabs rbx , OFFSET loader_end
29- add rbx , 0x1000
30- L0: cmp rcx , rbx
31- jae L1
32- mov rax , rcx
33- and eax , 0xFFFFF000 # page align lower half
34- mov rdi , rax
35- shr rdi , 9 # ( edi >> 12 ) * 8 (index for boot_pgt)
36- add rdi , OFFSET .LLEVEL_1_TABLE
37- or rax , 0x3 # set present and writable bits
38- mov [ rdi ], rax
39- add rcx , 0x1000
40- jmp L0
41- L1:
42- pop rcx
43- pop rbx
44- pop rdi
45-
4622 # Set CR3
4723 mov rax , OFFSET .LLEVEL_4_TABLE
4824 mov cr3 , rax
@@ -126,5 +102,8 @@ boot_params:
126102 . section .data..LLEVEL_1_TABLE , "awR" , @progbits
127103 . align SIZE_4_KIB
128104.LLEVEL_1_TABLE:
129- .fill PAGE_TABLE_ENTRY_COUNT , 8 , 0
105+ // `.rept` is not guaranteed to be supported by Rust.
106+ .rept PAGE_TABLE_ENTRY_COUNT
107+ .quad \ + * SIZE_4_KIB + PAGE_TABLE_FLAGS
108+ .endr
130109 .size .LLEVEL_1_TABLE , . - .LLEVEL_1_TABLE
Original file line number Diff line number Diff line change @@ -46,31 +46,6 @@ _start:
4646# Bootstrap page tables are loaded and page size
4747# extensions (huge pages) enabled.
4848cpu_init:
49-
50- # initialize page tables
51- # map kernel 1 : 1
52- push edi
53- push ebx
54- push ecx
55- mov ecx , OFFSET loader_start
56- mov ebx , OFFSET loader_end
57- add ebx , 0x1000
58- L0: cmp ecx , ebx
59- jae L1
60- mov eax , ecx
61- and eax , 0xFFFFF000 # page align lower half
62- mov edi , eax
63- shr edi , 9 # ( edi >> 12 ) * 8 (index for boot_pgt)
64- add edi , OFFSET .LLEVEL_1_TABLE
65- or eax , 0x3 # set present and writable bits
66- mov [ edi ], eax
67- add ecx , 0x1000
68- jmp L0
69- L1:
70- pop ecx
71- pop ebx
72- pop edi
73-
7449 # check for long mode
7550
7651 # do we have the instruction cpuid ?
@@ -213,5 +188,8 @@ mb_info:
213188 . section .data..LLEVEL_1_TABLE , "awR" , @progbits
214189 . align SIZE_4_KIB
215190.LLEVEL_1_TABLE:
216- .fill PAGE_TABLE_ENTRY_COUNT , 8 , 0
191+ // `.rept` is not guaranteed to be supported by Rust.
192+ .rept PAGE_TABLE_ENTRY_COUNT
193+ .quad \ + * SIZE_4_KIB + PAGE_TABLE_FLAGS
194+ .endr
217195 .size .LLEVEL_1_TABLE , . - .LLEVEL_1_TABLE
You can’t perform that action at this time.
0 commit comments