summaryrefslogtreecommitdiff
path: root/src/kernel/core/sys.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/core/sys.cpp')
-rw-r--r--src/kernel/core/sys.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/kernel/core/sys.cpp b/src/kernel/core/sys.cpp
index 2eefa57..32ed988 100644
--- a/src/kernel/core/sys.cpp
+++ b/src/kernel/core/sys.cpp
@@ -31,9 +31,8 @@ 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++) {
- 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");
+ *ke_vt << " | " << (size_t)stack;
+ *ke_vt << "\tnext:" << stack[0] << "\t\tret:" << stack[1] << "\n";
stack = (uint32_t*)stack[0];
}
}
@@ -41,10 +40,10 @@ 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;");
- ke_vt->writeStr("\n File:\t\t"); ke_vt->writeStr(file); ke_vt->writeStr(":"); ke_vt->writeDec(line);
- ke_vt->writeStr("\nTrace:\n");
+ *ke_vt << "\n File:\t\t" << file << ":" << line;
+ *ke_vt << "\nTrace:\n";
size_t bp; asm volatile("mov %%ebp,%0" : "=r"(bp)); stack_trace(bp);
- ke_vt->writeStr("\n\t\tSystem halted -_-'");
+ *ke_vt << "\n\t\tSystem halted -_-'";
asm volatile("hlt");
}
@@ -53,7 +52,7 @@ void panic(char* message, char* file, int line) {
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);
+ *ke_vt << "\nPANIC:\t" << message;
panic_do(file, line);
}
@@ -61,7 +60,7 @@ void panic_assert(char* assertion, char* file, int line) {
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);
+ *ke_vt << "\nASSERT FAILED:\t" << assertion;
panic_do(file, line);
}