| 1 | /* |
| 2 | * IDENTIFICATION: |
| 3 | * stub generated by bootstrap_cmds-133 |
| 4 | * OPTIONS: |
| 5 | * KernelServer |
| 6 | */ |
| 7 | |
| 8 | /* Module arcade_register */ |
| 9 | |
| 10 | #define __MIG_check__Request__arcade_register_subsystem__ 1 |
| 11 | |
| 12 | #include "arcade_register_server.h" |
| 13 | |
| 14 | #ifndef mig_internal |
| 15 | #define mig_internal static __inline__ |
| 16 | #endif /* mig_internal */ |
| 17 | |
| 18 | #ifndef mig_external |
| 19 | #define mig_external |
| 20 | #endif /* mig_external */ |
| 21 | |
| 22 | #if !defined(__MigTypeCheck) && defined(TypeCheck) |
| 23 | #define __MigTypeCheck TypeCheck /* Legacy setting */ |
| 24 | #endif /* !defined(__MigTypeCheck) */ |
| 25 | |
| 26 | #if !defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_) |
| 27 | #define __MigKernelSpecificCode _MIG_KERNEL_SPECIFIC_CODE_ /* Legacy setting */ |
| 28 | #endif /* !defined(__MigKernelSpecificCode) */ |
| 29 | |
| 30 | #ifndef LimitCheck |
| 31 | #define LimitCheck 0 |
| 32 | #endif /* LimitCheck */ |
| 33 | |
| 34 | #ifndef min |
| 35 | #define min(a,b) ( ((a) < (b))? (a): (b) ) |
| 36 | #endif /* min */ |
| 37 | |
| 38 | #if !defined(_WALIGN_) |
| 39 | #define _WALIGN_(x) (((x) + 3) & ~3) |
| 40 | #endif /* !defined(_WALIGN_) */ |
| 41 | |
| 42 | #if !defined(_WALIGNSZ_) |
| 43 | #define _WALIGNSZ_(x) _WALIGN_(sizeof(x)) |
| 44 | #endif /* !defined(_WALIGNSZ_) */ |
| 45 | |
| 46 | #ifndef UseStaticTemplates |
| 47 | #define UseStaticTemplates 0 |
| 48 | #endif /* UseStaticTemplates */ |
| 49 | |
| 50 | #ifndef MIG_SERVER_ROUTINE |
| 51 | #define MIG_SERVER_ROUTINE |
| 52 | #endif |
| 53 | |
| 54 | #ifndef __DeclareRcvRpc |
| 55 | #define __DeclareRcvRpc(_NUM_, _NAME_) |
| 56 | #endif /* __DeclareRcvRpc */ |
| 57 | |
| 58 | #ifndef __BeforeRcvRpc |
| 59 | #define __BeforeRcvRpc(_NUM_, _NAME_) |
| 60 | #endif /* __BeforeRcvRpc */ |
| 61 | |
| 62 | #ifndef __AfterRcvRpc |
| 63 | #define __AfterRcvRpc(_NUM_, _NAME_) |
| 64 | #endif /* __AfterRcvRpc */ |
| 65 | |
| 66 | #ifndef __DeclareRcvSimple |
| 67 | #define __DeclareRcvSimple(_NUM_, _NAME_) |
| 68 | #endif /* __DeclareRcvSimple */ |
| 69 | |
| 70 | #ifndef __BeforeRcvSimple |
| 71 | #define __BeforeRcvSimple(_NUM_, _NAME_) |
| 72 | #endif /* __BeforeRcvSimple */ |
| 73 | |
| 74 | #ifndef __AfterRcvSimple |
| 75 | #define __AfterRcvSimple(_NUM_, _NAME_) |
| 76 | #endif /* __AfterRcvSimple */ |
| 77 | |
| 78 | #define novalue void |
| 79 | |
| 80 | #if __MigKernelSpecificCode |
| 81 | #define msgh_request_port msgh_remote_port |
| 82 | #define MACH_MSGH_BITS_REQUEST(bits) MACH_MSGH_BITS_REMOTE(bits) |
| 83 | #define msgh_reply_port msgh_local_port |
| 84 | #define MACH_MSGH_BITS_REPLY(bits) MACH_MSGH_BITS_LOCAL(bits) |
| 85 | #else |
| 86 | #define msgh_request_port msgh_local_port |
| 87 | #define MACH_MSGH_BITS_REQUEST(bits) MACH_MSGH_BITS_LOCAL(bits) |
| 88 | #define msgh_reply_port msgh_remote_port |
| 89 | #define MACH_MSGH_BITS_REPLY(bits) MACH_MSGH_BITS_REMOTE(bits) |
| 90 | #endif /* __MigKernelSpecificCode */ |
| 91 | |
| 92 | #define MIG_RETURN_ERROR(X, code) {\ |
| 93 | ((mig_reply_error_t *)X)->RetCode = code;\ |
| 94 | ((mig_reply_error_t *)X)->NDR = NDR_record;\ |
| 95 | return;\ |
| 96 | } |
| 97 | |
| 98 | /* Forward Declarations */ |
| 99 | |
| 100 | |
| 101 | mig_internal novalue _Xarcade_register_new_upcall |
| 102 | (mach_msg_header_t *InHeadP, void *InDataP, mach_msg_max_trailer_t *InTrailerP, mach_msg_header_t *OutHeadP, void *OutDataP); |
| 103 | |
| 104 | |
| 105 | #if ( __MigTypeCheck ) |
| 106 | #if __MIG_check__Request__arcade_register_subsystem__ |
| 107 | #if !defined(__MIG_check__Request__arcade_register_new_upcall_t__defined) |
| 108 | #define __MIG_check__Request__arcade_register_new_upcall_t__defined |
| 109 | |
| 110 | mig_internal kern_return_t __MIG_check__Request__arcade_register_new_upcall_t( |
| 111 | __attribute__((__unused__)) __RequestKData__arcade_register_new_upcall_t *InKP, |
| 112 | __attribute__((__unused__)) __RequestUData__arcade_register_new_upcall_t *In0UP, |
| 113 | __attribute__((__unused__)) mach_msg_max_trailer_t *InTrailerP) |
| 114 | { |
| 115 | |
| 116 | typedef __Request__arcade_register_new_upcall_t __Request; |
| 117 | typedef __RequestUData__arcade_register_new_upcall_t __RequestU __attribute__((unused)); |
| 118 | #if __MigTypeCheck |
| 119 | if (!(InKP->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || |
| 120 | (InKP->msgh_body.msgh_descriptor_count != 1) || |
| 121 | (InKP->Head.msgh_size != (mach_msg_size_t)sizeof(__Request))) |
| 122 | return MIG_BAD_ARGUMENTS; |
| 123 | #endif /* __MigTypeCheck */ |
| 124 | |
| 125 | #if __MigTypeCheck |
| 126 | if (InKP->arcade_upcall.type != MACH_MSG_PORT_DESCRIPTOR || |
| 127 | InKP->arcade_upcall.disposition != 17) |
| 128 | return MIG_TYPE_ERROR; |
| 129 | #endif /* __MigTypeCheck */ |
| 130 | |
| 131 | return MACH_MSG_SUCCESS; |
| 132 | } |
| 133 | #endif /* !defined(__MIG_check__Request__arcade_register_new_upcall_t__defined) */ |
| 134 | #endif /* __MIG_check__Request__arcade_register_subsystem__ */ |
| 135 | #endif /* ( __MigTypeCheck ) */ |
| 136 | |
| 137 | |
| 138 | /* Routine arcade_register_new_upcall */ |
| 139 | mig_internal novalue _Xarcade_register_new_upcall |
| 140 | (mach_msg_header_t *InHeadP, __attribute__((__unused__)) void *InDataP, |
| 141 | __attribute__((__unused__)) mach_msg_max_trailer_t *InTrailerP, |
| 142 | mach_msg_header_t *OutHeadP, __attribute__((__unused__)) void *OutDataP) |
| 143 | { |
| 144 | |
| 145 | #ifdef __MigPackStructs |
| 146 | #pragma pack(push, 4) |
| 147 | #endif |
| 148 | typedef struct { |
| 149 | mach_msg_trailer_t trailer; |
| 150 | char padding[0]; /* Avoid generating empty UData structs */ |
| 151 | } RequestU __attribute__((unused)); |
| 152 | #ifdef __MigPackStructs |
| 153 | #pragma pack(pop) |
| 154 | #endif |
| 155 | typedef __RequestKData__arcade_register_new_upcall_t RequestK; |
| 156 | typedef __RequestUData__arcade_register_new_upcall_t __RequestU; |
| 157 | typedef __ReplyKData__arcade_register_new_upcall_t ReplyK __attribute__((unused)); |
| 158 | typedef __ReplyUData__arcade_register_new_upcall_t ReplyU __attribute__((unused)); |
| 159 | typedef __Reply__arcade_register_new_upcall_t Reply __attribute__((unused)); |
| 160 | typedef __Request__arcade_register_new_upcall_t __Request __attribute__((unused)); |
| 161 | |
| 162 | /* |
| 163 | * typedef struct { |
| 164 | * mach_msg_header_t Head; |
| 165 | * NDR_record_t NDR; |
| 166 | * kern_return_t RetCode; |
| 167 | * } mig_reply_error_t; |
| 168 | */ |
| 169 | |
| 170 | RequestK *InKP = (RequestK *) InHeadP; |
| 171 | RequestU *In0UP = (RequestU *) InDataP; |
| 172 | ReplyK *OutKP = (ReplyK *) OutHeadP; |
| 173 | ReplyU *OutUP = (ReplyU *) OutDataP; |
| 174 | (void)OutUP; |
| 175 | #ifdef __MIG_check__Request__arcade_register_new_upcall_t__defined |
| 176 | kern_return_t check_result; |
| 177 | #endif /* __MIG_check__Request__arcade_register_new_upcall_t__defined */ |
| 178 | |
| 179 | #if __MigKernelSpecificCode |
| 180 | #else |
| 181 | #endif /* __MigKernelSpecificCode */ |
| 182 | __DeclareRcvRpc(51471, "arcade_register_new_upcall" ) |
| 183 | __BeforeRcvRpc(51471, "arcade_register_new_upcall" ) |
| 184 | |
| 185 | #if defined(__MIG_check__Request__arcade_register_new_upcall_t__defined) |
| 186 | check_result = __MIG_check__Request__arcade_register_new_upcall_t(InKP: (RequestK *)InKP, In0UP: (__RequestU *)In0UP, InTrailerP); |
| 187 | if (check_result != MACH_MSG_SUCCESS) |
| 188 | { MIG_RETURN_ERROR(OutKP, check_result); } |
| 189 | #endif /* defined(__MIG_check__Request__arcade_register_new_upcall_t__defined) */ |
| 190 | |
| 191 | OutUP->RetCode = arcade_register_new_upcall(arcade_register: convert_port_to_arcade_register(port: InKP->Head.msgh_request_port), arcade_upcall: InKP->arcade_upcall.name); |
| 192 | #if __MigKernelSpecificCode |
| 193 | #endif /* __MigKernelSpecificCode */ |
| 194 | |
| 195 | OutUP->NDR = NDR_record; |
| 196 | |
| 197 | |
| 198 | __AfterRcvRpc(51471, "arcade_register_new_upcall" ) |
| 199 | } |
| 200 | |
| 201 | |
| 202 | |
| 203 | /* Description of this kernel subsystem, for use in direct RPC */ |
| 204 | const struct arcade_register_subsystem arcade_register_subsystem = { |
| 205 | arcade_register_server_routine, |
| 206 | 51471, |
| 207 | 51472, |
| 208 | (mach_msg_size_t)sizeof(union __ReplyUnion__arcade_register_subsystem), |
| 209 | (vm_address_t)0, |
| 210 | { |
| 211 | { (mig_impl_routine_t) 0, |
| 212 | (mig_stub_kern_routine_t) _Xarcade_register_new_upcall, 2, 0, 0, (mach_msg_size_t)sizeof(__Reply__arcade_register_new_upcall_t)}, |
| 213 | } |
| 214 | }; |
| 215 | |
| 216 | mig_external boolean_t arcade_register_server |
| 217 | (mach_msg_header_t *InHeadP, void *InDataP, mach_msg_max_trailer_t *InTrailerP, mach_msg_header_t *OutHeadP, void *OutDataP) |
| 218 | { |
| 219 | /* |
| 220 | * typedef struct { |
| 221 | * mach_msg_header_t Head; |
| 222 | * NDR_record_t NDR; |
| 223 | * kern_return_t RetCode; |
| 224 | * } mig_reply_error_t; |
| 225 | */ |
| 226 | |
| 227 | mig_kern_routine_t routine; |
| 228 | |
| 229 | OutHeadP->msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InHeadP->msgh_bits), 0); |
| 230 | OutHeadP->msgh_remote_port = InHeadP->msgh_reply_port; |
| 231 | /* Minimal size: routine() will update it if different */ |
| 232 | OutHeadP->msgh_size = (mach_msg_size_t)sizeof(mig_reply_error_t); |
| 233 | OutHeadP->msgh_local_port = MACH_PORT_NULL; |
| 234 | OutHeadP->msgh_id = InHeadP->msgh_id + 100; |
| 235 | OutHeadP->msgh_reserved = 0; |
| 236 | |
| 237 | if ((InHeadP->msgh_id > 51471) || (InHeadP->msgh_id < 51471) || |
| 238 | ((routine = arcade_register_subsystem.kroutine[InHeadP->msgh_id - 51471].kstub_routine) == 0)) { |
| 239 | ((mig_reply_error_t *)OutHeadP)->NDR = NDR_record; |
| 240 | ((mig_reply_error_t *)OutHeadP)->RetCode = MIG_BAD_ID; |
| 241 | return FALSE; |
| 242 | } |
| 243 | (*routine) (InHeadP, InDataP, InTrailerP, OutHeadP, OutDataP); |
| 244 | return TRUE; |
| 245 | } |
| 246 | |
| 247 | mig_external mig_kern_routine_t arcade_register_server_routine |
| 248 | (mach_msg_header_t *InHeadP) |
| 249 | { |
| 250 | int msgh_id; |
| 251 | |
| 252 | msgh_id = InHeadP->msgh_id - 51471; |
| 253 | |
| 254 | if ((msgh_id > 0) || (msgh_id < 0)) |
| 255 | return 0; |
| 256 | |
| 257 | return arcade_register_subsystem.kroutine[msgh_id].kstub_routine; |
| 258 | } |
| 259 | |