mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-30 22:18:21 +00:00
x86-64: handle some more exceptions properly
This commit is contained in:
@@ -22,7 +22,7 @@ static void illisr(isr_t *self, context_t *ctx) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void div0isr(isr_t *self, context_t *ctx) {
|
static void sigfpeisr(isr_t *self, context_t *ctx) {
|
||||||
if (ARCH_CONTEXT_ISUSER(ctx)) {
|
if (ARCH_CONTEXT_ISUSER(ctx)) {
|
||||||
signal_signalthread(current_thread(), SIGFPE, true);
|
signal_signalthread(current_thread(), SIGFPE, true);
|
||||||
} else {
|
} else {
|
||||||
@@ -46,6 +46,14 @@ static void x87isr(isr_t *self, context_t *ctx) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void dbisr(isr_t *self, context_t *ctx) {
|
||||||
|
if (ARCH_CONTEXT_ISUSER(ctx)) {
|
||||||
|
signal_signalthread(current_thread(), SIGTRAP, true);
|
||||||
|
} else {
|
||||||
|
_panic("Debug Exception", ctx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void reload_ldt(isr_t *self, context_t *ctx) {
|
static void reload_ldt(isr_t *self, context_t *ctx) {
|
||||||
if (current_thread() == NULL || current_thread()->proc == NULL || current_thread()->proc->ldt == NULL)
|
if (current_thread() == NULL || current_thread()->proc == NULL || current_thread()->proc->ldt == NULL)
|
||||||
return;
|
return;
|
||||||
@@ -221,7 +229,11 @@ void arch_cpu_init() {
|
|||||||
x86_64_mmu_enable_global_pages();
|
x86_64_mmu_enable_global_pages();
|
||||||
|
|
||||||
// register some exception handlers that give out signals
|
// register some exception handlers that give out signals
|
||||||
interrupt_register(0, div0isr, NULL, IPL_IGNORE);
|
interrupt_register(0, sigfpeisr, NULL, IPL_IGNORE);
|
||||||
|
interrupt_register(1, dbisr, NULL, IPL_IGNORE);
|
||||||
|
interrupt_register(3, dbisr, NULL, IPL_IGNORE);
|
||||||
|
interrupt_register(4, sigfpeisr, NULL, IPL_IGNORE);
|
||||||
|
interrupt_register(5, sigfpeisr, NULL, IPL_IGNORE);
|
||||||
interrupt_register(6, illisr, NULL, IPL_IGNORE);
|
interrupt_register(6, illisr, NULL, IPL_IGNORE);
|
||||||
interrupt_register(16, x87isr, NULL, IPL_IGNORE);
|
interrupt_register(16, x87isr, NULL, IPL_IGNORE);
|
||||||
interrupt_register(19, simdisr, NULL, IPL_IGNORE);
|
interrupt_register(19, simdisr, NULL, IPL_IGNORE);
|
||||||
|
|||||||
@@ -422,6 +422,8 @@ INIT_ROUTINE_DEFINE(mmu, INIT_ROUTINE_FLAGS_NONE, arch_mmu_init, pmm);
|
|||||||
|
|
||||||
void arch_mmu_apswitch() {
|
void arch_mmu_apswitch() {
|
||||||
arch_mmu_switch(FROM_HHDM(template));
|
arch_mmu_switch(FROM_HHDM(template));
|
||||||
|
interrupt_register(11, gpfisr, NULL, IPL_IGNORE);
|
||||||
|
interrupt_register(12, gpfisr, NULL, IPL_IGNORE);
|
||||||
interrupt_register(13, gpfisr, NULL, IPL_IGNORE);
|
interrupt_register(13, gpfisr, NULL, IPL_IGNORE);
|
||||||
interrupt_register(14, pfisr, NULL, IPL_IGNORE);
|
interrupt_register(14, pfisr, NULL, IPL_IGNORE);
|
||||||
interrupt_register(0xfe, arch_mmu_tlbipi, ARCH_EOI, IPL_IGNORE);
|
interrupt_register(0xfe, arch_mmu_tlbipi, ARCH_EOI, IPL_IGNORE);
|
||||||
|
|||||||
Reference in New Issue
Block a user