summaryrefslogtreecommitdiff
path: root/kernel/interrupts.h
blob: 31b0cc0dd3697328d62f84e0c357805f89975640 (plain)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef INTERRUPTS_H
#define INTERRUPTS_H

#include <stdint.h>

/**
 * @file
 *
 * Interrupts
 * ==========
 *
 * Exceptions
 * ----------
 * * 0x00-0x20 Exceptions
 *
 * Legacy PIC
 * ----------
 * * 0x20-0x27 disabled pic
 * * 0x28-0x36 disabled pic
 * 
 * Software Interrupts / Ring 3
 * -------------------
 * * 0x80 System Call
 *
 * Hardware Interrupts / Ring 1
 * -------------------
 * * 0x81-0xA0 
 *
 * Default
 * -------
 * * 0xff
 *
 * Usage
 * -----
 *
 *  Run interrupts_init() ONCE first. 
 *  After that you can install the interruptAs on each cpu via interrupts_install();
 *  interrupt_handler() and exception_handler() will be called accordingly from 
 *  the interrupt handlers this functionality is backed by. You can find them 
 *  in asm_int.h. The selector 0x08 is used.
 *
 *  You can register handlers for specific interrupts via 
 *  interrupt_register(). Remember that the interrupts are routed
 *  through the I/O APIC which has to be configured as well.
 */

#define INTERRUPT_SYSCALL    0x80 // can be called from user code / ring 3

#define INTERRUPT_IPI        0x81 // ipi1 more might folllow

#define INTERRUPT_PIT_TIMER  0x90
#define INTERRUPT_KEYBOARD   0x91
#define INTERRUPT_MOUSE      0x92
#define INTERRUPT_E1000      0x93
#define INTERRUPT_APIC_TIMER 0x94

void     interrupts_init();
void     interrupts_install();
void     interrupt_register(uint32_t irq, uint32_t func_addr);

#endif