aboutsummaryrefslogtreecommitdiff
path: root/src/boot.S
diff options
context:
space:
mode:
Diffstat (limited to 'src/boot.S')
-rw-r--r--src/boot.S16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/boot.S b/src/boot.S
index d1c4f9b..e39883e 100644
--- a/src/boot.S
+++ b/src/boot.S
@@ -51,9 +51,10 @@ kernel_ptable0:
bootloader will jump to this position once the kernel has been loaded.
*/
.section .multiboot.text, "ax"
+.global VADDR_OFFSET
.set VADDR_OFFSET, 0xc0000000 - 0x400000
.global _start
-.type _start, @function
+ .type _start, @function
_start:
cli
@@ -62,12 +63,12 @@ _start:
# Only map the kernel.
mov $_kernel_start - VADDR_OFFSET, %esi
- # Map 1023 pages. The 1024th will be the VGA text buffer.
- movl $1023, %ecx
+ # Map 1024 pages
+ movl $1024, %ecx
l_page_init:
- cmpl $(_kernel_end - VADDR_OFFSET), %esi
- jge map_vga
+ cmpl $(_kernel_end - VADDR_OFFSET), %esi
+ jge map_table
/* TODO: Map physical address as "present, writable". Note that this maps .text and .rodata as writable.
Mind security and map them as non-writable. */
@@ -82,10 +83,7 @@ l_page_init:
# 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), kernel_ptable0 - VADDR_OFFSET + 1023 * 4
-
+map_table:
/*
Enabling paging does not change the next instruction, which continues to be physical. Therefore, map the kernel
to both its physical address and to the higher half.