- Implemented first part of signal support.
[planlOS.git] / system / include / ke / interrupts.h
blob1ca06aab27277d289f9ab311e4a3d2fd6491b9e1
1 /*
2 Copyright (C) 2008 Mathias Gottschlag
4 Permission is hereby granted, free of charge, to any person obtaining a copy of
5 this software and associated documentation files (the "Software"), to deal in the
6 Software without restriction, including without limitation the rights to use,
7 copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
8 Software, and to permit persons to whom the Software is furnished to do so,
9 subject to the following conditions:
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
16 PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
17 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
18 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
19 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 #ifndef KE_INTERRUPTS_H_INCLUDED
23 #define KE_INTERRUPTS_H_INCLUDED
25 #include <stdint.h>
26 #include "ke/cpu.h"
28 // Exception handlers
29 void keInt00(void);
30 void keInt01(void);
31 void keInt02(void);
32 void keInt03(void);
33 void keInt04(void);
34 void keInt05(void);
35 void keInt06(void);
36 void keInt07(void);
37 void keInt08(void);
38 void keInt09(void);
39 void keInt0a(void);
40 void keInt0b(void);
41 void keInt0c(void);
42 void keInt0d(void);
43 void keInt0e(void);
44 void keInt0f(void);
45 void keInt10(void);
46 void keInt11(void);
47 void keInt12(void);
48 void keInt13(void);
49 void keInt14(void);
50 void keInt15(void);
51 void keInt16(void);
52 void keInt17(void);
53 void keInt18(void);
54 void keInt19(void);
55 void keInt1a(void);
56 void keInt1b(void);
57 void keInt1c(void);
58 void keInt1d(void);
59 void keInt1e(void);
60 void keInt1f(void);
62 // IRQ handlers
63 void keInt20(void);
64 void keInt21(void);
65 void keInt22(void);
66 void keInt23(void);
67 void keInt24(void);
68 void keInt25(void);
69 void keInt26(void);
70 void keInt27(void);
71 void keInt28(void);
72 void keInt29(void);
73 void keInt2a(void);
74 void keInt2b(void);
75 void keInt2c(void);
76 void keInt2d(void);
77 void keInt2e(void);
78 void keInt2f(void);
80 // APIC interrupts
81 void keInt30(void);
82 void keInt31(void);
83 void keInt32(void);
84 void keInt33(void);
85 void keInt34(void);
86 void keInt35(void);
87 void keInt36(void);
88 void keInt37(void);
90 // Syscall
91 void keInt80(void);
93 typedef struct IDTEntry
95 uint16_t offset_low;
96 uint16_t selector;
97 uint8_t zero;
98 uint8_t type;
99 uint16_t offset_high;
100 } __attribute__((packed)) IDTEntry;
102 typedef struct IDTDescriptor
104 uint16_t size;
105 uint32_t base;
106 } __attribute__((packed)) IDTDescriptor;
108 typedef struct IntStackFrame
110 uint32_t gs;
111 uint32_t fs;
112 uint32_t es;
113 uint32_t ds;
114 uint32_t edi;
115 uint32_t esi;
116 uint32_t ebp;
117 uint32_t esp_;
118 uint32_t ebx;
119 uint32_t edx;
120 uint32_t ecx;
121 uint32_t eax;
122 uint32_t intno;
123 uint32_t error;
124 uint32_t eip;
125 uint32_t cs;
126 uint32_t eflags;
127 uint32_t esp;
128 uint32_t ss;
129 } __attribute__((packed)) IntStackFrame;
131 void keInitPIC(void);
132 void keInitPIC2(void);
134 void keRegisterIRQ(uint32_t irqno, void (*handler)(KeCPU*, uint8_t));
136 #endif