#include "multiboot.h" /* Check if the bit BIT in FLAGS is set. */ #define CHECK_FLAG(flags,bit) ((flags) & (1 << (bit))) /* Should check if MAGIC is valid */ void main (unsigned long magic, unsigned long addr) { multiboot_info_t *mbi; /* Clear the screen. */ cls (); /* Set MBI to the address of the Multiboot information structure. */ mbi = (multiboot_info_t *) addr; printf("Multiboot info at 0x%x\n", mbi); seg_init(); page_init(); /* Are mem_* valid? */ if (CHECK_FLAG (mbi->flags, 0)) printf ("mem_lower = %uKB, mem_upper = %uKB\n", (unsigned) mbi->mem_lower, (unsigned) mbi->mem_upper); /* Are mmap_* valid? */ if (CHECK_FLAG (mbi->flags, 6)) { memory_map_t *mmap; printf ("mmap_addr = 0x%x, mmap_length = 0x%x\n", (unsigned) mbi->mmap_addr, (unsigned) mbi->mmap_length); for (mmap = (memory_map_t *) mbi->mmap_addr; (unsigned long) mmap < mbi->mmap_addr + mbi->mmap_length; mmap = (memory_map_t *) ((unsigned long) mmap + mmap->size + sizeof (mmap->size))) printf (" size = 0x%x, base_addr = 0x%x%x," " length = 0x%x%x, type = 0x%x\n", (unsigned) mmap->size, (unsigned) mmap->base_addr_high, (unsigned) mmap->base_addr_low, (unsigned) mmap->length_high, (unsigned) mmap->length_low, (unsigned) mmap->type); } /* if (CHECK_FLAG (mbi->flags, 9)) */ /* { */ /* printf ("Loaded by %s\n", mbi->loader_name); */ /* } */ /* if (CHECK_FLAG (mbi->flags, 11)) */ /* { */ /* printf ("Graphics: %x %x\n", mbi->vbe_control_info, mbi->vbe_mode_info); */ /* } */ /* else printf ("No graphics info\n"); */ }