summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Holman <dholman@gymli.org>2024-06-21 21:40:00 -0500
committerDanny Holman <dholman@gymli.org>2024-06-21 21:40:00 -0500
commitf1a0f10f54e17803f7d7095a61117aec52fafbf0 (patch)
treea1b5f7cdcc4d51f8d3b15ba5f4c97316bbe02697
parente068ccbec7d61101e5bd9156eb63f157cf6a9846 (diff)
arch: boot: allocate a few pages at startup
Allocate a few pages at startup just to get the paging and physical memory manager up and running. Signed-off-by: Danny Holman <dholman@gymli.org>
-rw-r--r--arch/i386/boot/boot.s29
1 files changed, 18 insertions, 11 deletions
diff --git a/arch/i386/boot/boot.s b/arch/i386/boot/boot.s
index 6d6da7d..29a3575 100644
--- a/arch/i386/boot/boot.s
+++ b/arch/i386/boot/boot.s
@@ -19,14 +19,16 @@ stack_top:
.align 4096
boot_page_directory:
.skip 4096
-boot_page_tables:
- .skip 20480
+boot_page_table0:
+ .skip 4096
+boot_page_table1:
+ .skip 4096
.section .multiboot.text, "a"
.global _start
.type _start, @function
_start:
- movl $(boot_page_tables - 0xC0000000), %edi
+ movl $(boot_page_table0 - 0xC0000000), %edi
movl $0, %esi
movl $1023, %ecx
@@ -43,13 +45,22 @@ _start:
addl $4, %edi
loop 1b
-3: movl $0xB8003, boot_page_tables - 0xC0000000 + 1023 * 4
- movl $boot_page_tables, %ecx
+3: movl $boot_page_directory, %ecx
+ subl $0xC0000000, %ecx
+ orl $0x003, %ecx
+ movl %ecx, boot_page_directory - 0xC0000000 + 1023 * 4
+
+ movl $boot_page_table0, %ecx
subl $0xC0000000, %ecx
orl $0x003, %ecx
movl %ecx, boot_page_directory - 0xC0000000
- movl %ecx, boot_page_directory - 0xC0000000 + 4 * 768
+ movl %ecx, boot_page_directory - 0xC0000000 + 768 * 4
+
+ movl $boot_page_table1, %ecx
+ subl $0xC0000000, %ecx
+ orl $0x003, %ecx
+ movl %ecx, boot_page_directory - 0xC0000000 + 1022 * 4
movl $boot_page_directory, %ecx
subl $0xC0000000, %ecx
@@ -64,13 +75,9 @@ _start:
.section .text
-4: movl %cr3, %ecx
- movl %ecx, %cr3
-
- movl $stack_top, %esp
+4: movl $stack_top, %esp
and $-16, %esp
- pushl $boot_page_directory
pushl %ebx
pushl %eax
call i386_entry