From 654934e0b5e5ef08e6fd337d5ceb864289796c66 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sun, 27 Oct 2019 13:07:06 +0100 Subject: Improved boot process and color scheme --- src/kernel/system.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) (limited to 'src/kernel/system.c') diff --git a/src/kernel/system.c b/src/kernel/system.c index 4049e27..c8f89b6 100644 --- a/src/kernel/system.c +++ b/src/kernel/system.c @@ -4,39 +4,54 @@ #include #include #include +#include + +void vga_log(char *msg, int line) { + uint16_t *terminal_buffer = (uint16_t *) 0xB8000; + for (size_t i = 0; i < strlen(msg); i++) + terminal_buffer[line * 80 + i] = (uint16_t) msg[i] | (uint16_t) 0x700; +} void kernel_time() { vesa_draw_string("\n"); vesa_draw_string("["); - vesa_draw_number(get_time()); + vesa_draw_number((int) get_time()); vesa_draw_string("] "); } +void log(char *msg) { + vesa_set_color(vesa_dark_white); + kernel_time(); + vesa_draw_string(msg); + vesa_set_color(text_color); +} + void info(char *msg) { - // terminal_set_color(9); + vesa_set_color(vesa_blue); kernel_time(); - vesa_draw_string("INFO: "); + vesa_draw_string("INFORMATION: "); vesa_draw_string(msg); - vesa_draw_string("\n"); - // terminal_set_color(7); + vesa_set_color(text_color); } void warn(char *msg) { - // terminal_set_color(6); + vesa_set_color(vesa_dark_yellow); kernel_time(); vesa_draw_string("WARNING: "); vesa_draw_string(msg); - vesa_draw_string("\n"); - // terminal_set_color(7); + vesa_set_color(text_color); } void panic(char *msg) { asm volatile ("cli"); - // terminal_set_color(4); + vesa_set_color(vesa_dark_red); kernel_time(); serial_write("PANIC: "); serial_write(msg); serial_write(" - System Halted!\n"); + vesa_draw_string("PANIC: "); + vesa_draw_string(msg); + vesa_draw_string(" - System Halted!\n"); loop: asm volatile ("hlt"); goto loop; -- cgit v1.2.3