diff options
Diffstat (limited to 'viengoos/sysdeps/x86_64/boot64.c')
-rw-r--r-- | viengoos/sysdeps/x86_64/boot64.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/viengoos/sysdeps/x86_64/boot64.c b/viengoos/sysdeps/x86_64/boot64.c index 9c9cbd7..544c6d8 100644 --- a/viengoos/sysdeps/x86_64/boot64.c +++ b/viengoos/sysdeps/x86_64/boot64.c @@ -58,6 +58,43 @@ /* The multiboot info. */ static multiboot_info_t* boot_info; +static void +debug_dump (void) +{ + multiboot_info_t *mbi = (multiboot_info_t *) boot_info; + + if (CHECK_FLAG (mbi->flags, 9)) + debug (1, "Booted by %s", (char *) (uintptr_t) mbi->boot_loader_name); + + if (CHECK_FLAG (mbi->flags, 0)) + debug (1, "Memory: Lower %u KB, Upper %u KB", + mbi->mem_lower, mbi->mem_upper); + + if (CHECK_FLAG (mbi->flags, 3)) + { + module_t *mod = (module_t *) (uintptr_t) mbi->mods_addr; + int nr; + + for (nr = 0; nr < mbi->mods_count; nr++) + debug (1, "Module %i: Start 0x%x, End 0x%x, Cmd %s", + nr + 1, mod[nr].mod_start, mod[nr].mod_end, + (char *) (uintptr_t) mod[nr].string); + } + + if (CHECK_FLAG (mbi->flags, 6)) + { + memory_map_t *mmap; + int nr = 1; + + for (mmap = (memory_map_t *) (uintptr_t) mbi->mmap_addr; + (uint64_t) mmap < mbi->mmap_addr + mbi->mmap_length; + mmap = (memory_map_t *) ((uint64_t) mmap + + mmap->size + sizeof (mmap->size))) + debug (1, "Memory Map %i: Type %i, Base 0x%lx, Length 0x%lx", + nr++, mmap->type, mmap->base_addr, mmap->length); + } +} + int main (int argc, char *argv[]); void cmain (uint32_t magic, uint32_t addr) @@ -157,6 +194,11 @@ char stack[STACK_SIZE] __attribute__((__aligned__(16))); void arch_bootstrap (void) { + /* We wait until now to dump the multiboot infor structure as this + is the first function called after the output device has been + configured. */ + debug_dump (); + /* setup gdt (also does syscall/sysret setup) */ gdt_init (); |