Remove building with NOCRYPTO option
[minix3.git] / minix / kernel / arch / i386 / apic_asm.S
blobae9e0b6baee9a0bb79becab7fd35bc8879e25861
1 #include "archconst.h"
2 #include "apic.h"
3 #include "sconst.h"
4 #include "apic_asm.h"
5 #include <machine/asm.h>
7 #define APIC_IRQ_HANDLER(irq)   \
8         push    $irq                                            ;\
9         call    _C_LABEL(irq_handle)            /* intr_handle(irq) */  ;\
10         add     $4, %esp                                        ;
12 /*===========================================================================*/
13 /*                              interrupt handlers                           */
14 /*              interrupt handlers for 386 32-bit protected mode             */
15 /*              APIC interrupt handlers for 386 32-bit protected mode        */
16 /*===========================================================================*/
17 #define apic_hwint(irq)                                                 \
18 ENTRY(apic_hwint##irq)                                                  \
19         TEST_INT_IN_KERNEL(4, 0f)                                       ;\
20                                                                         \
21         SAVE_PROCESS_CTX(0, KTS_INT_HARD)                               ;\
22         push    %ebp                                                    ;\
23         call    _C_LABEL(context_stop)                                  ;\
24         add     $4, %esp                                                ;\
25         movl    $0, %ebp        /* for stack trace */                   ;\
26         APIC_IRQ_HANDLER(irq)                                           ;\
27         jmp     _C_LABEL(switch_to_user)                                ;\
28                                                                         \
29 0:                                                                      \
30         pusha                                                           ;\
31         call    _C_LABEL(context_stop_idle)                             ;\
32         APIC_IRQ_HANDLER(irq)                                           ;\
33         CLEAR_IF(10*4(%esp))                                            ;\
34         popa                                                            ;\
35         iret                                                            ;
37 #define LAPIC_INTR_HANDLER(func)        \
38         movl    $func, %eax                                             ;\
39         call    *%eax           /* call the actual handler */           ;\
40         mov     _C_LABEL(lapic_eoi_addr), %eax  /* the end of handler*/ ;\
41         movl    $0, (%eax)                                              ;
43 /*===========================================================================*/
44 /*                      handler of the local APIC interrupts                 */
45 /*===========================================================================*/
47 #define lapic_intr(func) \
48         TEST_INT_IN_KERNEL(4, 0f)                                       ;\
49                                                                         \
50         SAVE_PROCESS_CTX(0, KTS_INT_HARD)                               ;\
51         push    %ebp                                                    ;\
52         call    _C_LABEL(context_stop)                                  ;\
53         add     $4, %esp                                                ;\
54         movl    $0, %ebp                /* for stack trace */           ;\
55         LAPIC_INTR_HANDLER(func)                                        ;\
56         jmp     _C_LABEL(switch_to_user)                                ;\
57         \
58 0:      \
59         pusha                                                           ;\
60         call    _C_LABEL(context_stop_idle)                             ;\
61         LAPIC_INTR_HANDLER(func)                                        ;\
62         CLEAR_IF(10*4(%esp))                                            ;\
63         popa                                                            ;\
64         iret                                                            ;
66 /* apic timer tick handlers */
67 ENTRY(lapic_timer_int_handler)
68         lapic_intr(_C_LABEL(timer_int_handler))
70 ENTRY(apic_spurios_intr)
71         lapic_intr(_C_LABEL(apic_spurios_intr_handler))
73 ENTRY(apic_error_intr)
74         lapic_intr(_C_LABEL(apic_error_intr_handler))
76 #ifdef CONFIG_SMP
78 ENTRY(apic_ipi_sched_intr)
79         lapic_intr(_C_LABEL(smp_ipi_sched_handler))
81 ENTRY(apic_ipi_halt_intr)
82         lapic_intr(_C_LABEL(smp_ipi_halt_handler))
84 #endif /* CONFIG_SMP */
86 #ifdef APIC_DEBUG
88 .data
89 lapic_intr_dummy_handler_msg:
90 .ascii "UNHANDLED APIC interrupt vector %d\n"
92 .text
94 #define lapic_intr_dummy_handler(vect)                  \
95         pushl   $vect;                                  \
96         push    $lapic_intr_dummy_handler_msg;          \
97         call    _C_LABEL(panic);                        \
98 1:      jmp     1b; /* never return */
100 #define LAPIC_INTR_DUMMY_HANDLER(vect)                  \
101         .balign LAPIC_INTR_DUMMY_HANDLER_SIZE;          \
102         _lapic_intr_dummy_handler_##vect: lapic_intr_dummy_handler(vect)
104 apic_hwint(0)
105 apic_hwint(1)
106 apic_hwint(2)
107 apic_hwint(3)
108 apic_hwint(4)
109 apic_hwint(5)
110 apic_hwint(6)
111 apic_hwint(7)
112 apic_hwint(8)
113 apic_hwint(9)
114 apic_hwint(10)
115 apic_hwint(11)
116 apic_hwint(12)
117 apic_hwint(13)
118 apic_hwint(14)
119 apic_hwint(15)
120 apic_hwint(16)
121 apic_hwint(17)
122 apic_hwint(18)
123 apic_hwint(19)
124 apic_hwint(20)
125 apic_hwint(21)
126 apic_hwint(22)
127 apic_hwint(23)
128 apic_hwint(24)
129 apic_hwint(25)
130 apic_hwint(26)
131 apic_hwint(27)
132 apic_hwint(28)
133 apic_hwint(29)
134 apic_hwint(30)
135 apic_hwint(31)
136 apic_hwint(32)
137 apic_hwint(33)
138 apic_hwint(34)
139 apic_hwint(35)
140 apic_hwint(36)
141 apic_hwint(37)
142 apic_hwint(38)
143 apic_hwint(39)
144 apic_hwint(40)
145 apic_hwint(41)
146 apic_hwint(42)
147 apic_hwint(43)
148 apic_hwint(44)
149 apic_hwint(45)
150 apic_hwint(46)
151 apic_hwint(47)
152 apic_hwint(48)
153 apic_hwint(49)
154 apic_hwint(50)
155 apic_hwint(51)
156 apic_hwint(52)
157 apic_hwint(53)
158 apic_hwint(54)
159 apic_hwint(55)
160 apic_hwint(56)
161 apic_hwint(57)
162 apic_hwint(58)
163 apic_hwint(59)
164 apic_hwint(60)
165 apic_hwint(61)
166 apic_hwint(62)
167 apic_hwint(63)
169 LABEL(lapic_intr_dummy_handles_start)
170         LAPIC_INTR_DUMMY_HANDLER(0)
171         LAPIC_INTR_DUMMY_HANDLER(1)
172         LAPIC_INTR_DUMMY_HANDLER(2)
173         LAPIC_INTR_DUMMY_HANDLER(3)
174         LAPIC_INTR_DUMMY_HANDLER(4)
175         LAPIC_INTR_DUMMY_HANDLER(5)
176         LAPIC_INTR_DUMMY_HANDLER(6)
177         LAPIC_INTR_DUMMY_HANDLER(7)
178         LAPIC_INTR_DUMMY_HANDLER(8)
179         LAPIC_INTR_DUMMY_HANDLER(9)
180         LAPIC_INTR_DUMMY_HANDLER(10)
181         LAPIC_INTR_DUMMY_HANDLER(11)
182         LAPIC_INTR_DUMMY_HANDLER(12)
183         LAPIC_INTR_DUMMY_HANDLER(13)
184         LAPIC_INTR_DUMMY_HANDLER(14)
185         LAPIC_INTR_DUMMY_HANDLER(15)
186         LAPIC_INTR_DUMMY_HANDLER(16)
187         LAPIC_INTR_DUMMY_HANDLER(17)
188         LAPIC_INTR_DUMMY_HANDLER(18)
189         LAPIC_INTR_DUMMY_HANDLER(19)
190         LAPIC_INTR_DUMMY_HANDLER(20)
191         LAPIC_INTR_DUMMY_HANDLER(21)
192         LAPIC_INTR_DUMMY_HANDLER(22)
193         LAPIC_INTR_DUMMY_HANDLER(23)
194         LAPIC_INTR_DUMMY_HANDLER(24)
195         LAPIC_INTR_DUMMY_HANDLER(25)
196         LAPIC_INTR_DUMMY_HANDLER(26)
197         LAPIC_INTR_DUMMY_HANDLER(27)
198         LAPIC_INTR_DUMMY_HANDLER(28)
199         LAPIC_INTR_DUMMY_HANDLER(29)
200         LAPIC_INTR_DUMMY_HANDLER(30)
201         LAPIC_INTR_DUMMY_HANDLER(31)
202         LAPIC_INTR_DUMMY_HANDLER(32)
203         LAPIC_INTR_DUMMY_HANDLER(33)
204         LAPIC_INTR_DUMMY_HANDLER(34)
205         LAPIC_INTR_DUMMY_HANDLER(35)
206         LAPIC_INTR_DUMMY_HANDLER(36)
207         LAPIC_INTR_DUMMY_HANDLER(37)
208         LAPIC_INTR_DUMMY_HANDLER(38)
209         LAPIC_INTR_DUMMY_HANDLER(39)
210         LAPIC_INTR_DUMMY_HANDLER(40)
211         LAPIC_INTR_DUMMY_HANDLER(41)
212         LAPIC_INTR_DUMMY_HANDLER(42)
213         LAPIC_INTR_DUMMY_HANDLER(43)
214         LAPIC_INTR_DUMMY_HANDLER(44)
215         LAPIC_INTR_DUMMY_HANDLER(45)
216         LAPIC_INTR_DUMMY_HANDLER(46)
217         LAPIC_INTR_DUMMY_HANDLER(47)
218         LAPIC_INTR_DUMMY_HANDLER(48)
219         LAPIC_INTR_DUMMY_HANDLER(49)
220         LAPIC_INTR_DUMMY_HANDLER(50)
221         LAPIC_INTR_DUMMY_HANDLER(51)
222         LAPIC_INTR_DUMMY_HANDLER(52)
223         LAPIC_INTR_DUMMY_HANDLER(53)
224         LAPIC_INTR_DUMMY_HANDLER(54)
225         LAPIC_INTR_DUMMY_HANDLER(55)
226         LAPIC_INTR_DUMMY_HANDLER(56)
227         LAPIC_INTR_DUMMY_HANDLER(57)
228         LAPIC_INTR_DUMMY_HANDLER(58)
229         LAPIC_INTR_DUMMY_HANDLER(59)
230         LAPIC_INTR_DUMMY_HANDLER(60)
231         LAPIC_INTR_DUMMY_HANDLER(61)
232         LAPIC_INTR_DUMMY_HANDLER(62)
233         LAPIC_INTR_DUMMY_HANDLER(63)
234         LAPIC_INTR_DUMMY_HANDLER(64)
235         LAPIC_INTR_DUMMY_HANDLER(65)
236         LAPIC_INTR_DUMMY_HANDLER(66)
237         LAPIC_INTR_DUMMY_HANDLER(67)
238         LAPIC_INTR_DUMMY_HANDLER(68)
239         LAPIC_INTR_DUMMY_HANDLER(69)
240         LAPIC_INTR_DUMMY_HANDLER(70)
241         LAPIC_INTR_DUMMY_HANDLER(71)
242         LAPIC_INTR_DUMMY_HANDLER(72)
243         LAPIC_INTR_DUMMY_HANDLER(73)
244         LAPIC_INTR_DUMMY_HANDLER(74)
245         LAPIC_INTR_DUMMY_HANDLER(75)
246         LAPIC_INTR_DUMMY_HANDLER(76)
247         LAPIC_INTR_DUMMY_HANDLER(77)
248         LAPIC_INTR_DUMMY_HANDLER(78)
249         LAPIC_INTR_DUMMY_HANDLER(79)
250         LAPIC_INTR_DUMMY_HANDLER(80)
251         LAPIC_INTR_DUMMY_HANDLER(81)
252         LAPIC_INTR_DUMMY_HANDLER(82)
253         LAPIC_INTR_DUMMY_HANDLER(83)
254         LAPIC_INTR_DUMMY_HANDLER(84)
255         LAPIC_INTR_DUMMY_HANDLER(85)
256         LAPIC_INTR_DUMMY_HANDLER(86)
257         LAPIC_INTR_DUMMY_HANDLER(87)
258         LAPIC_INTR_DUMMY_HANDLER(88)
259         LAPIC_INTR_DUMMY_HANDLER(89)
260         LAPIC_INTR_DUMMY_HANDLER(90)
261         LAPIC_INTR_DUMMY_HANDLER(91)
262         LAPIC_INTR_DUMMY_HANDLER(92)
263         LAPIC_INTR_DUMMY_HANDLER(93)
264         LAPIC_INTR_DUMMY_HANDLER(94)
265         LAPIC_INTR_DUMMY_HANDLER(95)
266         LAPIC_INTR_DUMMY_HANDLER(96)
267         LAPIC_INTR_DUMMY_HANDLER(97)
268         LAPIC_INTR_DUMMY_HANDLER(98)
269         LAPIC_INTR_DUMMY_HANDLER(99)
270         LAPIC_INTR_DUMMY_HANDLER(100)
271         LAPIC_INTR_DUMMY_HANDLER(101)
272         LAPIC_INTR_DUMMY_HANDLER(102)
273         LAPIC_INTR_DUMMY_HANDLER(103)
274         LAPIC_INTR_DUMMY_HANDLER(104)
275         LAPIC_INTR_DUMMY_HANDLER(105)
276         LAPIC_INTR_DUMMY_HANDLER(106)
277         LAPIC_INTR_DUMMY_HANDLER(107)
278         LAPIC_INTR_DUMMY_HANDLER(108)
279         LAPIC_INTR_DUMMY_HANDLER(109)
280         LAPIC_INTR_DUMMY_HANDLER(110)
281         LAPIC_INTR_DUMMY_HANDLER(111)
282         LAPIC_INTR_DUMMY_HANDLER(112)
283         LAPIC_INTR_DUMMY_HANDLER(113)
284         LAPIC_INTR_DUMMY_HANDLER(114)
285         LAPIC_INTR_DUMMY_HANDLER(115)
286         LAPIC_INTR_DUMMY_HANDLER(116)
287         LAPIC_INTR_DUMMY_HANDLER(117)
288         LAPIC_INTR_DUMMY_HANDLER(118)
289         LAPIC_INTR_DUMMY_HANDLER(119)
290         LAPIC_INTR_DUMMY_HANDLER(120)
291         LAPIC_INTR_DUMMY_HANDLER(121)
292         LAPIC_INTR_DUMMY_HANDLER(122)
293         LAPIC_INTR_DUMMY_HANDLER(123)
294         LAPIC_INTR_DUMMY_HANDLER(124)
295         LAPIC_INTR_DUMMY_HANDLER(125)
296         LAPIC_INTR_DUMMY_HANDLER(126)
297         LAPIC_INTR_DUMMY_HANDLER(127)
298         LAPIC_INTR_DUMMY_HANDLER(128)
299         LAPIC_INTR_DUMMY_HANDLER(129)
300         LAPIC_INTR_DUMMY_HANDLER(130)
301         LAPIC_INTR_DUMMY_HANDLER(131)
302         LAPIC_INTR_DUMMY_HANDLER(132)
303         LAPIC_INTR_DUMMY_HANDLER(133)
304         LAPIC_INTR_DUMMY_HANDLER(134)
305         LAPIC_INTR_DUMMY_HANDLER(135)
306         LAPIC_INTR_DUMMY_HANDLER(136)
307         LAPIC_INTR_DUMMY_HANDLER(137)
308         LAPIC_INTR_DUMMY_HANDLER(138)
309         LAPIC_INTR_DUMMY_HANDLER(139)
310         LAPIC_INTR_DUMMY_HANDLER(140)
311         LAPIC_INTR_DUMMY_HANDLER(141)
312         LAPIC_INTR_DUMMY_HANDLER(142)
313         LAPIC_INTR_DUMMY_HANDLER(143)
314         LAPIC_INTR_DUMMY_HANDLER(144)
315         LAPIC_INTR_DUMMY_HANDLER(145)
316         LAPIC_INTR_DUMMY_HANDLER(146)
317         LAPIC_INTR_DUMMY_HANDLER(147)
318         LAPIC_INTR_DUMMY_HANDLER(148)
319         LAPIC_INTR_DUMMY_HANDLER(149)
320         LAPIC_INTR_DUMMY_HANDLER(150)
321         LAPIC_INTR_DUMMY_HANDLER(151)
322         LAPIC_INTR_DUMMY_HANDLER(152)
323         LAPIC_INTR_DUMMY_HANDLER(153)
324         LAPIC_INTR_DUMMY_HANDLER(154)
325         LAPIC_INTR_DUMMY_HANDLER(155)
326         LAPIC_INTR_DUMMY_HANDLER(156)
327         LAPIC_INTR_DUMMY_HANDLER(157)
328         LAPIC_INTR_DUMMY_HANDLER(158)
329         LAPIC_INTR_DUMMY_HANDLER(159)
330         LAPIC_INTR_DUMMY_HANDLER(160)
331         LAPIC_INTR_DUMMY_HANDLER(161)
332         LAPIC_INTR_DUMMY_HANDLER(162)
333         LAPIC_INTR_DUMMY_HANDLER(163)
334         LAPIC_INTR_DUMMY_HANDLER(164)
335         LAPIC_INTR_DUMMY_HANDLER(165)
336         LAPIC_INTR_DUMMY_HANDLER(166)
337         LAPIC_INTR_DUMMY_HANDLER(167)
338         LAPIC_INTR_DUMMY_HANDLER(168)
339         LAPIC_INTR_DUMMY_HANDLER(169)
340         LAPIC_INTR_DUMMY_HANDLER(170)
341         LAPIC_INTR_DUMMY_HANDLER(171)
342         LAPIC_INTR_DUMMY_HANDLER(172)
343         LAPIC_INTR_DUMMY_HANDLER(173)
344         LAPIC_INTR_DUMMY_HANDLER(174)
345         LAPIC_INTR_DUMMY_HANDLER(175)
346         LAPIC_INTR_DUMMY_HANDLER(176)
347         LAPIC_INTR_DUMMY_HANDLER(177)
348         LAPIC_INTR_DUMMY_HANDLER(178)
349         LAPIC_INTR_DUMMY_HANDLER(179)
350         LAPIC_INTR_DUMMY_HANDLER(180)
351         LAPIC_INTR_DUMMY_HANDLER(181)
352         LAPIC_INTR_DUMMY_HANDLER(182)
353         LAPIC_INTR_DUMMY_HANDLER(183)
354         LAPIC_INTR_DUMMY_HANDLER(184)
355         LAPIC_INTR_DUMMY_HANDLER(185)
356         LAPIC_INTR_DUMMY_HANDLER(186)
357         LAPIC_INTR_DUMMY_HANDLER(187)
358         LAPIC_INTR_DUMMY_HANDLER(188)
359         LAPIC_INTR_DUMMY_HANDLER(189)
360         LAPIC_INTR_DUMMY_HANDLER(190)
361         LAPIC_INTR_DUMMY_HANDLER(191)
362         LAPIC_INTR_DUMMY_HANDLER(192)
363         LAPIC_INTR_DUMMY_HANDLER(193)
364         LAPIC_INTR_DUMMY_HANDLER(194)
365         LAPIC_INTR_DUMMY_HANDLER(195)
366         LAPIC_INTR_DUMMY_HANDLER(196)
367         LAPIC_INTR_DUMMY_HANDLER(197)
368         LAPIC_INTR_DUMMY_HANDLER(198)
369         LAPIC_INTR_DUMMY_HANDLER(199)
370         LAPIC_INTR_DUMMY_HANDLER(200)
371         LAPIC_INTR_DUMMY_HANDLER(201)
372         LAPIC_INTR_DUMMY_HANDLER(202)
373         LAPIC_INTR_DUMMY_HANDLER(203)
374         LAPIC_INTR_DUMMY_HANDLER(204)
375         LAPIC_INTR_DUMMY_HANDLER(205)
376         LAPIC_INTR_DUMMY_HANDLER(206)
377         LAPIC_INTR_DUMMY_HANDLER(207)
378         LAPIC_INTR_DUMMY_HANDLER(208)
379         LAPIC_INTR_DUMMY_HANDLER(209)
380         LAPIC_INTR_DUMMY_HANDLER(210)
381         LAPIC_INTR_DUMMY_HANDLER(211)
382         LAPIC_INTR_DUMMY_HANDLER(212)
383         LAPIC_INTR_DUMMY_HANDLER(213)
384         LAPIC_INTR_DUMMY_HANDLER(214)
385         LAPIC_INTR_DUMMY_HANDLER(215)
386         LAPIC_INTR_DUMMY_HANDLER(216)
387         LAPIC_INTR_DUMMY_HANDLER(217)
388         LAPIC_INTR_DUMMY_HANDLER(218)
389         LAPIC_INTR_DUMMY_HANDLER(219)
390         LAPIC_INTR_DUMMY_HANDLER(220)
391         LAPIC_INTR_DUMMY_HANDLER(221)
392         LAPIC_INTR_DUMMY_HANDLER(222)
393         LAPIC_INTR_DUMMY_HANDLER(223)
394         LAPIC_INTR_DUMMY_HANDLER(224)
395         LAPIC_INTR_DUMMY_HANDLER(225)
396         LAPIC_INTR_DUMMY_HANDLER(226)
397         LAPIC_INTR_DUMMY_HANDLER(227)
398         LAPIC_INTR_DUMMY_HANDLER(228)
399         LAPIC_INTR_DUMMY_HANDLER(229)
400         LAPIC_INTR_DUMMY_HANDLER(230)
401         LAPIC_INTR_DUMMY_HANDLER(231)
402         LAPIC_INTR_DUMMY_HANDLER(232)
403         LAPIC_INTR_DUMMY_HANDLER(233)
404         LAPIC_INTR_DUMMY_HANDLER(234)
405         LAPIC_INTR_DUMMY_HANDLER(235)
406         LAPIC_INTR_DUMMY_HANDLER(236)
407         LAPIC_INTR_DUMMY_HANDLER(237)
408         LAPIC_INTR_DUMMY_HANDLER(238)
409         LAPIC_INTR_DUMMY_HANDLER(239)
410         LAPIC_INTR_DUMMY_HANDLER(240)
411         LAPIC_INTR_DUMMY_HANDLER(241)
412         LAPIC_INTR_DUMMY_HANDLER(242)
413         LAPIC_INTR_DUMMY_HANDLER(243)
414         LAPIC_INTR_DUMMY_HANDLER(244)
415         LAPIC_INTR_DUMMY_HANDLER(245)
416         LAPIC_INTR_DUMMY_HANDLER(246)
417         LAPIC_INTR_DUMMY_HANDLER(247)
418         LAPIC_INTR_DUMMY_HANDLER(248)
419         LAPIC_INTR_DUMMY_HANDLER(249)
420         LAPIC_INTR_DUMMY_HANDLER(250)
421         LAPIC_INTR_DUMMY_HANDLER(251)
422         LAPIC_INTR_DUMMY_HANDLER(252)
423         LAPIC_INTR_DUMMY_HANDLER(253)
424         LAPIC_INTR_DUMMY_HANDLER(254)
425         LAPIC_INTR_DUMMY_HANDLER(255)
426 LABEL(lapic_intr_dummy_handles_end)
429 #endif /* APIC_DEBUG */