Kernel/x86 - Added backtrace to running program in thread dump
[tpg/acess2.git] / KernelLand / Kernel / arch / x86 / irq.c
index 3d23636..7250deb 100644 (file)
@@ -61,14 +61,22 @@ int IRQ_AddHandler( int Num, void (*Callback)(int, void*), void *Ptr )
         int    i;
        for( i = 0; i < MAX_CALLBACKS_PER_IRQ; i++ )
        {
-               if( gIRQ_Handlers[Num][i] == NULL ) {
+               if( gIRQ_Handlers[Num][i] == NULL )
+               {
                        Log_Log("IRQ", "Added IRQ%i Cb#%i %p", Num, i, Callback);
                        gIRQ_Handlers[Num][i] = Callback;
                        gaIRQ_DataPointers[Num][i] = Ptr;
-                       return 1;
+                       return Num * MAX_CALLBACKS_PER_IRQ + i;
                }
        }
 
        Log_Warning("IRQ", "No free callbacks on IRQ%i", Num);
-       return 0;
+       return -1;
+}
+
+void IRQ_RemHandler(int Handle)
+{
+        int    Num = Handle / MAX_CALLBACKS_PER_IRQ;
+        int    id = Handle % MAX_CALLBACKS_PER_IRQ;
+       gIRQ_Handlers[Num][id] = NULL;
 }

UCC git Repository :: git.ucc.asn.au