* Bring back rbuild build to be used until bug 6372 is fixed.
[reactos.git] / include / reactos / syscalls.inc
1
2 #ifdef _M_IX86
3 #define KUSER_SHARED_SYSCALL HEX(7ffe0300)
4 #define KGDT_R0_CODE 8
5 MACRO(STUBCODE_U, SyscallId, StackBytes)
6 mov eax, SyscallId
7 mov ecx, KUSER_SHARED_SYSCALL
8 call dword ptr [ecx]
9 ret StackBytes
10 ENDM
11 MACRO(STUBCODE_K, SyscallId, StackBytes)
12 mov eax, SyscallId
13 lea edx, [esp + 4]
14 pushf
15 push KGDT_R0_CODE
16 call _KiSystemService
17 ret StackBytes
18 ENDM
19 #elif defined(_M_AMD64)
20 MACRO(STUBCODE_U, SyscallId, StackBytes)
21 mov eax, SyscallId
22 mov r10, rcx
23 syscall
24 ret StackBytes
25 ENDM
26 MACRO(STUBCODE_K, SyscallId, StackBytes)
27 mov eax, SyscallId
28 call KiSystemService
29 ret StackBytes
30 ENDM
31 #elif defined(_M_ARM)
32 MACRO(STUBCODE_U, SyscallId, StackBytes)
33 swi #SyscallId
34 bx lr
35 ENDM
36 MACRO(STUBCODE_K, SyscallId, StackBytes)
37 mov ip, lr
38 swi #SyscallId
39 bx ip
40 ENDM
41 #elif defined(_M_PPC)
42 MACRO(STUBCODE_U, SyscallId, StackBytes)
43 stwu 1,-16(1)
44 mflr 0
45 stw 0,0(1)
46 li 0, SyscallId
47 sc
48 lwz 0,0(1)
49 mtlr 0
50 addi 1,1,16
51 blr
52 ENDM
53 #define STUBCODE_K STUBCODE_U
54 #elif defined(_M_MIPS)
55 MACRO(STUBCODE_U, SyscallId, StackBytes)
56 li $8, KUSER_SHARED_SYSCALL
57 lw $8,0($8)
58 j $8
59 nop
60 ENDM
61 MACRO(STUBCODE_K, SyscallId, StackBytes)
62 j KiSystemService
63 nop
64 ENDM
65 #else
66 #error unsupported architecture
67 #endif
68
69 #ifdef _M_IX86
70 MACRO(MAKE_LABEL, Name, Stackbytes)
71 PUBLIC _&Name&@&Stackbytes
72 _&Name&@&Stackbytes:
73 ENDM
74 #else
75 MACRO(MAKE_LABEL, Name, Stackbytes)
76 PUBLIC &Name
77 &Name:
78 ENDM
79 #endif
80
81 MACRO(STUB_U, Name, ArgCount)
82 Stackbytes = 4 * &ArgCount
83 MAKE_LABEL Zw&Name, %Stackbytes
84 MAKE_LABEL Nt&Name, %Stackbytes
85 STUBCODE_U SyscallId, %Stackbytes
86 SyscallId = SyscallId + 1
87 ENDM
88
89 MACRO(STUB_K, Name, ArgCount)
90 Stackbytes = 4 * &ArgCount
91 MAKE_LABEL Zw&Name, %Stackbytes
92 STUBCODE_K SyscallId, %Stackbytes
93 SyscallId = SyscallId + 1
94 ENDM