diff --git a/driver/irq/pic/int_handler.asm.S b/driver/irq/pic/int_handler.asm.S index d42215e..1deb2a5 100644 --- a/driver/irq/pic/int_handler.asm.S +++ b/driver/irq/pic/int_handler.asm.S @@ -3,6 +3,7 @@ format elf64 include 'pic_constants.incS' extrn irq_pic_IntHandler +extrn irq_pic_IRQHandler_Data extrn irq_pic_IRQHandlerRaw public irq_pic_IntHandler20h diff --git a/driver/irq/pic/int_handler.c b/driver/irq/pic/int_handler.c index 92c11a8..8213ce2 100644 --- a/driver/irq/pic/int_handler.c +++ b/driver/irq/pic/int_handler.c @@ -14,6 +14,6 @@ SYSV_ABI void irq_pic_IntHandler(int irq) { io_Printf("INT %xh (IRQ %d) (no handler)\n", irq + IRQ_PIC_INT_OFFSET_MASTER, irq); else { //io_Printf("INT %xh (IRQ %d), handler%llx\n", irq + IRQ_PIC_INT_OFFSET_MASTER, irq, irq_pic_IRQHandler[irq]); - irq_pic_IRQHandler[irq](); + ((irq_pic_IRQHandlerType)irq_pic_IRQHandler[irq])(irq_pic_IRQHandler_Data[irq]); } } diff --git a/driver/irq/pic/pic.h b/driver/irq/pic/pic.h index ddddbd4..577c10b 100644 --- a/driver/irq/pic/pic.h +++ b/driver/irq/pic/pic.h @@ -29,12 +29,13 @@ uint16_t irq_pic_GetIRR(); uint16_t irq_pic_GetISR(); -// void() for IRQ handlers, no need to call out8(OCW2, 0x6*) -typedef SYSV_ABI void (*irq_pic_IRQHandlerType)(); +// void(uintptr_t) for IRQ handlers, no need to call out8(OCW2, 0x6*) +typedef SYSV_ABI void (*irq_pic_IRQHandlerType)(uintptr_t); // defined in pic_init.c -extern irq_pic_IRQHandlerType irq_pic_IRQHandler[16]; -extern bool irq_pic_Enabled; +extern void * irq_pic_IRQHandler[16]; +extern uintptr_t irq_pic_IRQHandler_Data[16]; // written into RDI on handler (first argument) +extern bool irq_pic_Enabled; // If IRQHandlerRaw[irq] is not NULL, the function is jumped to (not called). // diff --git a/driver/irq/pic/pic_init.c b/driver/irq/pic/pic_init.c index cbcdbc9..30d81f5 100644 --- a/driver/irq/pic/pic_init.c +++ b/driver/irq/pic/pic_init.c @@ -9,9 +9,10 @@ #include -irq_pic_IRQHandlerType irq_pic_IRQHandler[16]; -void * irq_pic_IRQHandlerRaw[16]; -bool irq_pic_Enabled; +void * irq_pic_IRQHandler[16]; +uintptr_t irq_pic_IRQHandler_Data[16]; +void * irq_pic_IRQHandlerRaw[16]; +bool irq_pic_Enabled; void irq_pic_Init() { assert(interrupt_Enabled && "Interrupt must be set up before PIC init");