kern

view src/intr.h @ 80:4db99a52863e

fixed the "endianess" of the text messages in the ATA identify info block. this is the first time I've seen wrong byteorder in ascii text, the ATA committee should be commended.
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 06 Dec 2011 13:35:39 +0200
parents fa65b4f45366
children
line source
1 #ifndef INTR_H_
2 #define INTR_H_
4 #include <inttypes.h>
5 #include "asmops.h"
7 /* offset used to remap IRQ numbers (+32) */
8 #define IRQ_OFFSET 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 /* structure used to pass the interrupt stack frame from the
16 * entry points to the C dispatch function.
17 */
18 struct intr_frame {
19 /* registers pushed by pusha in intr_entry_* */
20 struct registers regs;
21 /* data segment selectors */
22 uint32_t ds, es, fs, gs;
23 /* interrupt number and error code pushed in intr_entry_* */
24 uint32_t inum, err;
25 /* pushed by CPU during interrupt entry */
26 uint32_t eip, cs, eflags;
27 /* pushed by CPU during interrupt entry from user space */
28 uint32_t esp, ss;
29 } __attribute__ ((packed));
33 typedef void (*intr_func_t)(int);
36 void init_intr(void);
38 struct intr_frame *get_intr_frame(void);
40 void interrupt(int intr_num, intr_func_t func);
42 /* defined in intr-asm.S */
43 int get_intr_state(void);
44 void set_intr_state(int s);
46 void intr_ret(struct intr_frame ifrm);
48 void end_of_irq(int irq);
50 #endif /* INTR_H_ */