1/*
2 * IDENTIFICATION:
3 * stub generated by bootstrap_cmds-133
4 * OPTIONS:
5 * KernelUser
6 */
7#define __MIG_check__Reply__arcade_upcall_subsystem__ 1
8
9#include "arcade_upcall.h"
10
11/* TODO: #include <mach/mach.h> */
12#ifdef __cplusplus
13extern "C" {
14#endif /* __cplusplus */
15extern void mach_msg_destroy(mach_msg_header_t *);
16#ifdef __cplusplus
17}
18#endif /* __cplusplus */
19
20#ifndef mig_internal
21#define mig_internal static __inline__
22#endif /* mig_internal */
23
24#ifndef mig_external
25#define mig_external
26#endif /* mig_external */
27
28#if !defined(__MigTypeCheck) && defined(TypeCheck)
29#define __MigTypeCheck TypeCheck /* Legacy setting */
30#endif /* !defined(__MigTypeCheck) */
31
32#if !defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_)
33#define __MigKernelSpecificCode _MIG_KERNEL_SPECIFIC_CODE_ /* Legacy setting */
34#endif /* !defined(__MigKernelSpecificCode) */
35
36#ifndef LimitCheck
37#define LimitCheck 0
38#endif /* LimitCheck */
39
40#ifndef min
41#define min(a,b) ( ((a) < (b))? (a): (b) )
42#endif /* min */
43
44#if !defined(_WALIGN_)
45#define _WALIGN_(x) (((x) + 3) & ~3)
46#endif /* !defined(_WALIGN_) */
47
48#if !defined(_WALIGNSZ_)
49#define _WALIGNSZ_(x) _WALIGN_(sizeof(x))
50#endif /* !defined(_WALIGNSZ_) */
51
52#ifndef UseStaticTemplates
53#define UseStaticTemplates 0
54#endif /* UseStaticTemplates */
55
56#ifndef MIG_SERVER_ROUTINE
57#define MIG_SERVER_ROUTINE
58#endif
59
60#ifndef __MachMsgErrorWithTimeout
61#define __MachMsgErrorWithTimeout(_R_) { \
62 switch (_R_) { \
63 case MACH_SEND_INVALID_DATA: \
64 case MACH_SEND_INVALID_DEST: \
65 case MACH_SEND_INVALID_HEADER: \
66 mig_put_reply_port(InP->Head.msgh_reply_port); \
67 break; \
68 case MACH_SEND_TIMED_OUT: \
69 case MACH_RCV_TIMED_OUT: \
70 default: \
71 mig_dealloc_reply_port(InP->Head.msgh_reply_port); \
72 } \
73}
74#endif /* __MachMsgErrorWithTimeout */
75
76#ifndef __MachMsgErrorWithoutTimeout
77#define __MachMsgErrorWithoutTimeout(_R_) { \
78 switch (_R_) { \
79 case MACH_SEND_INVALID_DATA: \
80 case MACH_SEND_INVALID_DEST: \
81 case MACH_SEND_INVALID_HEADER: \
82 mig_put_reply_port(InP->Head.msgh_reply_port); \
83 break; \
84 default: \
85 mig_dealloc_reply_port(InP->Head.msgh_reply_port); \
86 } \
87}
88#endif /* __MachMsgErrorWithoutTimeout */
89
90#ifndef __DeclareSendRpc
91#define __DeclareSendRpc(_NUM_, _NAME_)
92#endif /* __DeclareSendRpc */
93
94#ifndef __BeforeSendRpc
95#define __BeforeSendRpc(_NUM_, _NAME_)
96#endif /* __BeforeSendRpc */
97
98#ifndef __AfterSendRpc
99#define __AfterSendRpc(_NUM_, _NAME_)
100#endif /* __AfterSendRpc */
101
102#ifndef __DeclareSendSimple
103#define __DeclareSendSimple(_NUM_, _NAME_)
104#endif /* __DeclareSendSimple */
105
106#ifndef __BeforeSendSimple
107#define __BeforeSendSimple(_NUM_, _NAME_)
108#endif /* __BeforeSendSimple */
109
110#ifndef __AfterSendSimple
111#define __AfterSendSimple(_NUM_, _NAME_)
112#endif /* __AfterSendSimple */
113
114#define msgh_request_port msgh_remote_port
115#define msgh_reply_port msgh_local_port
116
117
118
119#if ( __MigTypeCheck )
120#if __MIG_check__Reply__arcade_upcall_subsystem__
121#if !defined(__MIG_check__Reply__arcade_upcall_t__defined)
122#define __MIG_check__Reply__arcade_upcall_t__defined
123
124mig_internal kern_return_t __MIG_check__Reply__arcade_upcall_t(__Reply__arcade_upcall_t *Out0P)
125{
126
127 typedef __Reply__arcade_upcall_t __Reply __attribute__((unused));
128#if __MigTypeCheck
129 unsigned int msgh_size;
130#endif /* __MigTypeCheck */
131 if (Out0P->Head.msgh_id != 61571) {
132 if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE)
133 { return MIG_SERVER_DIED; }
134 else
135 { return MIG_REPLY_MISMATCH; }
136 }
137
138#if __MigTypeCheck
139 msgh_size = Out0P->Head.msgh_size;
140
141 if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
142 ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) &&
143 (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) ||
144 Out0P->RetCode == KERN_SUCCESS)))
145 { return MIG_TYPE_ERROR ; }
146#endif /* __MigTypeCheck */
147
148#if __MigTypeCheck
149 if (Out0P->Head.msgh_request_port != MACH_PORT_NULL) {
150 return MIG_TYPE_ERROR;
151 }
152#endif /* __MigTypeCheck */
153 if (Out0P->RetCode != KERN_SUCCESS) {
154 return ((mig_reply_error_t *)Out0P)->RetCode;
155 }
156
157 return MACH_MSG_SUCCESS;
158}
159#endif /* !defined(__MIG_check__Reply__arcade_upcall_t__defined) */
160#endif /* __MIG_check__Reply__arcade_upcall_subsystem__ */
161#endif /* ( __MigTypeCheck ) */
162
163
164/* Routine arcade_upcall */
165mig_external kern_return_t arcade_upcall
166(
167 mach_port_t arcade_upcall,
168 vm_offset_t path,
169 mach_msg_type_number_t pathCnt,
170 uint64_t offset,
171 boolean_t *should_kill
172)
173{
174
175#ifdef __MigPackStructs
176#pragma pack(push, 4)
177#endif
178 typedef struct {
179 mach_msg_header_t Head;
180 /* start of the kernel processed data */
181 mach_msg_body_t msgh_body;
182 mach_msg_ool_descriptor_t path;
183 /* end of the kernel processed data */
184 NDR_record_t NDR;
185 mach_msg_type_number_t pathCnt;
186 uint64_t offset;
187 } Request __attribute__((unused));
188#ifdef __MigPackStructs
189#pragma pack(pop)
190#endif
191
192#ifdef __MigPackStructs
193#pragma pack(push, 4)
194#endif
195 typedef struct {
196 mach_msg_header_t Head;
197 NDR_record_t NDR;
198 kern_return_t RetCode;
199 boolean_t should_kill;
200 mach_msg_trailer_t trailer;
201 } Reply __attribute__((unused));
202#ifdef __MigPackStructs
203#pragma pack(pop)
204#endif
205
206#ifdef __MigPackStructs
207#pragma pack(push, 4)
208#endif
209 typedef struct {
210 mach_msg_header_t Head;
211 NDR_record_t NDR;
212 kern_return_t RetCode;
213 boolean_t should_kill;
214 } __Reply __attribute__((unused));
215#ifdef __MigPackStructs
216#pragma pack(pop)
217#endif
218 /*
219 * typedef struct {
220 * mach_msg_header_t Head;
221 * NDR_record_t NDR;
222 * kern_return_t RetCode;
223 * } mig_reply_error_t;
224 */
225
226 union {
227 Request In;
228 Reply Out;
229 } Mess;
230
231 Request *InP = &Mess.In;
232 Reply *Out0P = &Mess.Out;
233
234 mach_msg_return_t msg_result;
235
236#ifdef __MIG_check__Reply__arcade_upcall_t__defined
237 kern_return_t check_result;
238#endif /* __MIG_check__Reply__arcade_upcall_t__defined */
239
240 __DeclareSendRpc(61471, "arcade_upcall")
241
242#if UseStaticTemplates
243 const static mach_msg_ool_descriptor_t pathTemplate = {
244 /* addr = */ (void *)0,
245 /* size = */ 0,
246 /* deal = */ FALSE,
247 /* copy = */ MACH_MSG_VIRTUAL_COPY,
248 /* pad2 = */ 0,
249 /* type = */ MACH_MSG_OOL_DESCRIPTOR,
250 };
251#endif /* UseStaticTemplates */
252
253 InP->msgh_body.msgh_descriptor_count = 1;
254#if UseStaticTemplates
255 InP->path = pathTemplate;
256 InP->path.address = (void *)(path);
257 InP->path.size = pathCnt;
258#else /* UseStaticTemplates */
259 InP->path.address = (void *)(path);
260 InP->path.size = pathCnt;
261 InP->path.deallocate = FALSE;
262 InP->path.copy = MACH_MSG_VIRTUAL_COPY;
263 InP->path.type = MACH_MSG_OOL_DESCRIPTOR;
264#endif /* UseStaticTemplates */
265
266 InP->NDR = NDR_record;
267
268 InP->pathCnt = pathCnt;
269
270 InP->offset = offset;
271
272 InP->Head.msgh_reply_port = mig_get_reply_port();
273 InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX|
274 MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
275 /* msgh_size passed as argument */
276 InP->Head.msgh_request_port = arcade_upcall;
277 InP->Head.msgh_id = 61471;
278 InP->Head.msgh_reserved = 0;
279
280 __BeforeSendRpc(61471, "arcade_upcall")
281#if (__MigKernelSpecificCode) || (_MIG_KERNELSPECIFIC_CODE_)
282 msg_result = mach_msg_rpc_from_kernel(msg: &InP->Head, send_size: (mach_msg_size_t)sizeof(Request), rcv_size: (mach_msg_size_t)sizeof(Reply));
283#else
284 msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
285#endif /* __MigKernelSpecificCode */
286 __AfterSendRpc(61471, "arcade_upcall")
287 if (msg_result != MACH_MSG_SUCCESS) {
288 __MachMsgErrorWithoutTimeout(msg_result);
289 }
290 if (msg_result != MACH_MSG_SUCCESS) {
291 { return msg_result; }
292 }
293
294
295#if defined(__MIG_check__Reply__arcade_upcall_t__defined)
296 check_result = __MIG_check__Reply__arcade_upcall_t(Out0P: (__Reply__arcade_upcall_t *)Out0P);
297 if (check_result != MACH_MSG_SUCCESS) {
298#if __MigKernelSpecificCode
299 mach_msg_destroy_from_kernel(msg: &Out0P->Head);
300#endif /* __MigKernelSpecificCode */
301 { return check_result; }
302 }
303#endif /* defined(__MIG_check__Reply__arcade_upcall_t__defined) */
304
305 *should_kill = Out0P->should_kill;
306
307 return KERN_SUCCESS;
308}
309