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