mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
[HAL] Eliminate tail calls from HalpDispatchInterrupt[2]. CORE-14076
This commit is contained in:
parent
ade345427f
commit
b4453242f7
3 changed files with 30 additions and 4 deletions
|
@ -576,7 +576,7 @@ HalpEnableInterruptHandler(IN UCHAR Flags,
|
|||
VOID NTAPI HalpInitializePICs(IN BOOLEAN EnableInterrupts);
|
||||
VOID __cdecl HalpApcInterrupt(VOID);
|
||||
VOID __cdecl HalpDispatchInterrupt(VOID);
|
||||
VOID __cdecl HalpDispatchInterrupt2(VOID);
|
||||
PHAL_SW_INTERRUPT_HANDLER __cdecl HalpDispatchInterrupt2(VOID);
|
||||
DECLSPEC_NORETURN VOID FASTCALL HalpApcInterrupt2ndEntry(IN PKTRAP_FRAME TrapFrame);
|
||||
DECLSPEC_NORETURN VOID FASTCALL HalpDispatchInterrupt2ndEntry(IN PKTRAP_FRAME TrapFrame);
|
||||
|
||||
|
|
|
@ -48,8 +48,32 @@ WrapperName&_CallIntHandler:
|
|||
.ENDP
|
||||
ENDM
|
||||
|
||||
MACRO(DEFINE_INTERRUPT_WRAPPER, WrapperName, HandlerName)
|
||||
EXTERN _&HandlerName:PROC
|
||||
PUBLIC _&WrapperName
|
||||
.PROC _&WrapperName
|
||||
FPO 0, 0, 0, 0, 0, FRAME_FPO
|
||||
|
||||
/* Call the C function */
|
||||
call _&HandlerName
|
||||
|
||||
/* Check if we got a pointer back */
|
||||
test eax, eax
|
||||
jnz WrapperName&_CallIntHandler
|
||||
|
||||
/* No? Just return */
|
||||
ret
|
||||
|
||||
WrapperName&_CallIntHandler:
|
||||
/* Optimize the tail call to avoid stack overflow */
|
||||
jmp eax
|
||||
.ENDP
|
||||
ENDM
|
||||
|
||||
|
||||
DEFINE_END_INTERRUPT_WRAPPER HalpEndSoftwareInterrupt, HalpEndSoftwareInterrupt2
|
||||
DEFINE_END_INTERRUPT_WRAPPER HalEndSystemInterrupt, HalEndSystemInterrupt2
|
||||
|
||||
DEFINE_INTERRUPT_WRAPPER HalpDispatchInterrupt, HalpDispatchInterrupt2
|
||||
|
||||
END
|
||||
|
|
|
@ -382,7 +382,7 @@ PHAL_SW_INTERRUPT_HANDLER SWInterruptHandlerTable[20] =
|
|||
{
|
||||
(PHAL_SW_INTERRUPT_HANDLER)KiUnexpectedInterrupt,
|
||||
HalpApcInterrupt,
|
||||
HalpDispatchInterrupt2,
|
||||
HalpDispatchInterrupt,
|
||||
(PHAL_SW_INTERRUPT_HANDLER)KiUnexpectedInterrupt,
|
||||
HalpHardwareInterrupt0,
|
||||
HalpHardwareInterrupt1,
|
||||
|
@ -1297,7 +1297,7 @@ HalpDispatchInterrupt2ndEntry(IN PKTRAP_FRAME TrapFrame)
|
|||
KiEoiHelper(TrapFrame);
|
||||
}
|
||||
|
||||
VOID
|
||||
PHAL_SW_INTERRUPT_HANDLER
|
||||
__cdecl
|
||||
HalpDispatchInterrupt2(VOID)
|
||||
{
|
||||
|
@ -1330,8 +1330,10 @@ HalpDispatchInterrupt2(VOID)
|
|||
}
|
||||
|
||||
/* Now handle pending interrupt */
|
||||
SWInterruptHandlerTable[PendingIrql]();
|
||||
return SWInterruptHandlerTable[PendingIrql];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#else
|
||||
|
|
Loading…
Reference in a new issue