summaryrefslogtreecommitdiff
path: root/Source/Kernel
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
parent972e9d53d243b698e9dce7125a08804a43b70534 (diff)
downloadMelon-e48f1166ae7402f973ea4aab8e53c7612459048c.tar.gz
Melon-e48f1166ae7402f973ea4aab8e53c7612459048c.zip
LM
Diffstat (limited to 'Source/Kernel')
-rw-r--r--Source/Kernel/Config.h17
-rw-r--r--Source/Kernel/Core/Sys.ns.cpp24
-rw-r--r--Source/Kernel/Core/Sys.ns.h1
-rw-r--r--Source/Kernel/TaskManager/Thread.class.cpp2
4 files changed, 30 insertions, 14 deletions
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 <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);
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";