Checking multiboot stuff oh yah
This commit is contained in:
parent
99e0b4debb
commit
663a6317c4
3 changed files with 307 additions and 6 deletions
34
kernel.c
34
kernel.c
|
|
@ -1,10 +1,11 @@
|
|||
#include "multiboot.h"
|
||||
#include "vga.h"
|
||||
|
||||
// static inline void outb(unsigned int port, unsigned char val) {
|
||||
// asm volatile ("outb %0, %1" : : "a"(val), "Nd"(port) : "memory");
|
||||
// }
|
||||
|
||||
void kmain (void) {
|
||||
void kmain (unsigned int mbootmagick, multiboot_info_t* mbootinfo) {
|
||||
|
||||
// Cursor disabling
|
||||
// TODO: outb function
|
||||
|
|
@ -15,8 +16,31 @@ void kmain (void) {
|
|||
vga_init(VGA_COLOR_GREY, VGA_COLOR_BLACK);
|
||||
|
||||
vga_write_line("=== KoalemOS ===");
|
||||
vga_write("Testing color writing... ");
|
||||
vga_write_color("Yes", VGA_COLOR_BLACK, VGA_COLOR_GREEN);
|
||||
vga_write_color("No", VGA_COLOR_BLACK, VGA_COLOR_RED);
|
||||
vga_write_line("Execution finished. Halting CPU...");
|
||||
vga_write("Checking multiboot loader: ");
|
||||
|
||||
// Check multiboot header
|
||||
if (mbootmagick != MULTIBOOT_BOOTLOADER_MAGIC) {
|
||||
vga_write_color("INVALID MAGIC", VGA_COLOR_BLACK, VGA_COLOR_RED);
|
||||
return;
|
||||
}
|
||||
vga_write(mbootinfo->boot_loader_name);
|
||||
|
||||
// Check videomode
|
||||
vga_write("\nVideomode: ");
|
||||
switch (mbootinfo->vbe_mode) {
|
||||
case MULTIBOOT_FRAMEBUFFER_TYPE_INDEXED:
|
||||
vga_write("Indexed");
|
||||
break;
|
||||
case MULTIBOOT_FRAMEBUFFER_TYPE_RGB:
|
||||
vga_write("RGB");
|
||||
break;
|
||||
case MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT:
|
||||
vga_write("EGA TEXT");
|
||||
break;
|
||||
default:
|
||||
vga_write_color("UNKNOWN", VGA_COLOR_BLACK, VGA_COLOR_RED);
|
||||
return;
|
||||
}
|
||||
|
||||
vga_write_line("\nExecution finished, halting...");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue