From e48f1166ae7402f973ea4aab8e53c7612459048c Mon Sep 17 00:00:00 2001 From: Alexis211 Date: Sun, 15 Nov 2009 12:03:58 +0100 Subject: LM --- Source/Applications/Demos/GOL.cpp | 2 ++ Source/Kernel/Config.h | 17 +++++++++++++---- Source/Kernel/Core/Sys.ns.cpp | 24 ++++++++++++++---------- Source/Kernel/Core/Sys.ns.h | 1 + Source/Kernel/TaskManager/Thread.class.cpp | 2 ++ 5 files changed, 32 insertions(+), 14 deletions(-) (limited to 'Source') diff --git a/Source/Applications/Demos/GOL.cpp b/Source/Applications/Demos/GOL.cpp index 804c9ae..5848c2c 100644 --- a/Source/Applications/Demos/GOL.cpp +++ b/Source/Applications/Demos/GOL.cpp @@ -96,4 +96,6 @@ int main(Vector args) { delete cells; delete newcells; + + outvt << "\n\n"; } diff --git a/Source/Kernel/Config.h b/Source/Kernel/Config.h index 009b133..77573aa 100644 --- a/Source/Kernel/Config.h +++ b/Source/Kernel/Config.h @@ -4,14 +4,23 @@ #define OPT_DEBUG //Color scheme -#define TXTLOGO_FGCOLOR 9 +#define TXTLOGO_FGCOLOR 9 //Colors for the melon logo #define TXTLOGO_BGCOLOR 0 -#define KVT_FGCOLOR 7 + +#define KVT_FGCOLOR 7 //Colors for the vt for selecting a screen mode #define KVT_BGCOLOR 0 -#define KVT_LIGHTCOLOR 6 -#define KVT_ENTRYCOLOR 15 +#define KVT_LIGHTCOLOR 9 +#define KVT_ENTRYCOLOR 6 +//These colors are used for the shell running the init program #define SHELL_FGCOLOR 0 #define SHELL_BGCOLOR 7 +#define PANIC_BGCOLOR 4 //Colors for the panic screen +#define PANIC_FGCOLOR 15 +#define BSOD_BGCOLOR 1 //Colors for the panic_dump screen +#define BSOD_FGCOLOR 7 +#define HALT_BGCOLOR 6 //Colors for the halt screen +#define HALT_FGCOLOR 7 + #endif diff --git a/Source/Kernel/Core/Sys.ns.cpp b/Source/Kernel/Core/Sys.ns.cpp index 1b59f7f..eeb92ee 100644 --- a/Source/Kernel/Core/Sys.ns.cpp +++ b/Source/Kernel/Core/Sys.ns.cpp @@ -8,7 +8,7 @@ #include #include -#define DEBUGVT(x) SimpleVT *x = new SimpleVT(4, 56, 0, 15); x->map(); x->put('\n'); +#define DEBUGVT(x) SimpleVT *x = new SimpleVT(4, 56, PANIC_FGCOLOR, PANIC_BGCOLOR); x->map(); x->put('\n'); using namespace CMem; @@ -81,6 +81,14 @@ void dumpRegs(registers_t *regs, VirtualTerminal& vt) { vt << "eflags=" << (u32int)regs->eflags << ", useresp=" << (u32int)regs->useresp << ", ss=" << (u32int)regs->ss << "\n"; } +void stackTrace(u32int ebp, VirtualTerminal& vt, u32int maxframes) { + u32int *stack = (u32int*)ebp; + for (u32int i = 0; i < maxframes and (u32int)stack > 0xC0000000; i++) { + vt << "Frame: " << (u32int)stack << " n:" << stack[0] << " r:" << stack[1] << "\n"; + stack = (u32int*)stack[0]; + } +} + //Used by PANIC() macro (see common.wtf.h) void panic(char *message, char *file, u32int line) { asm volatile("cli"); @@ -96,7 +104,7 @@ void panic(char *message, char *file, u32int line) { void panic(char *message, registers_t *regs, char *file, u32int line) { asm volatile("cli"); - SimpleVT vt(12, 70, 7, 1); + SimpleVT vt(15, 70, BSOD_FGCOLOR, BSOD_BGCOLOR); vt.map(); vt.write("\n"); @@ -108,15 +116,11 @@ void panic(char *message, registers_t *regs, char *file, u32int line) { asm volatile("mov %%cr2, %0" : "=r"(cr2)); vt << "cr2=" << (u32int)cr2 << "\n"; } - vt << "\n\n"; + vt << "\n"; - while (1) asm volatile("cli; hlt"); + stackTrace(regs->ebp, vt, 5); - u32int *v = (u32int*)regs->ebp; - for (int i = 0; i < 10; i++) { - vt << "ebp=" << (u32int)v << ", value=" << (u32int)(v[1]) << "\n"; - v = (u32int*)(*v); - } + while (1) asm volatile("cli; hlt"); } //Used by ASSERT() macro (see common.wtf.h) @@ -144,7 +148,7 @@ void reboot() { void halt() { shutdown_cleanup(); String message("MELON SEZ : KTHXBYE, U CAN NAOW TURNZ OFF UR COMPUTER."); - SimpleVT vt(3, message.size() + 16, 7, 6); + SimpleVT vt(3, message.size() + 16, HALT_FGCOLOR, HALT_BGCOLOR); vt.map(); vt << "\n\t" << message; while (1) asm volatile("cli; hlt"); diff --git a/Source/Kernel/Core/Sys.ns.h b/Source/Kernel/Core/Sys.ns.h index c5e4400..4d15676 100644 --- a/Source/Kernel/Core/Sys.ns.h +++ b/Source/Kernel/Core/Sys.ns.h @@ -26,6 +26,7 @@ namespace Sys { u8int inb(u16int port); u16int inw(u16int port); void dumpRegs(registers_t *regs, VirtualTerminal& vt); + void stackTrace(u32int ebp, VirtualTerminal& vt, u32int maxframes); void panic(char* message, char *file, u32int line); void panic(char* message, registers_t *regs, char *file, u32int line); void panic_assert(char* file, u32int line, char *desc); diff --git a/Source/Kernel/TaskManager/Thread.class.cpp b/Source/Kernel/TaskManager/Thread.class.cpp index f1c3df1..af501fe 100644 --- a/Source/Kernel/TaskManager/Thread.class.cpp +++ b/Source/Kernel/TaskManager/Thread.class.cpp @@ -161,6 +161,8 @@ void Thread::handleException(registers_t *regs, int no) { if (no == 3) { vt << "\n\nBreakpoint data :\n"; Sys::dumpRegs(regs, vt); + Sys::stackTrace(regs->ebp, vt, 10); + vt << "Press any key to continue execution of program..."; m_process->m_inVT->getKeypress(false); vt << "\n"; -- cgit v1.2.3