From 98df498e8e8a07e33cc77a059876b940cb9b3c6a Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Wed, 19 May 2021 00:43:40 +0200 Subject: Smashed some bugs --- kernel/multiboot.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'kernel/multiboot.c') diff --git a/kernel/multiboot.c b/kernel/multiboot.c index 12d2475..4c3e3d0 100644 --- a/kernel/multiboot.c +++ b/kernel/multiboot.c @@ -8,6 +8,7 @@ #include PROTECTED static struct multiboot_info *info = NULL; +PROTECTED static char vbe[256] = { 0 }; CLEAR static void multiboot_parse_cmdline(const char *line) { @@ -21,6 +22,9 @@ CLEAR static void multiboot_parse_cmdline(const char *line) start += 3; } } + + assert(info->flags & MULTIBOOT_INFO_VBE_INFO); + memcpy(vbe, (void *)info->vbe_mode_info, sizeof(vbe)); } CLEAR void multiboot_init(u32 magic, u32 addr) @@ -36,9 +40,7 @@ CLEAR void multiboot_init(u32 magic, u32 addr) CLEAR u32 multiboot_vbe(void) { - assert(info->flags & MULTIBOOT_INFO_VBE_INFO); - - return info->vbe_mode_info; + return (u32)vbe; } CLEAR void multiboot_mmap(void) @@ -55,12 +57,11 @@ CLEAR void multiboot_mmap(void) /* printf("Memory region 0x%x-0x%x\n", mmap->addr, mmap->addr + mmap->len); */ if (mmap->type == MULTIBOOT_MEMORY_AVAILABLE) { total += mmap->len; - physical_set_free(memory_range_around(mmap->addr, mmap->len)); + physical_set_free(memory_range_from(mmap->addr, mmap->len)); } else if (mmap->type == MULTIBOOT_MEMORY_BADRAM) { printf("Defect memory at 0x%x-0x%x\n", mmap->addr, mmap->addr + mmap->len); - physical_set_used(memory_range_around(mmap->addr, mmap->len)); } else { - physical_set_used(memory_range_around(mmap->addr, mmap->len)); + // Memory is set to 'used' by default } mmap++; -- cgit v1.2.3