aboutsummaryrefslogtreecommitdiff
path: root/src/boot.S
diff options
context:
space:
mode:
Diffstat (limited to 'src/boot.S')
-rw-r--r--src/boot.S24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/boot.S b/src/boot.S
index 6588004..d1c4f9b 100644
--- a/src/boot.S
+++ b/src/boot.S
@@ -38,9 +38,11 @@ stack_top:
.section .pages, "aw", @nobits
.align 4096
-boot_page_directory:
+.global kernel_pagedir
+kernel_pagedir:
.skip 1024 * 4
-boot_page_table1:
+.global kernel_ptable0
+kernel_ptable0:
.skip 1024 * 4
@@ -55,8 +57,8 @@ boot_page_table1:
_start:
cli
- # Physical address of boot_page_table1.
- movl $(boot_page_table1 - VADDR_OFFSET), %edi
+ # Physical address of kernel_ptable0.
+ movl $(kernel_ptable0 - VADDR_OFFSET), %edi
# Only map the kernel.
mov $_kernel_start - VADDR_OFFSET, %esi
@@ -75,14 +77,14 @@ l_page_init:
# Size of page is 4096 bytes.
addl $4096, %esi
- # Size of entries in boot_page_table1 is 4 bytes.
+ # Size of entries in kernel_ptable0 is 4 bytes.
addl $4, %edi
# Loop to the next entry if we haven't finished.
loop l_page_init
map_vga:
# Map VGA video memory to 0xC03FF000 as "present, writable".
- movl $(0x000B8000 | 0x003), boot_page_table1 - VADDR_OFFSET + 1023 * 4
+ movl $(0x000B8000 | 0x003), kernel_ptable0 - VADDR_OFFSET + 1023 * 4
/*
Enabling paging does not change the next instruction, which continues to be physical. Therefore, map the kernel
@@ -91,11 +93,11 @@ map_vga:
- entry 1 starts 0x0040 0000 ends 0x007f ffff
- entry 768 starts 0xc000 0000 ends 0xc03f ffff
*/
- movl $(boot_page_table1 - VADDR_OFFSET + 0x003), boot_page_directory - VADDR_OFFSET + 1 * 4
- movl $(boot_page_table1 - VADDR_OFFSET + 0x003), boot_page_directory - VADDR_OFFSET + 768 * 4
+ movl $(kernel_ptable0 - VADDR_OFFSET + 0x003), kernel_pagedir - VADDR_OFFSET + 1 * 4
+ movl $(kernel_ptable0 - VADDR_OFFSET + 0x003), kernel_pagedir - VADDR_OFFSET + 768 * 4
- # Set cr3 to the address of the boot_page_directory.
- movl $(boot_page_directory - VADDR_OFFSET), %ecx
+ # Set cr3 to the address of the kernel_pagedir.
+ movl $(kernel_pagedir - VADDR_OFFSET), %ecx
movl %ecx, %cr3
# Enable paging and the write-protect bit.
@@ -113,7 +115,7 @@ map_vga:
kinit:
# At this point, paging is fully set up and enabled.
# Unmap the identity mapping as it is now unnecessary.
- movl $0, boot_page_directory + 1 * 4
+ movl $0, kernel_pagedir + 1 * 4
# Reload crc3 to force a TLB flush so the changes to take effect.
movl %cr3, %ecx
movl %ecx, %cr3