This commit is contained in:
Benjamin Kyd
2019-05-02 21:29:22 +01:00
parent 44330e8427
commit 631ea7b7cb
10 changed files with 28 additions and 83 deletions

View File

@@ -4,10 +4,10 @@
#include <kernel/kernio.h>
struct Regs_t {
unsigned int gs, fs, es, ds; /* pushed the segs last */
unsigned int edi, esi, ebp, esp, ebx, edx, ecx, eax; /* pushed by 'pusha' */
unsigned int int_no, err_code; /* our 'push byte #' and ecodes do this */
unsigned int eip, cs, eflags, useresp, ss; /* pushed by the processor automatically */
unsigned int gs, fs, es, ds; /* pushed the segs last */
unsigned int edi, esi, ebp, esp, ebx, edx, ecx, eax; /* pushed by 'pusha' */
unsigned int int_no, err_code; /* our 'push byte #' and ecodes do this */
unsigned int eip, cs, eflags, useresp, ss; /* pushed by the processor automatically */
};
char *PanicMessage[] = {
@@ -48,7 +48,6 @@ char *PanicMessage[] = {
extern "C" {
void DEFAULT_ISR() {
Write("SMH \n");
outb(0x20,0x20);
}
@@ -57,12 +56,13 @@ void KeyboardHandler() {
outb(0x20,0x20);
}
void FaultHandler(struct Regs_t *r) {
uint32_t val;
asm volatile ( "mov %%cr2, %0" : "=r"(val) );
PanicKernel(val, PanicMessage[r->int_no]);
for (;;)
asm("hlt");
void FaultHandler(struct Regs_t* r) {
if (r->int_no < 32) {
uint32_t val;
asm volatile ( "mov %%cr2, %0" : "=r"(val) );
PanicKernel(val, PanicMessage[r->int_no], "kernel/isr.cpp:64", "FaultHandler(struct Regs_t* r)");
for(;;) {}
}
}
}