7 /* offset used to remap IRQ numbers (+32) */
9 /* conversion macros between IRQ and interrupt numbers */
10 #define IRQ_TO_INTR(x) ((x) + IRQ_OFFSET)
11 #define INTR_TO_IRQ(x) ((x) - IRQ_OFFSET)
12 /* checks whether a particular interrupt is an remapped IRQ */
13 #define IS_IRQ(n) ((n) >= IRQ_OFFSET && (n) < IRQ_OFFSET + 16)
15 /* general purpose registers as they are pushed by pusha */
17 uint32_t edi, esi, ebp, esp;
18 uint32_t ebx, edx, ecx, eax;
19 } __attribute__ ((packed));
21 /* structure used to pass the interrupt stack frame from the
22 * entry points to the C dispatch function.
25 /* registers pushed by pusha in intr_entry_* */
26 struct registers regs;
27 /* data segment selectors */
28 /* XXX removed: not needed unless we do dpl3 transitions
29 uint32_t ds, es, fs, gs;
31 /* interrupt number and error code pushed in intr_entry_* */
33 /* pushed by CPU during interrupt entry */
34 uint32_t eip, cs, eflags;
35 /* pushed by CPU during interrupt entry from user space */
36 /* XXX removed: again, not doing user space currently
39 } __attribute__ ((packed));
43 typedef void (*intr_func_t)(int);
48 struct intr_frame *get_intr_frame(void);
50 /* install high level interrupt callback */
51 void interrupt(int intr_num, intr_func_t func);
53 /* install low-level interrupt vector in IDT
54 * must be able to handle EOI and return with iret
56 void set_intr_entry(int num, void (*handler)(void));
58 /* defined in intr_asm.S */
59 int get_intr_flag(void);
60 void set_intr_flag(int onoff);
62 void intr_ret(struct intr_frame ifrm);
64 void end_of_irq(int irq);