5 #include <machine/asm.h>
7 #define APIC_IRQ_HANDLER(irq) \
9 call _C_LABEL(irq_handle) /* intr_handle(irq) */ ;\
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) ;\
21 SAVE_PROCESS_CTX(0) ;\
23 call _C_LABEL(context_stop) ;\
25 movl $0, %ebp /* for stack trace */ ;\
26 APIC_IRQ_HANDLER(irq) ;\
27 jmp _C_LABEL(switch_to_user) ;\
31 call _C_LABEL(context_stop_idle) ;\
32 APIC_IRQ_HANDLER(irq) ;\
33 CLEAR_IF(10*4(%esp)) ;\
37 #define LAPIC_INTR_HANDLER(func) \
39 call *%eax /* call the actual handler */ ;\
40 mov _C_LABEL(lapic_eoi_addr), %eax /* the end of handler*/ ;\
43 /*===========================================================================*/
44 /* handler of the local APIC interrupts */
45 /*===========================================================================*/
47 #define lapic_intr(func) \
48 TEST_INT_IN_KERNEL(4, 0f) ;\
50 SAVE_PROCESS_CTX(0) ;\
52 call _C_LABEL(context_stop) ;\
54 movl $0, %ebp /* for stack trace */ ;\
55 LAPIC_INTR_HANDLER(func) ;\
56 jmp _C_LABEL(switch_to_user) ;\
60 call _C_LABEL(context_stop_idle) ;\
61 LAPIC_INTR_HANDLER(func) ;\
62 CLEAR_IF(10*4(%esp)) ;\
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))
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 */
89 lapic_intr_dummy_handler_msg:
90 .ascii "UNHANDLED APIC interrupt vector %d\n"
94 #define lapic_intr_dummy_handler(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)
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 */