summaryrefslogtreecommitdiff
path: root/Source/Kernel/Core
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-11-15 12:03:58 +0100
committerAlexis211 <alexis211@gmail.com>2009-11-15 12:03:58 +0100
commite48f1166ae7402f973ea4aab8e53c7612459048c (patch)
tree6c097249b1f6356cc378c500d4b0d21bea9dd6bb /Source/Kernel/Core
parent972e9d53d243b698e9dce7125a08804a43b70534 (diff)
downloadMelon-e48f1166ae7402f973ea4aab8e53c7612459048c.tar.gz
Melon-e48f1166ae7402f973ea4aab8e53c7612459048c.zip
LM
Diffstat (limited to 'Source/Kernel/Core')
-rw-r--r--Source/Kernel/Core/Sys.ns.cpp24
-rw-r--r--Source/Kernel/Core/Sys.ns.h1
2 files changed, 15 insertions, 10 deletions
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 <MemoryManager/PhysMem.ns.h>
#include <DeviceManager/Time.ns.h>
-#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);