Add: kernel panic fault handler & dumps
This commit is contained in:
50
<
50
<
@@ -1,50 +0,0 @@
|
||||
#include "stdio.h"
|
||||
#include "serial.h"
|
||||
#include "gdt.h"
|
||||
#include "idt.h"
|
||||
#include "system.h"
|
||||
|
||||
int kmain(int retvalue)
|
||||
{
|
||||
|
||||
gdt_install();
|
||||
idt_install();
|
||||
isr_install();
|
||||
|
||||
// serial testing
|
||||
|
||||
init_serial();
|
||||
|
||||
log("serial connection established", 3);
|
||||
log("initialized GDT entries", 2);
|
||||
log("kernel started", 2);
|
||||
log("initialized IDT", 2);
|
||||
log("initialized ISRs", 3);
|
||||
|
||||
clear();
|
||||
|
||||
// printf testing
|
||||
|
||||
// TODO: Framebuffer upgrade: color output
|
||||
|
||||
int age = 34;
|
||||
int problems = 124;
|
||||
char* name = "xamidev";
|
||||
|
||||
printf("Hello %s, you are %d years old and have %d problems. wow %%\n", name, age, problems);
|
||||
|
||||
long suchwow = 2934342;
|
||||
char character = 65;
|
||||
printf("such number %u\nsuch character %c", suchwow, character);
|
||||
|
||||
printf("wow negative %d\n", -3742);
|
||||
printf("such hex %x %X\n", 0xcafe, 0xdeadbeef);
|
||||
|
||||
printf("such pointer %p\n", (void*)0xcafe1234);
|
||||
|
||||
// Div by zero exception
|
||||
|
||||
printf("Lalala, what a beautiful day! %d", 4/0);
|
||||
|
||||
return retvalue;
|
||||
}
|
||||
Binary file not shown.
3
isr.c
3
isr.c
@@ -111,7 +111,8 @@ void fault_handler(struct regs *r)
|
||||
{
|
||||
if (r->int_no < 32)
|
||||
{
|
||||
printf("%s Exception. Halting!\n", exception_messages[r->int_no]);
|
||||
printf("\n\n*** [Kernel panic - %s Exception] ***\nInterrupt error code %u\nedi: %x esi: %u ebp: %u esp: %u\nebx: %u edx: %u ecx: %u eax: %u\neip: %x cs:%x eflags: %x ss: %x\ngs: %x fs: %x es: %x ds: %x\nHalting!\n", exception_messages[r->int_no], r->err_code, r->edi, r->esi, r->ebp, r->esp, r->ebx, r->edx, r->ecx, r->eax, r->eip, r->cs, r->eflags, r->ss, r->gs, r->fs, r->es, r->ds);
|
||||
for (;;);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BIN
kernel.elf
BIN
kernel.elf
Binary file not shown.
Reference in New Issue
Block a user