diff options
Diffstat (limited to 'src/kernel/system.c')
-rw-r--r-- | src/kernel/system.c | 33 |
1 files changed, 24 insertions, 9 deletions
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 <kernel/timer/timer.h> #include <kernel/io/io.h> #include <kernel/graphics/vesa.h> +#include <kernel/lib/lib.h> + +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; |