From 45d9495e77dba212551ae9bc8e09b51e9ed6d324 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sat, 23 Nov 2019 00:36:28 +0100 Subject: Tried implementing memory based paging... Also did many other fixes/improvements. While I think I did most things correct, the ACPI doesn't work anymore (triple fault) and the resolution detection fails with 0x2... :c --- src/kernel/system.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'src/kernel/system.c') diff --git a/src/kernel/system.c b/src/kernel/system.c index 303fc83..560f6a5 100644 --- a/src/kernel/system.c +++ b/src/kernel/system.c @@ -1,7 +1,10 @@ #include #include #include -#include +#include +#include +#include +#include char *vga_buffer = (char *) 0x500; @@ -18,9 +21,8 @@ void vga_log(char *msg, int line) { for (size_t i = 0; i < strlen(msg); i++) terminal_buffer[line * 80 + i] = (uint16_t) msg[i] | (uint16_t) 0x700; char string[80]; - char time[8]; strcpy(string, "["); - strcat(string, itoa((int) get_time(), time)); + strcat(string, itoa((int) get_time())); strcat(string, "] "); strcat(string, "INFORMATION: "); strcat(string, msg); @@ -68,9 +70,7 @@ void panic(char *msg) { vesa_draw_string("PANIC: "); vesa_draw_string(msg); vesa_draw_string(" - System halted!\n"); - loop: - asm volatile ("hlt"); - goto loop; + halt_loop(); } void assert(int x) { @@ -78,3 +78,16 @@ void assert(int x) { panic("Assertion failed"); } } + +void halt_loop() { + serial_write("\n!!! HALT !!!\n"); + loop: + asm volatile ("hlt"); + goto loop; +} + +void v86(uint8_t code, regs16_t *regs) { + paging_disable(); + int32(code, regs); + paging_enable(); +} -- cgit v1.2.3