Dynamic IRQ handling

This commit is contained in:
2025-12-10 01:33:51 +01:00
parent 64b14f3878
commit 6feea1444a
18 changed files with 341 additions and 121 deletions

View File

@ -30,36 +30,39 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <libk/types.h>
#include <libk/list.h>
#include <sys/cpu.h>
#include <sys/serialdbg.h>
#include <sys/halt.h>
#include <sys/pit.h>
#include <sys/isr.h>
#include <sys/pic.h>
#include <irq/irqhandler.h>
#include <config.h>
void except_fini(struct trapframe *tf) {
dbgf("EXCEPTION %u\n", tf->trapno);
dbgf("trapframe:\n");
uptr_t cr2;
__asm__ volatile("mov %%cr2, %0" : "=r"(cr2));
dbgf("ds =%08x, edi=%08x, esi=%08x, ebp=%08x\n",
tf->ds, tf->edi, tf->esi, tf->ebp);
dbgf("esp=%08x, ebx=%08x, edx=%08x, ecx=%08x\n",
tf->esp, tf->ebx, tf->edx, tf->ecx);
dbgf("trp=%08x, erc=%08x, eip=%08x, cs =%08x\n",
tf->trapno, tf->ec, tf->eip, tf->cs);
dbgf("efl=%08x, usp=%08x, uss=%08x\n",
tf->eflags, tf->uesp, tf->uss);
dbgf("efl=%08x, cr2=%08x\n",
tf->eflags, cr2);
halt();
}
void irq_fini(struct trapframe *tf) {
if (tf->trapno == ISR_PIT) {
ticks_increment();
goto done;
}
int irq = 0x20 + tf->trapno;
irqhandler_func_t func = irqhandler_find(irq);
func((void *)tf);
done:
pic_fini(tf->trapno);
return;
}