Give kassert its own vector instead of DBZ

This commit is contained in:
Justin C. Miller
2018-05-15 21:38:44 -07:00
parent 5f7ec50055
commit 93e60cc136
4 changed files with 29 additions and 14 deletions

View File

@@ -15,15 +15,6 @@ __kernel_assert(const char *file, unsigned line, const char *message)
cons->puts(message);
}
__asm__ __volatile__(
"movq %0, %%r8;"
"movq %1, %%r9;"
"movq %2, %%r10;"
"movq $0, %%rdx;"
"divq %%rdx;"
: // no outputs
: "r"((uint64_t)line), "r"(file), "r"(message)
: "rax", "rdx", "r8", "r9", "r10");
while (1);
__asm__ ( "int $0e7h" );
while (1) __asm__ ("hlt");
}

View File

@@ -134,6 +134,8 @@ IRQ (0x7d, 0x5d, irq5D)
IRQ (0x7e, 0x5e, irq5E)
IRQ (0x7f, 0x5f, irq5F)
ISR (0xe7, isrAssert)
ISR (0xec, isrTimer)
ISR (0xed, isrLINT0)
ISR (0xee, isrLINT1)

View File

@@ -192,7 +192,6 @@ interrupts_init()
enable_serial_interrupts();
log::info(logs::boot, "Interrupts enabled.");
gdt_dump(g_gdtr);
}
struct registers
@@ -339,6 +338,28 @@ isr_handler(registers regs)
while(1) asm("hlt");
break;
case isr::isrAssert: {
cons->set_color();
cons->puts("\n");
print_reg("rax", regs.rax);
print_reg("rbx", regs.rbx);
print_reg("rcx", regs.rcx);
print_reg("rdx", regs.rdx);
print_reg("rdi", regs.rdi);
print_reg("rsi", regs.rsi);
cons->puts("\n");
print_reg("rbp", regs.rbp);
print_reg("rsp", regs.rsp);
cons->puts("\n");
print_reg("rip", regs.rip);
print_stacktrace(2);
}
while(1) asm("hlt");
break;
default:
cons->set_color(9);
cons->puts("\nReceived ISR interrupt:\n");

View File

@@ -98,7 +98,8 @@ kernel_main(popcorn_data *header)
uint8_t buf[512];
kutil::memset(buf, 0, 512);
disk->read(0x200, sizeof(buf), buf);
kassert(disk->read(0x200, sizeof(buf), buf),
"Disk read returned 0");
console *cons = console::get();
uint8_t *p = &buf[0];