-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsys.c
44 lines (37 loc) · 1.2 KB
/
sys.c
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
#include <stddef.h>
#include <stdint.h>
#include "sys.h"
#include "terminal.h"
#include "clib/stdio.h"
// Funkcja uruchamiana w przypadku poważnego błędu
void kernel_panic(const char *message)
{
asm("cli");
terminal_clear();
terminal_disable_cursor();
// Czerwony napis Kernel panic w ramce
terminal_setcolor(VGA_COLOR_RED);
printf("\n\n\n\n\n\n");
display_center("\xC9\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xBB");
display_center("\xBA Kernel Panic \xBA");
display_center("\xC8\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xBC");
// Komunikat
terminal_setcolor(VGA_COLOR_WHITE);
printf("\n\n");
display_center("We are sorry, but a critical error occurred");
display_center("Please restart Your system");
printf("\n\n\n");
// Wiadomość
terminal_setcolor(VGA_COLOR_RED);
display_center(message);
// Zatrzymanie
while(1) asm("hlt");
}
// Wyświetla błąd który wystąpił, ale nie wymaga zatrzymania systemu
void report_error(const char *message)
{
uint8_t last_color = terminal_getcolor();
terminal_setcolor(VGA_COLOR_RED);
printf("Error: %s\n", message);
terminal_setcolor(last_color);
}