https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7a9474a6bb891bf979c2b…
commit 7a9474a6bb891bf979c2bf3f0b37d745df98c12d
Author: Thomas Faber <thomas.faber(a)reactos.org>
AuthorDate: Sun Feb 18 12:42:18 2018 +0100
Commit: Thomas Faber <thomas.faber(a)reactos.org>
CommitDate: Sun Feb 18 13:06:39 2018 +0100
[HAL] Create a macro for the HalpEndSoftwareInterrupt to allow reuse. CORE-14076
---
hal/halx86/up/pic.S | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/hal/halx86/up/pic.S b/hal/halx86/up/pic.S
index 5025a44254..170304788b 100644
--- a/hal/halx86/up/pic.S
+++ b/hal/halx86/up/pic.S
@@ -11,8 +11,6 @@
#include <ks386.inc>
-EXTERN @HalpEndSoftwareInterrupt2@8:PROC
-
/* GLOBALS *******************************************************************/
.data
@@ -21,23 +19,26 @@ ASSUME CS:NOTHING, DS:NOTHING, ES:NOTHING, FS:NOTHING, GS:NOTHING
/* FUNCTIONS *****************************************************************/
.code
-PUBLIC _HalpEndSoftwareInterrupt@8
-.PROC _HalpEndSoftwareInterrupt@8
+
+MACRO(DEFINE_END_INTERRUPT_WRAPPER, WrapperName, HandlerName)
+EXTERN @&HandlerName&@8:PROC
+PUBLIC _&WrapperName&@8
+.PROC _&WrapperName&@8
FPO 0, 2, 0, 0, 0, FRAME_FPO
/* Call the C function with the same arguments we got */
mov ecx, [esp+4]
mov edx, [esp+8]
- call @HalpEndSoftwareInterrupt2@8
+ call @&HandlerName&@8
/* Check if we got a pointer back */
test eax, eax
- jnz CallIntHandler
+ jnz WrapperName&_CallIntHandler
/* No? Just return */
ret 8
-CallIntHandler:
+WrapperName&_CallIntHandler:
/* We got a pointer to call. Since it won't return, free up our stack
space. Otherwise we could end up with some nasty deep recursion.
The next function takes the trap frame as its (fastcall) argument. */
@@ -45,5 +46,9 @@ CallIntHandler:
add esp, 12
jmp eax
.ENDP
+ENDM
+
+
+DEFINE_END_INTERRUPT_WRAPPER HalpEndSoftwareInterrupt, HalpEndSoftwareInterrupt2
END
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=040d78354e7da85350629…
commit 040d78354e7da85350629a8b28f303d959a81f9c
Author: Thomas Faber <thomas.faber(a)reactos.org>
AuthorDate: Sun Feb 11 11:33:16 2018 +0100
Commit: Thomas Faber <thomas.faber(a)reactos.org>
CommitDate: Sun Feb 18 13:06:37 2018 +0100
[HAL] Convert HalpEndSoftwareInterrupt2 to fastcall. CORE-14076
---
hal/halx86/up/pic.S | 11 ++++++-----
hal/halx86/up/pic.c | 2 +-
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/hal/halx86/up/pic.S b/hal/halx86/up/pic.S
index c9bd891407..5025a44254 100644
--- a/hal/halx86/up/pic.S
+++ b/hal/halx86/up/pic.S
@@ -11,7 +11,7 @@
#include <ks386.inc>
-EXTERN _HalpEndSoftwareInterrupt2@8:PROC
+EXTERN @HalpEndSoftwareInterrupt2@8:PROC
/* GLOBALS *******************************************************************/
@@ -26,9 +26,9 @@ PUBLIC _HalpEndSoftwareInterrupt@8
FPO 0, 2, 0, 0, 0, FRAME_FPO
/* Call the C function with the same arguments we got */
- push [esp+8]
- push [esp+8]
- call _HalpEndSoftwareInterrupt2@8
+ mov ecx, [esp+4]
+ mov edx, [esp+8]
+ call @HalpEndSoftwareInterrupt2@8
/* Check if we got a pointer back */
test eax, eax
@@ -39,7 +39,8 @@ PUBLIC _HalpEndSoftwareInterrupt@8
CallIntHandler:
/* We got a pointer to call. Since it won't return, free up our stack
- space, or we could end up with some nasty deep recursion */
+ space. Otherwise we could end up with some nasty deep recursion.
+ The next function takes the trap frame as its (fastcall) argument. */
mov ecx, [esp+8]
add esp, 12
jmp eax
diff --git a/hal/halx86/up/pic.c b/hal/halx86/up/pic.c
index a66526cd50..f61bf738d0 100644
--- a/hal/halx86/up/pic.c
+++ b/hal/halx86/up/pic.c
@@ -677,7 +677,7 @@ HalClearSoftwareInterrupt(IN KIRQL Irql)
}
PHAL_SW_INTERRUPT_HANDLER_2ND_ENTRY
-NTAPI
+FASTCALL
HalpEndSoftwareInterrupt2(IN KIRQL OldIrql,
IN PKTRAP_FRAME TrapFrame)
{