aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/system.h
diff options
context:
space:
mode:
authorMarvin Borner2019-10-02 20:01:17 +0200
committerMarvin Borner2019-10-02 20:01:17 +0200
commit3238ced93283a167675f20244ec9fd6310eb8002 (patch)
tree288078ca30e9e4b5d5ba9a178315cb5ee9f6a2d8 /src/kernel/system.h
parent682c47a98844ffec3f3129160e9cdb98ba129989 (diff)
Finally fixed VESA auto resolution finder
This was quite hard and strange but it works now!
Diffstat (limited to 'src/kernel/system.h')
-rw-r--r--src/kernel/system.h34
1 files changed, 31 insertions, 3 deletions
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 <stdint.h>
+#include "timer/timer.h"
+#include "lib/lib.h"
/**
* Initialize the basic features of the OS
@@ -71,15 +73,39 @@ static inline void *get_ptr(struct far_ptr fptr) {
}
/**
+ * 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;