internal static IRQCallBack[] callBacks; //TODO: create list per IRQ (for shared IRQs) #region Constructor internal IRQHandler16bit(byte irq) { spinLock.Enter(); if (irqs == null) { irqs = new bool[16]; callBacks = new IRQCallBack[16]; } this.irq = irq; IDT.Interrupt interrupt = (IDT.Interrupt)(irq + 0x20); IDT.RegisterIRQ(interrupt, Stubs.GetFunctionPointer(INTERRUPT16BIT_HANDLER)); spinLock.Exit(); }
public static void Setup() { IDT.RegisterIRQ(IDT.Interrupt.DivideError, Stubs.GetFunctionPointer(DIVIDE_ERROR)); }
/* * // sigh.. one can only dream * public delegate void somefunction(uint value); * unsafe static somefunction[] timerEvents = (somefunction[])Stubs.StaticAlloc<somefunction>(Kernel.MaxEventHandlers); * public event somefunction function * { * add * { * for (int x = 0; x < Kernel.MaxEventHandlers; ++x) * if (timerEvents[x] == value) * return; * * for (int x = 0; x < Kernel.MaxEventHandlers; ++x) * if (timerEvents[x] == null) * timerEvents[x] = value; * } * remove * { * for (int x = 0; x < Kernel.MaxEventHandlers; ++x) * if (timerEvents[x] == value) * timerEvents[x] = null; * } * } */ #region Setup public static void Setup() { SetTimerFrequency(HZ); IDT.RegisterIRQ(IDT.Interrupt.SystemTimer, Stubs.GetFunctionPointer(TIMER_HANDLER)); }
public static void Setup() { IDT.RegisterIRQ(IDT.Interrupt.Keyboard, Stubs.GetFunctionPointer(KEYBOARD_HANDLER)); }