diff options
author | Marvin Borner | 2019-11-23 00:36:28 +0100 |
---|---|---|
committer | Marvin Borner | 2019-11-23 00:36:28 +0100 |
commit | 45d9495e77dba212551ae9bc8e09b51e9ed6d324 (patch) | |
tree | 1e8ead9a55b41fa009c28823ca7a9ac0b1b5b2fe /src/kernel/system.c | |
parent | 4b178c0feb4c415be36be0e4c0def8c447ed42af (diff) |
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
Diffstat (limited to 'src/kernel/system.c')
-rw-r--r-- | src/kernel/system.c | 25 |
1 files changed, 19 insertions, 6 deletions
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 <kernel/timer/timer.h> #include <kernel/io/io.h> #include <kernel/graphics/vesa.h> -#include <kernel/lib/lib.h> +#include <mlibc/string.h> +#include <mlibc/stdlib.h> +#include <kernel/paging/paging.h> +#include <kernel/interrupts/interrupts.h> 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(); +} |