Kernel debug shell
This commit is contained in:
+16
-7
@@ -24,6 +24,8 @@ extern char vector_0_handler[];
|
||||
// Timer ticks
|
||||
extern volatile uint64_t ticks;
|
||||
|
||||
extern struct init_status init;
|
||||
|
||||
/*
|
||||
* idt_set_entry - Sets an Interrupt Descriptor Table entry
|
||||
* @vector: Vector number in the IDT
|
||||
@@ -122,6 +124,19 @@ static void page_fault_handler(struct cpu_status_t* ctx)
|
||||
CHECK_BIT(ctx->error_code, 7) ? " SGX_VIOLATION" : "",
|
||||
cr2);
|
||||
|
||||
if (init.all) {
|
||||
printf("\x1b[38;5;231mPage Fault at rip=0x%p, err=%u (%s%s%s%s%s%s%s%s) when accessing addr=0x%p\x1b[0m", ctx->iret_rip, ctx->error_code,
|
||||
CHECK_BIT(ctx->error_code, 0) ? "PAGE_PROTECTION_VIOLATION " : "PAGE_NOT_PRESENT ",
|
||||
CHECK_BIT(ctx->error_code, 1) ? "ON_WRITE " : "ON_READ ",
|
||||
CHECK_BIT(ctx->error_code, 2) ? "IN_USER_MODE" : "IN_KERNEL_MODE",
|
||||
CHECK_BIT(ctx->error_code, 3) ? " WAS_RESERVED" : "",
|
||||
CHECK_BIT(ctx->error_code, 4) ? " ON_INSTRUCTION_FETCH" : "",
|
||||
CHECK_BIT(ctx->error_code, 5) ? " PK_VIOLATION" : "",
|
||||
CHECK_BIT(ctx->error_code, 6) ? " ON_SHADOWSTACK_ACCESS" : "",
|
||||
CHECK_BIT(ctx->error_code, 7) ? " SGX_VIOLATION" : "",
|
||||
cr2);
|
||||
}
|
||||
|
||||
panic(ctx, "page fault");
|
||||
}
|
||||
|
||||
@@ -157,12 +172,6 @@ static void gp_fault_handler(struct cpu_status_t* ctx)
|
||||
panic(ctx, "gp fault");
|
||||
}
|
||||
|
||||
// DEBUG
|
||||
void kbdproc_main(void* arg)
|
||||
{
|
||||
printf("Key pressed/released.\r\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* interrupt_dispatch - Interrupt dispatcher
|
||||
* @context: CPU context
|
||||
@@ -261,7 +270,7 @@ struct cpu_status_t* interrupt_dispatch(struct cpu_status_t* context)
|
||||
|
||||
case 33: // Keyboard Interrupt
|
||||
keyboard_handler();
|
||||
process_create("keyboard-initiated", kbdproc_main, NULL); // DEBUG
|
||||
//process_create("keyboard-initiated", kbdproc_main, NULL); // DEBUG
|
||||
outb(0x20, 0x20);
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user