summaryrefslogtreecommitdiff
path: root/arch/i386/kernel
diff options
context:
space:
mode:
authorDanny Holman <dholman@gymli.org>2023-11-26 18:47:59 -0600
committerDanny Holman <dholman@gymli.org>2023-11-26 18:47:59 -0600
commit40cbd20b997c2cbcacb2095e7487609bca1c0040 (patch)
tree9f3adfbdf4c277e8cec29d19aa69a73eff36cc2b /arch/i386/kernel
parent0c34fb36ab9f3df876412382ef62056409e9f98d (diff)
arch: i386: add multiboot support
Add support for the multiboot specification. These files will allow the kernel to read the multiboot header information as well as the provided memory map. Signed-off-by: Danny Holman <dholman@gymli.org>
Diffstat (limited to 'arch/i386/kernel')
-rw-r--r--arch/i386/kernel/multiboot.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/i386/kernel/multiboot.c b/arch/i386/kernel/multiboot.c
new file mode 100644
index 0000000..d7f0a65
--- /dev/null
+++ b/arch/i386/kernel/multiboot.c
@@ -0,0 +1,23 @@
+#include <kernel/multiboot.h>
+#include <kernel/tty.h>
+#include <kernel/panic.h>
+#include <kernel/io.h>
+
+void i386_entry(uint32_t mboot_magic, struct mboot_info *header) {
+ paging_init();
+ tty_init();
+
+ struct mboot_info *vheader = get_vaddr(header);
+ mark_bitmap(header, 1);
+ map_page(header, vheader, 0x003);
+
+ if (mboot_magic != MBOOT_LOADER_MAGIC)
+ panic("NOT BOOTED WITH MULTIBOOT BOOTLOADER");
+ if (!(vheader->flags >> 6 & 0x1))
+ panic("NO MEMORY MAP FROM BOOTLOADER");
+
+ gdt_install();
+ idt_install();
+ alloc_init(vheader);
+ kernel_main(vheader->cmdline);
+}