1 | #ifndef _arcade_register_server_ |
2 | #define _arcade_register_server_ |
3 | |
4 | /* Module arcade_register */ |
5 | |
6 | #include <string.h> |
7 | #include <mach/ndr.h> |
8 | #include <mach/boolean.h> |
9 | #include <mach/kern_return.h> |
10 | #include <mach/notify.h> |
11 | #include <mach/mach_types.h> |
12 | #include <mach/message.h> |
13 | #include <mach/mig_errors.h> |
14 | #include <mach/port.h> |
15 | |
16 | /* BEGIN MIG_STRNCPY_ZEROFILL CODE */ |
17 | |
18 | #if defined(__has_include) |
19 | #if __has_include(<mach/mig_strncpy_zerofill_support.h>) |
20 | #ifndef USING_MIG_STRNCPY_ZEROFILL |
21 | #define USING_MIG_STRNCPY_ZEROFILL |
22 | #endif |
23 | #ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ |
24 | #define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ |
25 | #ifdef __cplusplus |
26 | extern "C" { |
27 | #endif |
28 | #ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_ATTR |
29 | #define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_COUNTEDBY_ATTR(C) __unsafe_indexable |
30 | #endif |
31 | extern int mig_strncpy_zerofill(char * dest, const char * src, int len) __attribute__((weak_import)); |
32 | #ifdef __cplusplus |
33 | } |
34 | #endif |
35 | #endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */ |
36 | #endif /* __has_include(<mach/mig_strncpy_zerofill_support.h>) */ |
37 | #endif /* __has_include */ |
38 | |
39 | /* END MIG_STRNCPY_ZEROFILL CODE */ |
40 | |
41 | |
42 | #ifdef AUTOTEST |
43 | #ifndef FUNCTION_PTR_T |
44 | #define FUNCTION_PTR_T |
45 | typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); |
46 | typedef struct { |
47 | char * name; |
48 | function_ptr_t function; |
49 | } function_table_entry; |
50 | typedef function_table_entry *function_table_t; |
51 | #endif /* FUNCTION_PTR_T */ |
52 | #endif /* AUTOTEST */ |
53 | |
54 | #ifndef arcade_register_MSG_COUNT |
55 | #define arcade_register_MSG_COUNT 1 |
56 | #endif /* arcade_register_MSG_COUNT */ |
57 | |
58 | #include <Availability.h> |
59 | #include <mach/std_types.h> |
60 | #include <mach/mig.h> |
61 | #include <ipc/ipc_voucher.h> |
62 | #include <kern/ipc_kobject.h> |
63 | #include <kern/ipc_tt.h> |
64 | #include <kern/ipc_host.h> |
65 | #include <kern/ledger.h> |
66 | #include <kern/processor.h> |
67 | #include <kern/sync_sema.h> |
68 | #include <ipc/ipc_eventlink.h> |
69 | #include <vm/memory_object.h> |
70 | #include <vm/vm_map.h> |
71 | #include <kern/arcade.h> |
72 | #include <kern/ipc_mig.h> |
73 | #include <kern/task_ident.h> |
74 | #include <kern/kern_cdata.h> |
75 | #include <mach/mig.h> |
76 | #include <mach/mach_types.h> |
77 | |
78 | #ifdef __BeforeMigServerHeader |
79 | __BeforeMigServerHeader |
80 | #endif /* __BeforeMigServerHeader */ |
81 | |
82 | #ifndef MIG_SERVER_ROUTINE |
83 | #define MIG_SERVER_ROUTINE |
84 | #endif |
85 | |
86 | |
87 | /* Routine arcade_register_new_upcall */ |
88 | #ifdef mig_external |
89 | mig_external |
90 | #else |
91 | extern |
92 | #endif /* mig_external */ |
93 | MIG_SERVER_ROUTINE |
94 | kern_return_t arcade_register_new_upcall |
95 | ( |
96 | arcade_register_t arcade_register, |
97 | mach_port_t arcade_upcall |
98 | ); |
99 | |
100 | #ifdef mig_external |
101 | mig_external |
102 | #else |
103 | extern |
104 | #endif /* mig_external */ |
105 | boolean_t arcade_register_server( |
106 | mach_msg_header_t *InHeadP, |
107 | void *InDataP, |
108 | mach_msg_max_trailer_t *InTrailerP, |
109 | mach_msg_header_t *OutHeadP, |
110 | void *OutDataP); |
111 | |
112 | #ifdef mig_external |
113 | mig_external |
114 | #else |
115 | extern |
116 | #endif /* mig_external */ |
117 | mig_kern_routine_t arcade_register_server_routine( |
118 | mach_msg_header_t *InHeadP); |
119 | |
120 | |
121 | /* Description of this kernel subsystem, for use in direct RPC */ |
122 | extern const struct arcade_register_subsystem { |
123 | mig_kern_server_routine_t kserver; /* Server routine */ |
124 | mach_msg_id_t start; /* Min routine number */ |
125 | mach_msg_id_t end; /* Max routine number + 1 */ |
126 | unsigned int maxsize; /* Max msg size */ |
127 | vm_address_t reserved; /* Reserved */ |
128 | struct kern_routine_descriptor /* Array of routine descriptors */ |
129 | kroutine[1]; |
130 | } arcade_register_subsystem; |
131 | |
132 | /* typedefs for all requests */ |
133 | |
134 | #ifndef __Request__arcade_register_subsystem__defined |
135 | #define __Request__arcade_register_subsystem__defined |
136 | |
137 | #ifdef __MigPackStructs |
138 | #pragma pack(push, 4) |
139 | #endif |
140 | typedef struct { |
141 | mach_msg_header_t Head; |
142 | /* start of the kernel processed data */ |
143 | mach_msg_body_t msgh_body; |
144 | mach_msg_port_descriptor_t arcade_upcall; |
145 | /* end of the kernel processed data */ |
146 | } __Request__arcade_register_new_upcall_t __attribute__((unused)); |
147 | #ifdef __MigPackStructs |
148 | #pragma pack(pop) |
149 | #endif |
150 | /* Struct for kernel processed data (Header + Descriptors) */ |
151 | #ifdef __MigPackStructs |
152 | #pragma pack(push, 4) |
153 | #endif |
154 | typedef struct { |
155 | mach_msg_header_t Head; |
156 | mach_msg_body_t msgh_body; |
157 | mach_msg_port_descriptor_t arcade_upcall; |
158 | } __RequestKData__arcade_register_new_upcall_t __attribute__((unused)); |
159 | #ifdef __MigPackStructs |
160 | #pragma pack(pop) |
161 | #endif |
162 | /* Struct for pure user data */ |
163 | #ifdef __MigPackStructs |
164 | #pragma pack(push, 4) |
165 | #endif |
166 | typedef struct { |
167 | char padding[0]; /* Avoid generating empty UData structs */ |
168 | } __RequestUData__arcade_register_new_upcall_t __attribute__((unused)); |
169 | #ifdef __MigPackStructs |
170 | #pragma pack(pop) |
171 | #endif |
172 | #endif /* !__Request__arcade_register_subsystem__defined */ |
173 | |
174 | |
175 | /* union of all requests */ |
176 | |
177 | #ifndef __RequestUnion__arcade_register_subsystem__defined |
178 | #define __RequestUnion__arcade_register_subsystem__defined |
179 | union __RequestUnion__arcade_register_subsystem { |
180 | __Request__arcade_register_new_upcall_t Request_arcade_register_new_upcall; |
181 | }; |
182 | #endif /* __RequestUnion__arcade_register_subsystem__defined */ |
183 | /* typedefs for all replies */ |
184 | |
185 | #ifndef __Reply__arcade_register_subsystem__defined |
186 | #define __Reply__arcade_register_subsystem__defined |
187 | |
188 | #ifdef __MigPackStructs |
189 | #pragma pack(push, 4) |
190 | #endif |
191 | typedef struct { |
192 | mach_msg_header_t Head; |
193 | NDR_record_t NDR; |
194 | kern_return_t RetCode; |
195 | } __Reply__arcade_register_new_upcall_t __attribute__((unused)); |
196 | #ifdef __MigPackStructs |
197 | #pragma pack(pop) |
198 | #endif |
199 | /* Struct for kernel processed data (Header + Descriptors) */ |
200 | #ifdef __MigPackStructs |
201 | #pragma pack(push, 4) |
202 | #endif |
203 | typedef struct { |
204 | mach_msg_header_t Head; |
205 | } __ReplyKData__arcade_register_new_upcall_t __attribute__((unused)); |
206 | #ifdef __MigPackStructs |
207 | #pragma pack(pop) |
208 | #endif |
209 | /* Struct for pure user data */ |
210 | #ifdef __MigPackStructs |
211 | #pragma pack(push, 4) |
212 | #endif |
213 | typedef struct { |
214 | NDR_record_t NDR; |
215 | kern_return_t RetCode; |
216 | char padding[0]; /* Avoid generating empty UData structs */ |
217 | } __ReplyUData__arcade_register_new_upcall_t __attribute__((unused)); |
218 | #ifdef __MigPackStructs |
219 | #pragma pack(pop) |
220 | #endif |
221 | #endif /* !__Reply__arcade_register_subsystem__defined */ |
222 | |
223 | |
224 | /* union of all replies */ |
225 | |
226 | #ifndef __ReplyUnion__arcade_register_subsystem__defined |
227 | #define __ReplyUnion__arcade_register_subsystem__defined |
228 | union __ReplyUnion__arcade_register_subsystem { |
229 | __Reply__arcade_register_new_upcall_t Reply_arcade_register_new_upcall; |
230 | }; |
231 | #endif /* __ReplyUnion__arcade_register_subsystem__defined */ |
232 | |
233 | #ifndef subsystem_to_name_map_arcade_register |
234 | #define subsystem_to_name_map_arcade_register \ |
235 | { "arcade_register_new_upcall", 51471 } |
236 | #endif |
237 | |
238 | #ifdef __AfterMigServerHeader |
239 | __AfterMigServerHeader |
240 | #endif /* __AfterMigServerHeader */ |
241 | |
242 | #endif /* _arcade_register_server_ */ |
243 | |