diff options
author | Alex AUVOLAT <alexis211@gmail.com> | 2012-05-17 17:56:23 +0200 |
---|---|---|
committer | Alex AUVOLAT <alexis211@gmail.com> | 2012-05-17 17:56:23 +0200 |
commit | 593bf4df3d8db49286c1a7ae4ef75c887b629930 (patch) | |
tree | 988a104c9611d72e1252282789688586efd9a394 /src/kernel/core/sys.cpp | |
parent | 7c9a48b4e6d66cf4f62e7bad9e22ab06923e47ef (diff) | |
download | TCE-593bf4df3d8db49286c1a7ae4ef75c887b629930.tar.gz TCE-593bf4df3d8db49286c1a7ae4ef75c887b629930.zip |
Devices using the VFS structure. Basic keyboard handler.
Diffstat (limited to 'src/kernel/core/sys.cpp')
-rw-r--r-- | src/kernel/core/sys.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/kernel/core/sys.cpp b/src/kernel/core/sys.cpp index d95b678..2eefa57 100644 --- a/src/kernel/core/sys.cpp +++ b/src/kernel/core/sys.cpp @@ -1,5 +1,6 @@ #include "sys.h" -#include "monitor.h" +#include <ui/vt.h> +#include <dev/vgatxt.h> #include "mem/mem.h" @@ -30,9 +31,9 @@ uint16_t inw(uint16_t port) { void stack_trace(size_t bp) { uint32_t *stack = (uint32_t*)bp, i; for (i = 0; i < 5 && (size_t)stack > K_HIGHHALF_ADDR && (size_t)stack < (bp + 0x8000); i++) { - monitor_write("| "); monitor_writeHex((size_t)stack); - monitor_write("\tnext:"); monitor_writeHex(stack[0]); monitor_write("\t\tret:"); monitor_writeHex(stack[1]); - monitor_write("\n"); + ke_vt->writeStr("| "); ke_vt->writeHex((size_t)stack); + ke_vt->writeStr("\tnext:"); ke_vt->writeHex(stack[0]); ke_vt->writeStr("\t\tret:"); ke_vt->writeHex(stack[1]); + ke_vt->writeStr("\n"); stack = (uint32_t*)stack[0]; } } @@ -40,21 +41,27 @@ void stack_trace(size_t bp) { /* For internal use only. Used by panic and panic_assert. */ static void panic_do(char* file, int line) { asm volatile("cli;"); - monitor_write("\n File:\t\t"); monitor_write(file); monitor_put(':'); monitor_writeDec(line); - monitor_write("\nTrace:\n"); + ke_vt->writeStr("\n File:\t\t"); ke_vt->writeStr(file); ke_vt->writeStr(":"); ke_vt->writeDec(line); + ke_vt->writeStr("\nTrace:\n"); size_t bp; asm volatile("mov %%ebp,%0" : "=r"(bp)); stack_trace(bp); - monitor_write("\n\t\tSystem halted -_-'"); + ke_vt->writeStr("\n\t\tSystem halted -_-'"); asm volatile("hlt"); } /* These functions stop the system, reporting an error message, because something bad happenned. */ void panic(char* message, char* file, int line) { - monitor_write("\nPANIC:\t\t"); monitor_write(message); + ke_vt->fgcolor = TC_WHITE; + ke_vt->bgcolor = TC_BLUE; + ke_vt->outputTo(text_display); + ke_vt->writeStr("\nPANIC:\t\t"); ke_vt->writeStr(message); panic_do(file, line); } void panic_assert(char* assertion, char* file, int line) { - monitor_write("\nASSERT FAILED:\t"); monitor_write(assertion); + ke_vt->fgcolor = TC_WHITE; + ke_vt->bgcolor = TC_RED; + ke_vt->outputTo(text_display); + ke_vt->writeStr("\nASSERT FAILED:\t"); ke_vt->writeStr(assertion); panic_do(file, line); } |