-
Notifications
You must be signed in to change notification settings - Fork 0
/
isr.h
41 lines (36 loc) · 1.1 KB
/
isr.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//
// isr.h -- Interface and structures for high level interrupt service routines.
// Code from JamesM's kernel development tutorials
// @See: interrupt.s
//
#include "common.h"
// A few defines to make life a little easier.
#define IRQ0 32
#define IRQ1 33
#define IRQ2 34
#define IRQ3 35
#define IRQ4 36
#define IRQ5 37
#define IRQ6 38
#define IRQ7 39
#define IRQ8 40
#define IRQ9 41
#define IRQ10 42
#define IRQ11 43
#define IRQ12 44
#define IRQ13 45
#define IRQ14 46
#define IRQ15 47
typedef struct registers
{
u32int ds; // Data segment selector.
u32int edi, esi, ebp, esp, ebx, edx, ecx, eax; // Pushed by pusha
u32int int_no, err_code; // Interrupt number and error code if any
u32int eip, cs, eflags, useresp, ss; //Pushed by the processor automatically
} registers_t;
void isr_handler(registers_t regs);
void irq_handler(registers_t regs);
// Enables registration of callbacks for interrupt or IRQs.
// For IRQs, to ease confusion, use the #defines above as the first parameter.
typedef void(*isr_t)(registers_t);
void register_interrupt_handler(u8int n, isr_t handler);