From 3238ced93283a167675f20244ec9fd6310eb8002 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Wed, 2 Oct 2019 20:01:17 +0200 Subject: Finally fixed VESA auto resolution finder This was quite hard and strange but it works now! --- src/kernel/system.h | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'src/kernel/system.h') diff --git a/src/kernel/system.h b/src/kernel/system.h index d41b7bc..57db4c9 100644 --- a/src/kernel/system.h +++ b/src/kernel/system.h @@ -2,6 +2,8 @@ #define MELVIX_SYSTEM_H #include +#include "timer/timer.h" +#include "lib/lib.h" /** * Initialize the basic features of the OS @@ -70,16 +72,40 @@ static inline void *get_ptr(struct far_ptr fptr) { return (void *) (unsigned long) ((fptr.segment << 4) + fptr.offset); } +/** + * Print the current kernel time + */ +static inline void kernel_time() { + terminal_write_string("\n"); + terminal_write_string("["); + terminal_write_number(get_time()); + terminal_write_string("] "); +} + +/** + * Display an information message + * @param msg The information + */ +static inline void info(char *msg) { + terminal_set_color(10); + kernel_time(); + terminal_write_string("INFO: "); + terminal_write_string(msg); + terminal_write_string("\n"); + terminal_set_color(7); +} + /** * Display a warning message * TODO: Add line number and file name * @param msg The warning cause/reason */ static inline void warn(char *msg) { - asm volatile ("cli"); terminal_set_color(6); - terminal_write_line("WARNING"); + kernel_time(); + terminal_write_string("WARNING: "); terminal_write_string(msg); + terminal_write_string("\n"); terminal_set_color(7); } @@ -91,8 +117,10 @@ static inline void warn(char *msg) { static inline void panic(char *msg) { asm volatile ("cli"); terminal_set_color(4); - terminal_write_line("PANIC"); + kernel_time(); + terminal_write_string("PANIC: "); terminal_write_string(msg); + terminal_write_string(" - System Halted!"); loop: asm volatile ("hlt"); goto loop; -- cgit v1.2.3