| 1 | /* |
| 2 | * IDENTIFICATION: |
| 3 | * stub generated by bootstrap_cmds-133 |
| 4 | * OPTIONS: |
| 5 | * KernelServer |
| 6 | */ |
| 7 | |
| 8 | /* Module upl */ |
| 9 | |
| 10 | #define __MIG_check__Request__upl_subsystem__ 1 |
| 11 | |
| 12 | #include "upl_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 _Xupl_abort |
| 102 | (mach_msg_header_t *InHeadP, void *InDataP, mach_msg_max_trailer_t *InTrailerP, mach_msg_header_t *OutHeadP, void *OutDataP); |
| 103 | |
| 104 | mig_internal novalue _Xupl_abort_range |
| 105 | (mach_msg_header_t *InHeadP, void *InDataP, mach_msg_max_trailer_t *InTrailerP, mach_msg_header_t *OutHeadP, void *OutDataP); |
| 106 | |
| 107 | mig_internal novalue _Xupl_commit |
| 108 | (mach_msg_header_t *InHeadP, void *InDataP, mach_msg_max_trailer_t *InTrailerP, mach_msg_header_t *OutHeadP, void *OutDataP); |
| 109 | |
| 110 | mig_internal novalue _Xupl_commit_range |
| 111 | (mach_msg_header_t *InHeadP, void *InDataP, mach_msg_max_trailer_t *InTrailerP, mach_msg_header_t *OutHeadP, void *OutDataP); |
| 112 | |
| 113 | |
| 114 | #if ( __MigTypeCheck ) |
| 115 | #if __MIG_check__Request__upl_subsystem__ |
| 116 | #if !defined(__MIG_check__Request__upl_abort_t__defined) |
| 117 | #define __MIG_check__Request__upl_abort_t__defined |
| 118 | |
| 119 | mig_internal kern_return_t __MIG_check__Request__upl_abort_t( |
| 120 | __attribute__((__unused__)) __RequestKData__upl_abort_t *InKP, |
| 121 | __attribute__((__unused__)) __RequestUData__upl_abort_t *In0UP, |
| 122 | __attribute__((__unused__)) mach_msg_max_trailer_t *InTrailerP) |
| 123 | { |
| 124 | |
| 125 | typedef __Request__upl_abort_t __Request; |
| 126 | typedef __RequestUData__upl_abort_t __RequestU __attribute__((unused)); |
| 127 | #if __MigTypeCheck |
| 128 | if ((InKP->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || |
| 129 | (InKP->Head.msgh_size != (mach_msg_size_t)sizeof(__Request))) |
| 130 | return MIG_BAD_ARGUMENTS; |
| 131 | #endif /* __MigTypeCheck */ |
| 132 | |
| 133 | return MACH_MSG_SUCCESS; |
| 134 | } |
| 135 | #endif /* !defined(__MIG_check__Request__upl_abort_t__defined) */ |
| 136 | #endif /* __MIG_check__Request__upl_subsystem__ */ |
| 137 | #endif /* ( __MigTypeCheck ) */ |
| 138 | |
| 139 | |
| 140 | /* Routine upl_abort */ |
| 141 | mig_internal novalue _Xupl_abort |
| 142 | (mach_msg_header_t *InHeadP, __attribute__((__unused__)) void *InDataP, |
| 143 | __attribute__((__unused__)) mach_msg_max_trailer_t *InTrailerP, |
| 144 | mach_msg_header_t *OutHeadP, __attribute__((__unused__)) void *OutDataP) |
| 145 | { |
| 146 | |
| 147 | #ifdef __MigPackStructs |
| 148 | #pragma pack(push, 4) |
| 149 | #endif |
| 150 | typedef struct { |
| 151 | NDR_record_t NDR; |
| 152 | integer_t abort_cond; |
| 153 | mach_msg_trailer_t trailer; |
| 154 | char padding[0]; /* Avoid generating empty UData structs */ |
| 155 | } RequestU __attribute__((unused)); |
| 156 | #ifdef __MigPackStructs |
| 157 | #pragma pack(pop) |
| 158 | #endif |
| 159 | typedef __RequestKData__upl_abort_t RequestK; |
| 160 | typedef __RequestUData__upl_abort_t __RequestU; |
| 161 | typedef __ReplyKData__upl_abort_t ReplyK __attribute__((unused)); |
| 162 | typedef __ReplyUData__upl_abort_t ReplyU __attribute__((unused)); |
| 163 | typedef __Reply__upl_abort_t Reply __attribute__((unused)); |
| 164 | typedef __Request__upl_abort_t __Request __attribute__((unused)); |
| 165 | |
| 166 | /* |
| 167 | * typedef struct { |
| 168 | * mach_msg_header_t Head; |
| 169 | * NDR_record_t NDR; |
| 170 | * kern_return_t RetCode; |
| 171 | * } mig_reply_error_t; |
| 172 | */ |
| 173 | |
| 174 | RequestK *InKP = (RequestK *) InHeadP; |
| 175 | RequestU *In0UP = (RequestU *) InDataP; |
| 176 | ReplyK *OutKP = (ReplyK *) OutHeadP; |
| 177 | ReplyU *OutUP = (ReplyU *) OutDataP; |
| 178 | (void)OutUP; |
| 179 | #ifdef __MIG_check__Request__upl_abort_t__defined |
| 180 | kern_return_t check_result; |
| 181 | #endif /* __MIG_check__Request__upl_abort_t__defined */ |
| 182 | |
| 183 | #if __MigKernelSpecificCode |
| 184 | #else |
| 185 | #endif /* __MigKernelSpecificCode */ |
| 186 | upl_t upl_object; |
| 187 | |
| 188 | __DeclareRcvRpc(2050, "upl_abort" ) |
| 189 | __BeforeRcvRpc(2050, "upl_abort" ) |
| 190 | |
| 191 | #if defined(__MIG_check__Request__upl_abort_t__defined) |
| 192 | check_result = __MIG_check__Request__upl_abort_t(InKP: (RequestK *)InKP, In0UP: (__RequestU *)In0UP, InTrailerP); |
| 193 | if (check_result != MACH_MSG_SUCCESS) |
| 194 | { MIG_RETURN_ERROR(OutKP, check_result); } |
| 195 | #endif /* defined(__MIG_check__Request__upl_abort_t__defined) */ |
| 196 | |
| 197 | upl_object = convert_port_to_upl(port: InKP->Head.msgh_request_port); |
| 198 | |
| 199 | OutUP->RetCode = upl_abort(upl_object, abort_cond: In0UP->abort_cond); |
| 200 | upl_deallocate(upl: upl_object); |
| 201 | #if __MigKernelSpecificCode |
| 202 | #endif /* __MigKernelSpecificCode */ |
| 203 | |
| 204 | OutUP->NDR = NDR_record; |
| 205 | |
| 206 | |
| 207 | __AfterRcvRpc(2050, "upl_abort" ) |
| 208 | } |
| 209 | |
| 210 | #if ( __MigTypeCheck ) |
| 211 | #if __MIG_check__Request__upl_subsystem__ |
| 212 | #if !defined(__MIG_check__Request__upl_abort_range_t__defined) |
| 213 | #define __MIG_check__Request__upl_abort_range_t__defined |
| 214 | |
| 215 | mig_internal kern_return_t __MIG_check__Request__upl_abort_range_t( |
| 216 | __attribute__((__unused__)) __RequestKData__upl_abort_range_t *InKP, |
| 217 | __attribute__((__unused__)) __RequestUData__upl_abort_range_t *In0UP, |
| 218 | __attribute__((__unused__)) mach_msg_max_trailer_t *InTrailerP) |
| 219 | { |
| 220 | |
| 221 | typedef __Request__upl_abort_range_t __Request; |
| 222 | typedef __RequestUData__upl_abort_range_t __RequestU __attribute__((unused)); |
| 223 | #if __MigTypeCheck |
| 224 | if ((InKP->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || |
| 225 | (InKP->Head.msgh_size != (mach_msg_size_t)sizeof(__Request))) |
| 226 | return MIG_BAD_ARGUMENTS; |
| 227 | #endif /* __MigTypeCheck */ |
| 228 | |
| 229 | return MACH_MSG_SUCCESS; |
| 230 | } |
| 231 | #endif /* !defined(__MIG_check__Request__upl_abort_range_t__defined) */ |
| 232 | #endif /* __MIG_check__Request__upl_subsystem__ */ |
| 233 | #endif /* ( __MigTypeCheck ) */ |
| 234 | |
| 235 | |
| 236 | /* Routine upl_abort_range */ |
| 237 | mig_internal novalue _Xupl_abort_range |
| 238 | (mach_msg_header_t *InHeadP, __attribute__((__unused__)) void *InDataP, |
| 239 | __attribute__((__unused__)) mach_msg_max_trailer_t *InTrailerP, |
| 240 | mach_msg_header_t *OutHeadP, __attribute__((__unused__)) void *OutDataP) |
| 241 | { |
| 242 | |
| 243 | #ifdef __MigPackStructs |
| 244 | #pragma pack(push, 4) |
| 245 | #endif |
| 246 | typedef struct { |
| 247 | NDR_record_t NDR; |
| 248 | upl_offset_t offset; |
| 249 | upl_size_t size; |
| 250 | integer_t abort_cond; |
| 251 | mach_msg_trailer_t trailer; |
| 252 | char padding[0]; /* Avoid generating empty UData structs */ |
| 253 | } RequestU __attribute__((unused)); |
| 254 | #ifdef __MigPackStructs |
| 255 | #pragma pack(pop) |
| 256 | #endif |
| 257 | typedef __RequestKData__upl_abort_range_t RequestK; |
| 258 | typedef __RequestUData__upl_abort_range_t __RequestU; |
| 259 | typedef __ReplyKData__upl_abort_range_t ReplyK __attribute__((unused)); |
| 260 | typedef __ReplyUData__upl_abort_range_t ReplyU __attribute__((unused)); |
| 261 | typedef __Reply__upl_abort_range_t Reply __attribute__((unused)); |
| 262 | typedef __Request__upl_abort_range_t __Request __attribute__((unused)); |
| 263 | |
| 264 | /* |
| 265 | * typedef struct { |
| 266 | * mach_msg_header_t Head; |
| 267 | * NDR_record_t NDR; |
| 268 | * kern_return_t RetCode; |
| 269 | * } mig_reply_error_t; |
| 270 | */ |
| 271 | |
| 272 | RequestK *InKP = (RequestK *) InHeadP; |
| 273 | RequestU *In0UP = (RequestU *) InDataP; |
| 274 | ReplyK *OutKP = (ReplyK *) OutHeadP; |
| 275 | ReplyU *OutUP = (ReplyU *) OutDataP; |
| 276 | (void)OutUP; |
| 277 | #ifdef __MIG_check__Request__upl_abort_range_t__defined |
| 278 | kern_return_t check_result; |
| 279 | #endif /* __MIG_check__Request__upl_abort_range_t__defined */ |
| 280 | |
| 281 | #if __MigKernelSpecificCode |
| 282 | #else |
| 283 | #endif /* __MigKernelSpecificCode */ |
| 284 | upl_t upl_object; |
| 285 | |
| 286 | __DeclareRcvRpc(2051, "upl_abort_range" ) |
| 287 | __BeforeRcvRpc(2051, "upl_abort_range" ) |
| 288 | |
| 289 | #if defined(__MIG_check__Request__upl_abort_range_t__defined) |
| 290 | check_result = __MIG_check__Request__upl_abort_range_t(InKP: (RequestK *)InKP, In0UP: (__RequestU *)In0UP, InTrailerP); |
| 291 | if (check_result != MACH_MSG_SUCCESS) |
| 292 | { MIG_RETURN_ERROR(OutKP, check_result); } |
| 293 | #endif /* defined(__MIG_check__Request__upl_abort_range_t__defined) */ |
| 294 | |
| 295 | upl_object = convert_port_to_upl(port: InKP->Head.msgh_request_port); |
| 296 | |
| 297 | OutUP->RetCode = upl_abort_range(upl_object, offset: In0UP->offset, size: In0UP->size, abort_cond: In0UP->abort_cond, empty: &OutUP->empty); |
| 298 | upl_deallocate(upl: upl_object); |
| 299 | if (OutUP->RetCode != KERN_SUCCESS) { |
| 300 | MIG_RETURN_ERROR(OutKP, OutUP->RetCode); |
| 301 | } |
| 302 | #if __MigKernelSpecificCode |
| 303 | #endif /* __MigKernelSpecificCode */ |
| 304 | |
| 305 | OutUP->NDR = NDR_record; |
| 306 | |
| 307 | |
| 308 | OutKP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply)); |
| 309 | __AfterRcvRpc(2051, "upl_abort_range" ) |
| 310 | } |
| 311 | |
| 312 | #if ( __MigTypeCheck ) |
| 313 | #if __MIG_check__Request__upl_subsystem__ |
| 314 | #if !defined(__MIG_check__Request__upl_commit_t__defined) |
| 315 | #define __MIG_check__Request__upl_commit_t__defined |
| 316 | |
| 317 | mig_internal kern_return_t __MIG_check__Request__upl_commit_t( |
| 318 | __attribute__((__unused__)) __RequestKData__upl_commit_t *InKP, |
| 319 | __attribute__((__unused__)) __RequestUData__upl_commit_t *In0UP, |
| 320 | __attribute__((__unused__)) mach_msg_max_trailer_t *InTrailerP) |
| 321 | { |
| 322 | |
| 323 | typedef __Request__upl_commit_t __Request; |
| 324 | typedef __RequestUData__upl_commit_t __RequestU __attribute__((unused)); |
| 325 | #if __MigTypeCheck |
| 326 | unsigned int msgh_size; |
| 327 | #endif /* __MigTypeCheck */ |
| 328 | |
| 329 | #if __MigTypeCheck |
| 330 | msgh_size = InKP->Head.msgh_size; |
| 331 | if ((InKP->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || |
| 332 | (msgh_size < (mach_msg_size_t)(sizeof(__Request) - 2048)) || (msgh_size > (mach_msg_size_t)sizeof(__Request))) |
| 333 | return MIG_BAD_ARGUMENTS; |
| 334 | #endif /* __MigTypeCheck */ |
| 335 | |
| 336 | #if defined(__NDR_convert__int_rep__Request__upl_commit_t__page_listCnt__defined) |
| 337 | if (In0UP->NDR.int_rep != NDR_record.int_rep) |
| 338 | __NDR_convert__int_rep__Request__upl_commit_t__page_listCnt(&In0UP->page_listCnt, In0UP->NDR.int_rep); |
| 339 | #endif /* __NDR_convert__int_rep__Request__upl_commit_t__page_listCnt__defined */ |
| 340 | #if __MigTypeCheck |
| 341 | if (In0UP->page_listCnt > 256) |
| 342 | return MIG_BAD_ARGUMENTS; |
| 343 | if (((msgh_size - (mach_msg_size_t)(sizeof(__Request) - 2048)) / 8 < In0UP->page_listCnt) || |
| 344 | (msgh_size != (mach_msg_size_t)(sizeof(__Request) - 2048) + (8 * In0UP->page_listCnt))) |
| 345 | return MIG_BAD_ARGUMENTS; |
| 346 | #endif /* __MigTypeCheck */ |
| 347 | |
| 348 | return MACH_MSG_SUCCESS; |
| 349 | } |
| 350 | #endif /* !defined(__MIG_check__Request__upl_commit_t__defined) */ |
| 351 | #endif /* __MIG_check__Request__upl_subsystem__ */ |
| 352 | #endif /* ( __MigTypeCheck ) */ |
| 353 | |
| 354 | |
| 355 | /* Routine upl_commit */ |
| 356 | mig_internal novalue _Xupl_commit |
| 357 | (mach_msg_header_t *InHeadP, __attribute__((__unused__)) void *InDataP, |
| 358 | __attribute__((__unused__)) mach_msg_max_trailer_t *InTrailerP, |
| 359 | mach_msg_header_t *OutHeadP, __attribute__((__unused__)) void *OutDataP) |
| 360 | { |
| 361 | |
| 362 | #ifdef __MigPackStructs |
| 363 | #pragma pack(push, 4) |
| 364 | #endif |
| 365 | typedef struct { |
| 366 | NDR_record_t NDR; |
| 367 | mach_msg_type_number_t page_listCnt; |
| 368 | upl_page_info_t page_list[256]; |
| 369 | mach_msg_trailer_t trailer; |
| 370 | char padding[0]; /* Avoid generating empty UData structs */ |
| 371 | } RequestU __attribute__((unused)); |
| 372 | #ifdef __MigPackStructs |
| 373 | #pragma pack(pop) |
| 374 | #endif |
| 375 | typedef __RequestKData__upl_commit_t RequestK; |
| 376 | typedef __RequestUData__upl_commit_t __RequestU; |
| 377 | typedef __ReplyKData__upl_commit_t ReplyK __attribute__((unused)); |
| 378 | typedef __ReplyUData__upl_commit_t ReplyU __attribute__((unused)); |
| 379 | typedef __Reply__upl_commit_t Reply __attribute__((unused)); |
| 380 | typedef __Request__upl_commit_t __Request __attribute__((unused)); |
| 381 | |
| 382 | /* |
| 383 | * typedef struct { |
| 384 | * mach_msg_header_t Head; |
| 385 | * NDR_record_t NDR; |
| 386 | * kern_return_t RetCode; |
| 387 | * } mig_reply_error_t; |
| 388 | */ |
| 389 | |
| 390 | RequestK *InKP = (RequestK *) InHeadP; |
| 391 | RequestU *In0UP = (RequestU *) InDataP; |
| 392 | ReplyK *OutKP = (ReplyK *) OutHeadP; |
| 393 | ReplyU *OutUP = (ReplyU *) OutDataP; |
| 394 | (void)OutUP; |
| 395 | #ifdef __MIG_check__Request__upl_commit_t__defined |
| 396 | kern_return_t check_result; |
| 397 | #endif /* __MIG_check__Request__upl_commit_t__defined */ |
| 398 | |
| 399 | #if __MigKernelSpecificCode |
| 400 | #else |
| 401 | #endif /* __MigKernelSpecificCode */ |
| 402 | upl_t upl_object; |
| 403 | |
| 404 | __DeclareRcvRpc(2052, "upl_commit" ) |
| 405 | __BeforeRcvRpc(2052, "upl_commit" ) |
| 406 | |
| 407 | #if defined(__MIG_check__Request__upl_commit_t__defined) |
| 408 | check_result = __MIG_check__Request__upl_commit_t(InKP: (RequestK *)InKP, In0UP: (__RequestU *)In0UP, InTrailerP); |
| 409 | if (check_result != MACH_MSG_SUCCESS) |
| 410 | { MIG_RETURN_ERROR(OutKP, check_result); } |
| 411 | #endif /* defined(__MIG_check__Request__upl_commit_t__defined) */ |
| 412 | |
| 413 | upl_object = convert_port_to_upl(port: InKP->Head.msgh_request_port); |
| 414 | |
| 415 | OutUP->RetCode = upl_commit(upl_object, page_list: In0UP->page_list, page_listCnt: In0UP->page_listCnt); |
| 416 | upl_deallocate(upl: upl_object); |
| 417 | #if __MigKernelSpecificCode |
| 418 | #endif /* __MigKernelSpecificCode */ |
| 419 | |
| 420 | OutUP->NDR = NDR_record; |
| 421 | |
| 422 | |
| 423 | __AfterRcvRpc(2052, "upl_commit" ) |
| 424 | } |
| 425 | |
| 426 | #if ( __MigTypeCheck ) |
| 427 | #if __MIG_check__Request__upl_subsystem__ |
| 428 | #if !defined(__MIG_check__Request__upl_commit_range_t__defined) |
| 429 | #define __MIG_check__Request__upl_commit_range_t__defined |
| 430 | |
| 431 | mig_internal kern_return_t __MIG_check__Request__upl_commit_range_t( |
| 432 | __attribute__((__unused__)) __RequestKData__upl_commit_range_t *InKP, |
| 433 | __attribute__((__unused__)) __RequestUData__upl_commit_range_t *In0UP, |
| 434 | __attribute__((__unused__)) mach_msg_max_trailer_t *InTrailerP) |
| 435 | { |
| 436 | |
| 437 | typedef __Request__upl_commit_range_t __Request; |
| 438 | typedef __RequestUData__upl_commit_range_t __RequestU __attribute__((unused)); |
| 439 | #if __MigTypeCheck |
| 440 | unsigned int msgh_size; |
| 441 | #endif /* __MigTypeCheck */ |
| 442 | |
| 443 | #if __MigTypeCheck |
| 444 | msgh_size = InKP->Head.msgh_size; |
| 445 | if ((InKP->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || |
| 446 | (msgh_size < (mach_msg_size_t)(sizeof(__Request) - 2048)) || (msgh_size > (mach_msg_size_t)sizeof(__Request))) |
| 447 | return MIG_BAD_ARGUMENTS; |
| 448 | #endif /* __MigTypeCheck */ |
| 449 | |
| 450 | #if defined(__NDR_convert__int_rep__Request__upl_commit_range_t__page_listCnt__defined) |
| 451 | if (In0UP->NDR.int_rep != NDR_record.int_rep) |
| 452 | __NDR_convert__int_rep__Request__upl_commit_range_t__page_listCnt(&In0UP->page_listCnt, In0UP->NDR.int_rep); |
| 453 | #endif /* __NDR_convert__int_rep__Request__upl_commit_range_t__page_listCnt__defined */ |
| 454 | #if __MigTypeCheck |
| 455 | if (In0UP->page_listCnt > 256) |
| 456 | return MIG_BAD_ARGUMENTS; |
| 457 | if (((msgh_size - (mach_msg_size_t)(sizeof(__Request) - 2048)) / 8 < In0UP->page_listCnt) || |
| 458 | (msgh_size != (mach_msg_size_t)(sizeof(__Request) - 2048) + (8 * In0UP->page_listCnt))) |
| 459 | return MIG_BAD_ARGUMENTS; |
| 460 | #endif /* __MigTypeCheck */ |
| 461 | |
| 462 | return MACH_MSG_SUCCESS; |
| 463 | } |
| 464 | #endif /* !defined(__MIG_check__Request__upl_commit_range_t__defined) */ |
| 465 | #endif /* __MIG_check__Request__upl_subsystem__ */ |
| 466 | #endif /* ( __MigTypeCheck ) */ |
| 467 | |
| 468 | |
| 469 | /* Routine upl_commit_range */ |
| 470 | mig_internal novalue _Xupl_commit_range |
| 471 | (mach_msg_header_t *InHeadP, __attribute__((__unused__)) void *InDataP, |
| 472 | __attribute__((__unused__)) mach_msg_max_trailer_t *InTrailerP, |
| 473 | mach_msg_header_t *OutHeadP, __attribute__((__unused__)) void *OutDataP) |
| 474 | { |
| 475 | |
| 476 | #ifdef __MigPackStructs |
| 477 | #pragma pack(push, 4) |
| 478 | #endif |
| 479 | typedef struct { |
| 480 | NDR_record_t NDR; |
| 481 | upl_offset_t offset; |
| 482 | upl_size_t size; |
| 483 | integer_t cntrl_flags; |
| 484 | mach_msg_type_number_t page_listCnt; |
| 485 | upl_page_info_t page_list[256]; |
| 486 | mach_msg_trailer_t trailer; |
| 487 | char padding[0]; /* Avoid generating empty UData structs */ |
| 488 | } RequestU __attribute__((unused)); |
| 489 | #ifdef __MigPackStructs |
| 490 | #pragma pack(pop) |
| 491 | #endif |
| 492 | typedef __RequestKData__upl_commit_range_t RequestK; |
| 493 | typedef __RequestUData__upl_commit_range_t __RequestU; |
| 494 | typedef __ReplyKData__upl_commit_range_t ReplyK __attribute__((unused)); |
| 495 | typedef __ReplyUData__upl_commit_range_t ReplyU __attribute__((unused)); |
| 496 | typedef __Reply__upl_commit_range_t Reply __attribute__((unused)); |
| 497 | typedef __Request__upl_commit_range_t __Request __attribute__((unused)); |
| 498 | |
| 499 | /* |
| 500 | * typedef struct { |
| 501 | * mach_msg_header_t Head; |
| 502 | * NDR_record_t NDR; |
| 503 | * kern_return_t RetCode; |
| 504 | * } mig_reply_error_t; |
| 505 | */ |
| 506 | |
| 507 | RequestK *InKP = (RequestK *) InHeadP; |
| 508 | RequestU *In0UP = (RequestU *) InDataP; |
| 509 | ReplyK *OutKP = (ReplyK *) OutHeadP; |
| 510 | ReplyU *OutUP = (ReplyU *) OutDataP; |
| 511 | (void)OutUP; |
| 512 | #ifdef __MIG_check__Request__upl_commit_range_t__defined |
| 513 | kern_return_t check_result; |
| 514 | #endif /* __MIG_check__Request__upl_commit_range_t__defined */ |
| 515 | |
| 516 | #if __MigKernelSpecificCode |
| 517 | #else |
| 518 | #endif /* __MigKernelSpecificCode */ |
| 519 | upl_t upl_object; |
| 520 | |
| 521 | __DeclareRcvRpc(2053, "upl_commit_range" ) |
| 522 | __BeforeRcvRpc(2053, "upl_commit_range" ) |
| 523 | |
| 524 | #if defined(__MIG_check__Request__upl_commit_range_t__defined) |
| 525 | check_result = __MIG_check__Request__upl_commit_range_t(InKP: (RequestK *)InKP, In0UP: (__RequestU *)In0UP, InTrailerP); |
| 526 | if (check_result != MACH_MSG_SUCCESS) |
| 527 | { MIG_RETURN_ERROR(OutKP, check_result); } |
| 528 | #endif /* defined(__MIG_check__Request__upl_commit_range_t__defined) */ |
| 529 | |
| 530 | upl_object = convert_port_to_upl(port: InKP->Head.msgh_request_port); |
| 531 | |
| 532 | OutUP->RetCode = upl_commit_range(upl_object, offset: In0UP->offset, size: In0UP->size, cntrl_flags: In0UP->cntrl_flags, page_list: In0UP->page_list, page_listCnt: In0UP->page_listCnt, empty: &OutUP->empty); |
| 533 | upl_deallocate(upl: upl_object); |
| 534 | if (OutUP->RetCode != KERN_SUCCESS) { |
| 535 | MIG_RETURN_ERROR(OutKP, OutUP->RetCode); |
| 536 | } |
| 537 | #if __MigKernelSpecificCode |
| 538 | #endif /* __MigKernelSpecificCode */ |
| 539 | |
| 540 | OutUP->NDR = NDR_record; |
| 541 | |
| 542 | |
| 543 | OutKP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply)); |
| 544 | __AfterRcvRpc(2053, "upl_commit_range" ) |
| 545 | } |
| 546 | |
| 547 | |
| 548 | |
| 549 | /* Description of this kernel subsystem, for use in direct RPC */ |
| 550 | const struct upl_subsystem upl_subsystem = { |
| 551 | upl_server_routine, |
| 552 | 2050, |
| 553 | 2054, |
| 554 | (mach_msg_size_t)sizeof(union __ReplyUnion__upl_subsystem), |
| 555 | (vm_address_t)0, |
| 556 | { |
| 557 | { (mig_impl_routine_t) 0, |
| 558 | (mig_stub_kern_routine_t) _Xupl_abort, 2, 0, 0, (mach_msg_size_t)sizeof(__Reply__upl_abort_t)}, |
| 559 | { .impl_routine: (mig_impl_routine_t) 0, |
| 560 | .kstub_routine: (mig_stub_kern_routine_t) _Xupl_abort_range, .argc: 5, .descr_count: 0, .reply_descr_count: 0, .max_reply_msg: (mach_msg_size_t)sizeof(__Reply__upl_abort_range_t)}, |
| 561 | { .impl_routine: (mig_impl_routine_t) 0, |
| 562 | .kstub_routine: (mig_stub_kern_routine_t) _Xupl_commit, .argc: 3, .descr_count: 0, .reply_descr_count: 0, .max_reply_msg: (mach_msg_size_t)sizeof(__Reply__upl_commit_t)}, |
| 563 | { .impl_routine: (mig_impl_routine_t) 0, |
| 564 | .kstub_routine: (mig_stub_kern_routine_t) _Xupl_commit_range, .argc: 7, .descr_count: 0, .reply_descr_count: 0, .max_reply_msg: (mach_msg_size_t)sizeof(__Reply__upl_commit_range_t)}, |
| 565 | } |
| 566 | }; |
| 567 | |
| 568 | mig_external boolean_t upl_server |
| 569 | (mach_msg_header_t *InHeadP, void *InDataP, mach_msg_max_trailer_t *InTrailerP, mach_msg_header_t *OutHeadP, void *OutDataP) |
| 570 | { |
| 571 | /* |
| 572 | * typedef struct { |
| 573 | * mach_msg_header_t Head; |
| 574 | * NDR_record_t NDR; |
| 575 | * kern_return_t RetCode; |
| 576 | * } mig_reply_error_t; |
| 577 | */ |
| 578 | |
| 579 | mig_kern_routine_t routine; |
| 580 | |
| 581 | OutHeadP->msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InHeadP->msgh_bits), 0); |
| 582 | OutHeadP->msgh_remote_port = InHeadP->msgh_reply_port; |
| 583 | /* Minimal size: routine() will update it if different */ |
| 584 | OutHeadP->msgh_size = (mach_msg_size_t)sizeof(mig_reply_error_t); |
| 585 | OutHeadP->msgh_local_port = MACH_PORT_NULL; |
| 586 | OutHeadP->msgh_id = InHeadP->msgh_id + 100; |
| 587 | OutHeadP->msgh_reserved = 0; |
| 588 | |
| 589 | if ((InHeadP->msgh_id > 2053) || (InHeadP->msgh_id < 2050) || |
| 590 | ((routine = upl_subsystem.kroutine[InHeadP->msgh_id - 2050].kstub_routine) == 0)) { |
| 591 | ((mig_reply_error_t *)OutHeadP)->NDR = NDR_record; |
| 592 | ((mig_reply_error_t *)OutHeadP)->RetCode = MIG_BAD_ID; |
| 593 | return FALSE; |
| 594 | } |
| 595 | (*routine) (InHeadP, InDataP, InTrailerP, OutHeadP, OutDataP); |
| 596 | return TRUE; |
| 597 | } |
| 598 | |
| 599 | mig_external mig_kern_routine_t upl_server_routine |
| 600 | (mach_msg_header_t *InHeadP) |
| 601 | { |
| 602 | int msgh_id; |
| 603 | |
| 604 | msgh_id = InHeadP->msgh_id - 2050; |
| 605 | |
| 606 | if ((msgh_id > 3) || (msgh_id < 0)) |
| 607 | return 0; |
| 608 | |
| 609 | return upl_subsystem.kroutine[msgh_id].kstub_routine; |
| 610 | } |
| 611 | |