summaryrefslogtreecommitdiff
path: root/src/arch/amd64/boot.S
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/amd64/boot.S')
-rw-r--r--src/arch/amd64/boot.S37
1 files changed, 21 insertions, 16 deletions
diff --git a/src/arch/amd64/boot.S b/src/arch/amd64/boot.S
index 447ac2f..6482d79 100644
--- a/src/arch/amd64/boot.S
+++ b/src/arch/amd64/boot.S
@@ -1,9 +1,10 @@
global start
-global pml4_list
-global init_pdpt
-global init_pd
-global init_pt
+global kernel_pml4
+global kernel_pdpt_0
+global kernel_pd_0
+global kernel_pt_0
global paging_pt
+global bootstrap_pt
extern kmain
extern amd64_shim
bits 32
@@ -25,15 +26,17 @@ mb_end:
section .bss
align 4096
-pml4_list: ; reserve memory for initial 512 pml4 entires
+kernel_pml4: ; reserve memory for initial 512 pml4 entires
resb 4096
-init_pdpt: ; reserve memory for initial 512 pdpt entires
+kernel_pdpt_0: ; reserve memory for initial 512 pdpt entires
resb 4096
-init_pd: ; reserve memory for initial 512 pd entries
+kernel_pd_0: ; reserve memory for initial 512 pd entries
resb 4096
-init_pt: ; reserve memory for initial 512 pt entries
+kernel_pt_0: ; reserve memory for initial 512 pt entries
resb 4096
-paging_pt: ; reserve memory for 512 paging reserved pt entires
+paging_pt: ; reserve pages for pager mappings
+ resb 4096
+bootstrap_pt: ; reserve pages to bootstrap pager
resb 4096
align 16
@@ -85,6 +88,7 @@ start:
mov esp, stack_end
mov ebp, stack_end
+ push DWORD 0
push ebx
mov edi, 0x1000
@@ -93,13 +97,13 @@ start:
mov ecx, 4096
rep stosd
mov edi, cr3
- ; FIXME: Update boot.S to point base of paging to pml4e_list, see above
- mov DWORD [edi], 0x2003 ; Set the uint32_t at the destination index to 0x2003.
- add edi, 0x1000 ; Add 0x1000 to the destination index.
- mov DWORD [edi], 0x3003 ; Set the uint32_t at the destination index to 0x3003.
- add edi, 0x1000 ; Add 0x1000 to the destination index.
- mov DWORD [edi], 0x4003 ; Set the uint32_t at the destination index to 0x4003.
- add edi, 0x1000 ; Add 0x1000 to the destination index.
+
+ mov DWORD [edi], kernel_pdpt_0 + 3 ; Set the uint32_t at the destination index to 0x2003.
+ mov edi, kernel_pdpt_0 ; Add 0x1000 to the destination index.
+ mov DWORD [edi], kernel_pd_0 + 3 ; Set the uint32_t at the destination index to 0x3003.
+ mov edi, kernel_pd_0 ; Add 0x1000 to the destination index.
+ mov DWORD [edi], kernel_pt_0 + 3 ; Set the uint32_t at the destination index to 0x4003.
+ mov edi, kernel_pt_0 ; Add 0x1000 to the destination index.
mov ebx, 0x00000003 ; Set the B-register to 0x00000003.
mov ecx, 512 ; Set the C-register to 512.
@@ -132,6 +136,7 @@ start:
bits 64
code64:
+ pop rdi
call amd64_shim
mov rdi, rax
call kmain