diff options
| author | EmulatedSeasons <89668582+EmulatedSeasons@users.noreply.github.com> | 2024-04-05 17:24:49 -0400 |
|---|---|---|
| committer | EmulatedSeasons <89668582+EmulatedSeasons@users.noreply.github.com> | 2024-04-05 17:24:49 -0400 |
| commit | 5fab9326c00aeda6647beab65e6a61f9954b9cfd (patch) | |
| tree | 75a954aa59332b3ceb2e9e3a40c0c780b964483d | |
| parent | ec7e798c70e54cf10e6dddf465cb7f741f760e79 (diff) | |
started writing paging
| -rw-r--r-- | kernel/arch/i386/boot.asm | 31 | ||||
| -rw-r--r-- | kernel/arch/i386/multiboot.cpp | 1 | ||||
| -rw-r--r-- | kernel/kernel.cpp | 3 |
3 files changed, 23 insertions, 12 deletions
diff --git a/kernel/arch/i386/boot.asm b/kernel/arch/i386/boot.asm index 494d3ba..084bffb 100644 --- a/kernel/arch/i386/boot.asm +++ b/kernel/arch/i386/boot.asm @@ -22,6 +22,13 @@ stack_bottom: resb 16384 ; 16 KiB
stack_top:
+; temporary paging tables
+align 4
+boot_page_directory:
+ resb 4096
+boot_page_table:
+ resb 4096
+
section .text
global _start:function (_start.end - _start)
@@ -34,19 +41,12 @@ _start: push eax
push ebx
- ; setup paging (to map kernel to the higher half)
- ;mov eax, 0
- ;mov cr3, eax
- ;mov eax, cr0
- ;or eax, 0x80000001
- ;mov cr0, eax
-
; get multiboot header data (for memory map)
- extern multiboot_main
- call multiboot_main
+ ;extern multiboot_main
+ ;call multiboot_main
- extern _init
- call _init
+ ;extern _init
+ ;Scall _init
lgdt [gdt_descriptor]
jmp 0x08:.gdt_jmp
@@ -62,6 +62,15 @@ _start: .gdt_jmp2:
+
+
+ ; setup paging (to map kernel to the higher half)
+ ;mov eax, 0
+ ;mov cr3, eax
+ ;mov eax, cr0
+ ;or eax, 0x80000001
+ ;mov cr0, eax
+
; setup idt
extern idt_setup
call idt_setup
diff --git a/kernel/arch/i386/multiboot.cpp b/kernel/arch/i386/multiboot.cpp index 4ce94df..9f3eedb 100644 --- a/kernel/arch/i386/multiboot.cpp +++ b/kernel/arch/i386/multiboot.cpp @@ -7,6 +7,7 @@ // gets the memory map and stuff
extern "C" void multiboot_main(multiboot_info_t* mbd, uint32_t magic) {
terminal_initialize();
+ //printf("multiboot struc addr: %x\n", mbd);
if (magic != MULTIBOOT_BOOTLOADER_MAGIC) {
printf("Invalid multiboot magic number\n");
abort();
diff --git a/kernel/kernel.cpp b/kernel/kernel.cpp index 877f860..f787d94 100644 --- a/kernel/kernel.cpp +++ b/kernel/kernel.cpp @@ -21,5 +21,6 @@ extern "C" void kernel_main(void) { printf("Hello world!\n");
printf("a%db\n", 1);
- printf("_begin: %x, _end: %x", &_begin, &_end);
+ printf("_begin: %x, _end: %x\n", &_begin, &_end);
+ //printf("kernel_main addr: %x\n", &kernel_main);
}
|
