Permalink
Browse files

kmain(): Some nice messages added

  • Loading branch information...
1 parent 668a128 commit af9cc16d953f782c56d39be993bae5d24beb2224 @akoskovacs committed Mar 26, 2012
Showing with 33 additions and 7 deletions.
  1. +33 −7 kmain.c
View
40 kmain.c
@@ -7,19 +7,45 @@
extern char __end_data_kernel;
-void kmain(struct multiboot_info *mbi, unsigned int magic)
+void kmain(struct multiboot_info *mbi __unused, unsigned int magic)
{
unsigned int mem = mbi->mem_upper + mbi->mem_lower;
+ set_console_attributes(FG_COLOR_WHITE | LIGHT | BG_COLOR_BLUE);
+ init_console();
if (magic != 0x2BADB002) {
- /*set_forecolor(COLOR_RED);*/
kprint("Ooops, something went wrong! Terminated!n\n");
}
-
- set_backcolor(COLOR_CYAN);
- init_console();
- kprintf("Booting Akosix...\nAt kmain() %p\n", &kmain);
+ kprintf("Booting Akosix...\nAt kmain() %p\n", kmain);
kprintf("Memory present %dKB.\n", mem);
- kprintf("Paging enabled!\n");
kprintf("command line: %s\n", (const char *)mbi->cmdline);
kprintf("End of kernel %p\n", (void*)&__end_data_kernel);
+ kprintf("Paging enabled!\n");
+ kprintf("Multiboot info:\n");
+ if (mbi->flags & MB_INFO_BOOTDEV)
+ kprintf("\tHas multiboot bootdev\n");
+ if (mbi->flags & MB_INFO_CMDLINE)
+ kprintf("\tHas multiboot command line\n");
+ if (mbi->flags & MB_INFO_ELF_SECT)
+ kprintf("\tHas multiboot elf section info\n");
+ if (mbi->flags & MB_INFO_DRIVE_INFO)
+ kprintf("\tHas multiboot drive info\n");
+ if (mbi->flags & MB_INFO_VIDEO)
+ kprintf("\tHas multiboot video info\n");
+ if (mbi->flags & MB_INFO_MODS)
+ kprintf("\tHas multiboot module info\n");
+ if (mbi->flags & MB_INFO_MEM_MAP) {
+ kprintf("\tHas multiboot memory-map info:\n");
+ unsigned int i = 0;
+ struct multiboot_mmap_entry *mmap;
+ mmap = (struct multiboot_mmap_entry *)mbi->mmap_addr;
+ while (i < mbi->mmap_length) {
+ mmap = (struct multiboot_mmap_entry *)mbi->mmap_addr+i;
+ kprintf("\t\tsize %d, addr %x, length %d [%savailable]\n"
+ , mmap->size, mmap->addr
+ , ((mmap->type == MB_MEMORY_AVAILABLE) ? "" : "not "));
+ i += sizeof(struct multiboot_mmap_entry);
+ }
+ }
+ if (mbi->flags & MB_INFO_MEMORY)
+ kprintf("\tHas multiboot memory\n\n");
}

0 comments on commit af9cc16

Please sign in to comment.