blob: b0ad42930befefa30c399f7c41da3a217bb179ea (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#ifndef MELVIX_SYSTEM_H
#define MELVIX_SYSTEM_H
#include "timer/timer.h"
#include "io/io.h"
#include "graphics/vesa.h"
#include "system.h"
void kernel_time() {
vesa_draw_string("\n");
vesa_draw_string("[");
vesa_draw_number(get_time());
vesa_draw_string("] ");
}
void info(char *msg) {
// terminal_set_color(9);
kernel_time();
vesa_draw_string("INFO: ");
vesa_draw_string(msg);
vesa_draw_string("\n");
// terminal_set_color(7);
}
void warn(char *msg) {
// terminal_set_color(6);
kernel_time();
vesa_draw_string("WARNING: ");
vesa_draw_string(msg);
vesa_draw_string("\n");
// terminal_set_color(7);
}
void panic(char *msg) {
asm volatile ("cli");
// terminal_set_color(4);
kernel_time();
serial_write("PANIC: ");
serial_write(msg);
serial_write(" - System Halted!\n");
loop:
asm volatile ("hlt");
goto loop;
}
void assert(int x) {
if (x == 0) {
panic("Assertion failed");
}
}
#endif
|