xref: /reactos/ntoskrnl/ke/arm/ke_i.h (revision 34593d93)
1*c2c66affSColin Finck /*
2*c2c66affSColin Finck  * PROJECT:         ReactOS Kernel
3*c2c66affSColin Finck  * LICENSE:         BSD - See COPYING.ARM in the top level directory
4*c2c66affSColin Finck  * FILE:            ntoskrnl/ke/arm/ke_i.h
5*c2c66affSColin Finck  * PURPOSE:         Implements macro-generated system call portable wrappers
6*c2c66affSColin Finck  * PROGRAMMERS:     ReactOS Portable Systems Group
7*c2c66affSColin Finck  */
8*c2c66affSColin Finck 
9*c2c66affSColin Finck //
10*c2c66affSColin Finck // First, cleanup after any previous invocation
11*c2c66affSColin Finck //
12*c2c66affSColin Finck #undef _1
13*c2c66affSColin Finck #undef _2
14*c2c66affSColin Finck #undef _3
15*c2c66affSColin Finck #undef _4
16*c2c66affSColin Finck #undef _5
17*c2c66affSColin Finck #undef _6
18*c2c66affSColin Finck #undef _7
19*c2c66affSColin Finck #undef _8
20*c2c66affSColin Finck #undef _9
21*c2c66affSColin Finck #undef a
22*c2c66affSColin Finck #undef b
23*c2c66affSColin Finck #undef c
24*c2c66affSColin Finck #undef d
25*c2c66affSColin Finck #undef e
26*c2c66affSColin Finck #undef f
27*c2c66affSColin Finck #undef _10
28*c2c66affSColin Finck #undef _11
29*c2c66affSColin Finck #undef SYSCALL
30*c2c66affSColin Finck 
31*c2c66affSColin Finck //
32*c2c66affSColin Finck // Are we building the typedef prototypes?
33*c2c66affSColin Finck //
34*c2c66affSColin Finck #ifdef PROTO
35*c2c66affSColin Finck     //
36*c2c66affSColin Finck     // Then, each parameter is actually a prototype argument
37*c2c66affSColin Finck     //
38*c2c66affSColin Finck     #define _1 PVOID
39*c2c66affSColin Finck     #define _2 PVOID
40*c2c66affSColin Finck     #define _3 PVOID
41*c2c66affSColin Finck     #define _4 PVOID
42*c2c66affSColin Finck     #define _5 PVOID
43*c2c66affSColin Finck     #define _6 PVOID
44*c2c66affSColin Finck     #define _7 PVOID
45*c2c66affSColin Finck     #define _8 PVOID
46*c2c66affSColin Finck     #define _9 PVOID
47*c2c66affSColin Finck     #define a PVOID
48*c2c66affSColin Finck     #define b PVOID
49*c2c66affSColin Finck     #define c PVOID
50*c2c66affSColin Finck     #define d PVOID
51*c2c66affSColin Finck     #define e PVOID
52*c2c66affSColin Finck     #define f PVOID
53*c2c66affSColin Finck     #define _10 PVOID
54*c2c66affSColin Finck     #define _11 PVOID
55*c2c66affSColin Finck 
56*c2c66affSColin Finck     //
57*c2c66affSColin Finck     // And we generate the typedef
58*c2c66affSColin Finck     //
59*c2c66affSColin Finck     #define SYSCALL(x, y) typedef NTSTATUS (*PKI_SYSCALL_##x##PARAM)y;
60*c2c66affSColin Finck 
61*c2c66affSColin Finck     //
62*c2c66affSColin Finck     // Cleanup for next run
63*c2c66affSColin Finck     //
64*c2c66affSColin Finck     #undef PROTO
65*c2c66affSColin Finck #else
66*c2c66affSColin Finck     //
67*c2c66affSColin Finck     // Each parameter is actually an argument for the system call
68*c2c66affSColin Finck     //
69*c2c66affSColin Finck     #define _1 g[0x00]
70*c2c66affSColin Finck     #define _2 g[0x01]
71*c2c66affSColin Finck     #define _3 g[0x02]
72*c2c66affSColin Finck     #define _4 g[0x03]
73*c2c66affSColin Finck     #define _5 g[0x04]
74*c2c66affSColin Finck     #define _6 g[0x05]
75*c2c66affSColin Finck     #define _7 g[0x06]
76*c2c66affSColin Finck     #define _8 g[0x07]
77*c2c66affSColin Finck     #define _9 g[0x08]
78*c2c66affSColin Finck     #define a g[0x09]
79*c2c66affSColin Finck     #define b g[0x0A]
80*c2c66affSColin Finck     #define c g[0x0B]
81*c2c66affSColin Finck     #define d g[0x0C]
82*c2c66affSColin Finck     #define e g[0x0D]
83*c2c66affSColin Finck     #define f g[0x0E]
84*c2c66affSColin Finck     #define _10 g[0x0F]
85*c2c66affSColin Finck     #define _11 g[0x10]
86*c2c66affSColin Finck 
87*c2c66affSColin Finck     //
88*c2c66affSColin Finck     // And we generate the actual system call
89*c2c66affSColin Finck     //
90*c2c66affSColin Finck     #define SYSCALL(x, y)                        \
91*c2c66affSColin Finck         NTSTATUS                                 \
92*c2c66affSColin Finck         KiSyscall##x##Param(                     \
93*c2c66affSColin Finck             IN PVOID p,                          \
94*c2c66affSColin Finck             IN PVOID *g                          \
95*c2c66affSColin Finck         )                                        \
96*c2c66affSColin Finck         {                                        \
97*c2c66affSColin Finck             return ((PKI_SYSCALL_##x##PARAM)p)y; \
98*c2c66affSColin Finck         }
99*c2c66affSColin Finck 
100*c2c66affSColin Finck     //
101*c2c66affSColin Finck     // Cleanup for next run
102*c2c66affSColin Finck     //
103*c2c66affSColin Finck     #undef FUNC
104*c2c66affSColin Finck #endif
105