Fix user apps randomly crashing (APIC, GDT layout, syscall entry)
All checks were successful
Build documentation / build-and-deploy (push) Successful in 23s

This commit is contained in:
2026-01-14 19:51:18 +01:00
parent 0d8f9e565f
commit d1d772cb42
23 changed files with 276 additions and 204 deletions

View File

@@ -7,10 +7,12 @@
#include <irq/irq.h>
#include <libk/std.h>
#include <libk/string.h>
#include <m/syscall_defs.h>
#include <sys/debug.h>
#include <sys/irq.h>
#include <sys/smp.h>
#include <sys/spin.h>
#include <syscall/syscall.h>
/* 8259 PIC defs. */
#define PIC1 0x20
@@ -122,6 +124,7 @@ static void amd64_idt_init (void) {
IDT_ENTRY (SCHED_PREEMPT_TIMER, 1);
IDT_ENTRY (TLB_SHOOTDOWN, 1);
IDT_ENTRY (CPU_REQUEST_SCHED, 1);
IDT_ENTRY (CPU_SPURIOUS, 1);
/* clang-format on */
#undef IDT_ENTRY
@@ -154,7 +157,7 @@ static void amd64_intr_exception (struct saved_regs* regs) {
regs->rbx);
if (regs->cs == (GDT_UCODE | 0x03)) {
proc_kill (thiscpu->proc_current);
proc_kill (thiscpu->proc_current, regs);
} else {
spin ();
}
@@ -226,6 +229,7 @@ uint8_t amd64_resolve_irq (uint8_t irq) {
[SCHED_PREEMPT_TIMER] = 0,
[TLB_SHOOTDOWN] = 1,
[CPU_REQUEST_SCHED] = 2,
[CPU_SPURIOUS] = 3,
};
return mappings[irq];