2 * FILE: hal/halx86/up/pic.S
3 * COPYRIGHT: See COPYING in the top level directory
4 * PURPOSE: HAL PIC Management and Control Code
5 * PROGRAMMER: Thomas Faber (thomas.faber@reactos.org)
8 /* INCLUDES ******************************************************************/
14 /* GLOBALS *******************************************************************/
17 ASSUME CS:NOTHING, DS:NOTHING, ES:NOTHING, FS:NOTHING, GS:NOTHING
19 /* FUNCTIONS *****************************************************************/
23 MACRO(DEFINE_END_INTERRUPT_WRAPPER, WrapperName, HandlerName)
24 EXTERN @&HandlerName&@8:PROC
25 PUBLIC _&WrapperName&@8
26 .PROC _&WrapperName&@8
27 FPO 0, 2, 0, 0, 0, FRAME_FPO
29 /* Call the C function with the same arguments we got */
34 /* Check if we got a pointer back */
36 jnz WrapperName&_CallIntHandler
41 WrapperName&_CallIntHandler:
42 /* We got a pointer to call. Since it won't return, reset the stack to
43 the location of the stack frame. This frees up our own stack as well
44 as that of the functions above us, and avoids an overflow due to
46 The next function takes the trap frame as its (fastcall) argument. */
54 MACRO(DEFINE_INTERRUPT_WRAPPER, WrapperName, HandlerName)
55 EXTERN _&HandlerName:PROC
58 FPO 0, 0, 0, 0, 0, FRAME_FPO
60 /* Call the C function */
63 /* Check if we got a pointer back */
65 jnz WrapperName&_CallIntHandler
70 WrapperName&_CallIntHandler:
71 /* Optimize the tail call to avoid stack overflow */
77 DEFINE_END_INTERRUPT_WRAPPER HalpEndSoftwareInterrupt, HalpEndSoftwareInterrupt2
78 DEFINE_END_INTERRUPT_WRAPPER HalEndSystemInterrupt, HalEndSystemInterrupt2
80 DEFINE_INTERRUPT_WRAPPER HalpDispatchInterrupt, HalpDispatchInterrupt2
81 DEFINE_INTERRUPT_WRAPPER HalpHardwareInterruptLevel, HalpHardwareInterruptLevel2