fix writing by using a virtual image instead of a physical thumbdrive, better document the hack in KeIrqDispatch

This commit is contained in:
maksw committed 2026-05-05 19:33:04 +02:00
1 parent 68b3fdbc63
commit 320a24e1a5
11 files changed
+88 -10

No files matched your search

+6 -1
View File
@@ -18,7 +18,12 @@ __declspec(dllexport) void KeIrqRegister(uint8_t irq, void (*handler)(void)) {
}
void KeIrqDispatch(uint8_t irq) {
// eoi first, handler second because it doesn't work otherwise.
// KeIrqDispatch sends EOI after the handler returns, but the handler switched context before returning.
// The EOI call is still sitting on the idle thread's stack, waiting for that thread to be resumed.
// The LAPIC sees ISR[0x20] still set. Its rule is: don't deliver another interrupt at the same or lower priority until EOI is written.
// So the timer never fires again. The user process runs completely unpreempted until it calls SYS_EXIT_PROCESS, which calls KeYield, which cooperatively switches back
// and only then does the idle thread resume, KeIrqDispatch finally sends its EOI, and the timer starts firing again.
// To fix this we send EOI before calling the handler, not after.
gHal->Intc.SendEoi();
if (irq < MAX_IRQS && gIrqHandlers[irq])
gIrqHandlers[irq]();