Author: tkreuzer
Date: Sat Feb 4 12:29:24 2012
New Revision: 55409
URL:
http://svn.reactos.org/svn/reactos?rev=55409&view=rev
Log:
[ASM]
Modify syscall stub macros to be compatible with the new amd64 stubs
Modified:
trunk/reactos/include/asm/syscalls.inc
Modified: trunk/reactos/include/asm/syscalls.inc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/asm/syscalls.inc?r…
==============================================================================
--- trunk/reactos/include/asm/syscalls.inc [iso-8859-1] (original)
+++ trunk/reactos/include/asm/syscalls.inc [iso-8859-1] Sat Feb 4 12:29:24 2012
@@ -2,14 +2,16 @@
#ifdef _M_IX86
#define KUSER_SHARED_SYSCALL HEX(7ffe0300)
#define KGDT_R0_CODE 8
-MACRO(STUBCODE_U, SyscallId, StackBytes)
+MACRO(STUBCODE_U, Name, SyscallId, ArgCount)
+ StackBytes = 4 * ArgCount
FPO 0, 0, 0, 0, 0, FRAME_FPO
mov eax, SyscallId
mov ecx, KUSER_SHARED_SYSCALL
call dword ptr [ecx]
ret StackBytes
ENDM
-MACRO(STUBCODE_K, SyscallId, StackBytes)
+MACRO(STUBCODE_K, Name, SyscallId, ArgCount)
+ StackBytes = 4 * &ArgCount
FPO 0, 0, 0, 0, 0, FRAME_FPO
mov eax, SyscallId
lea edx, [esp + 4]
@@ -19,31 +21,32 @@
ret StackBytes
ENDM
#elif defined(_M_AMD64)
-MACRO(STUBCODE_U, SyscallId, StackBytes)
+MACRO(STUBCODE_U, Name, SyscallId, ArgCount)
.ENDPROLOG
mov eax, SyscallId
mov r10, rcx
syscall
- ret StackBytes
+ ret
ENDM
-MACRO(STUBCODE_K, SyscallId, StackBytes)
+MACRO(STUBCODE_K, Name, SyscallId, ArgCount)
.ENDPROLOG
- mov eax, SyscallId
- call KiSystemService
- ret StackBytes
+ EXTERN Nt&Name:PROC
+ lea rax, Nt&Name[rip]
+ mov r10, ArgCount * 8
+ jmp KiZwSystemService
ENDM
#elif defined(_M_ARM)
-MACRO(STUBCODE_U, SyscallId, StackBytes)
+MACRO(STUBCODE_U, Name, SyscallId, ArgCount)
swi #SyscallId
bx lr
ENDM
-MACRO(STUBCODE_K, SyscallId, StackBytes)
+MACRO(STUBCODE_K, Name, SyscallId, ArgCount)
mov ip, lr
swi #SyscallId
bx ip
ENDM
#elif defined(_M_PPC)
-MACRO(STUBCODE_U, SyscallId, StackBytes)
+MACRO(STUBCODE_U, Name, SyscallId, ArgCount)
stwu 1,-16(1)
mflr 0
stw 0,0(1)
@@ -56,13 +59,13 @@
ENDM
#define STUBCODE_K STUBCODE_U
#elif defined(_M_MIPS)
-MACRO(STUBCODE_U, SyscallId, StackBytes)
+MACRO(STUBCODE_U, Name, SyscallId, ArgCount)
li $8, KUSER_SHARED_SYSCALL
lw $8,0($8)
j $8
nop
ENDM
-MACRO(STUBCODE_K, SyscallId, StackBytes)
+MACRO(STUBCODE_K, Name, SyscallId, ArgCount)
j KiSystemService
nop
ENDM
@@ -71,38 +74,36 @@
#endif
#ifdef _M_IX86
-MACRO(MAKE_LABEL, Name, Stackbytes)
- PUBLIC _&Name&@&Stackbytes
- _&Name&@&Stackbytes:
+MACRO(MAKE_LABEL, Name, StackBytes)
+ PUBLIC _&Name&@&StackBytes
+ _&Name&@&StackBytes:
ENDM
-MACRO(START_PROC, Name, Stackbytes)
- PUBLIC _&Name&@&Stackbytes
- .PROC _&Name&@&Stackbytes
+MACRO(START_PROC, Name, StackBytes)
+ PUBLIC _&Name&@&StackBytes
+ .PROC _&Name&@&StackBytes
ENDM
#else
-MACRO(MAKE_LABEL, Name, Stackbytes)
+MACRO(MAKE_LABEL, Name, StackBytes)
PUBLIC &Name
&Name:
ENDM
-MACRO(START_PROC, Name, Stackbytes)
+MACRO(START_PROC, Name, StackBytes)
PUBLIC &Name
.PROC &Name
ENDM
#endif
MACRO(STUB_U, Name, ArgCount)
- Stackbytes = 4 * &ArgCount
- MAKE_LABEL Zw&Name, %Stackbytes
- START_PROC Nt&Name, %Stackbytes
- STUBCODE_U SyscallId, %Stackbytes
+ MAKE_LABEL Zw&Name, %ArgCount * 4
+ START_PROC Nt&Name, %ArgCount * 4
+ STUBCODE_U Name, SyscallId, %ArgCount
.ENDP
SyscallId = SyscallId + 1
ENDM
MACRO(STUB_K, Name, ArgCount)
- Stackbytes = 4 * &ArgCount
- START_PROC Zw&Name, %Stackbytes
- STUBCODE_K SyscallId, %Stackbytes
+ START_PROC Zw&Name, %ArgCount * 4
+ STUBCODE_K Name, SyscallId, %ArgCount
.ENDP
SyscallId = SyscallId + 1
ENDM