From cbe2690cd5d1b290633c466ebb4df7b64b09b037 Mon Sep 17 00:00:00 2001 From: Danny Holman Date: Thu, 28 Mar 2024 21:30:12 -0500 Subject: arch: i386: kernel: add mostly finished PFA and paging system Add the mostly finished physical memory allocator and expose its functions to the paging system. Signed-off-by: Danny Holman --- arch/i386/boot/boot.s | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'arch/i386/boot') diff --git a/arch/i386/boot/boot.s b/arch/i386/boot/boot.s index 2d17f6a..e443b08 100644 --- a/arch/i386/boot/boot.s +++ b/arch/i386/boot/boot.s @@ -19,14 +19,14 @@ stack_top: .align 4096 boot_page_directory: .skip 4096 -boot_page_table0: - .skip 4096 +boot_page_tables: + .skip 20480 .section .multiboot.text, "a" .global _start .type _start, @function _start: - movl $(boot_page_table0 - 0xC0000000), %edi + movl $(boot_page_tables - 0xC0000000), %edi movl $0, %esi movl $1023, %ecx @@ -43,12 +43,16 @@ _start: addl $4, %edi loop 1b -3: movl $(0x000B8000 | 0x003), boot_page_table0 - 0xC0000000 + 1023 * 4 +3: movl $0xB8003, boot_page_tables - 0xC0000000 + 1023 * 4 - movl $(boot_page_table0 - 0xC0000000 + 0x003), boot_page_directory - 0xC0000000 - movl $(boot_page_table0 - 0xC0000000 + 0x003), boot_page_directory - 0xC0000000 + 768 * 4 + movl $boot_page_tables, %ecx + subl $0xC0000000, %ecx + orl $0x003, %ecx + movl %ecx, boot_page_directory - 0xC0000000 + movl %ecx, boot_page_directory - 0xC0000000 + 4 * 768 - movl $(boot_page_directory - 0xC0000000), %ecx + movl $boot_page_directory, %ecx + subl $0xC0000000, %ecx movl %ecx, %cr3 movl %cr0, %ecx -- cgit v1.2.3