From 40cbd20b997c2cbcacb2095e7487609bca1c0040 Mon Sep 17 00:00:00 2001 From: Danny Holman Date: Sun, 26 Nov 2023 18:47:59 -0600 Subject: 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 --- arch/i386/kernel/multiboot.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 arch/i386/kernel/multiboot.c (limited to 'arch/i386/kernel/multiboot.c') 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 +#include +#include +#include + +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); +} -- cgit v1.2.3