| 1 | /* iig(DriverKit-286 Mar 29 2024 10:27:09) generated from IOInterruptDispatchSource.iig */ |
| 2 | |
| 3 | #undef IIG_IMPLEMENTATION |
| 4 | #define IIG_IMPLEMENTATION IOInterruptDispatchSource.iig |
| 5 | |
| 6 | #if KERNEL |
| 7 | #include <libkern/c++/OSString.h> |
| 8 | #else |
| 9 | #include <DriverKit/DriverKit.h> |
| 10 | #endif /* KERNEL */ |
| 11 | #include <DriverKit/IOReturn.h> |
| 12 | #include <DriverKit/IOInterruptDispatchSource.h> |
| 13 | |
| 14 | |
| 15 | #if __has_builtin(__builtin_load_member_function_pointer) |
| 16 | #define SimpleMemberFunctionCast(cfnty, self, func) (cfnty)__builtin_load_member_function_pointer(self, func) |
| 17 | #else |
| 18 | #define SimpleMemberFunctionCast(cfnty, self, func) ({ union { typeof(func) memfun; cfnty cfun; } pair; pair.memfun = func; pair.cfun; }) |
| 19 | #endif |
| 20 | |
| 21 | |
| 22 | struct IOInterruptDispatchSource_Create_Msg_Content |
| 23 | { |
| 24 | IORPCMessage __hdr; |
| 25 | OSObjectRef __object; |
| 26 | OSObjectRef provider; |
| 27 | OSObjectRef queue; |
| 28 | uint32_t index; |
| 29 | }; |
| 30 | #pragma pack(4) |
| 31 | struct IOInterruptDispatchSource_Create_Msg |
| 32 | { |
| 33 | IORPCMessageMach mach; |
| 34 | mach_msg_port_descriptor_t __object__descriptor; |
| 35 | mach_msg_port_descriptor_t provider__descriptor; |
| 36 | mach_msg_port_descriptor_t queue__descriptor; |
| 37 | IOInterruptDispatchSource_Create_Msg_Content content; |
| 38 | }; |
| 39 | #pragma pack() |
| 40 | #define IOInterruptDispatchSource_Create_Msg_ObjRefs (3) |
| 41 | |
| 42 | struct IOInterruptDispatchSource_Create_Rpl_Content |
| 43 | { |
| 44 | IORPCMessage __hdr; |
| 45 | OSObjectRef source; |
| 46 | }; |
| 47 | #pragma pack(4) |
| 48 | struct IOInterruptDispatchSource_Create_Rpl |
| 49 | { |
| 50 | IORPCMessageMach mach; |
| 51 | mach_msg_port_descriptor_t source__descriptor; |
| 52 | IOInterruptDispatchSource_Create_Rpl_Content content; |
| 53 | }; |
| 54 | #pragma pack() |
| 55 | #define IOInterruptDispatchSource_Create_Rpl_ObjRefs (1) |
| 56 | |
| 57 | |
| 58 | typedef union |
| 59 | { |
| 60 | const IORPC rpc; |
| 61 | struct |
| 62 | { |
| 63 | const struct IOInterruptDispatchSource_Create_Msg * message; |
| 64 | struct IOInterruptDispatchSource_Create_Rpl * reply; |
| 65 | uint32_t sendSize; |
| 66 | uint32_t replySize; |
| 67 | }; |
| 68 | } |
| 69 | IOInterruptDispatchSource_Create_Invocation; |
| 70 | struct IOInterruptDispatchSource_GetInterruptType_Msg_Content |
| 71 | { |
| 72 | IORPCMessage __hdr; |
| 73 | OSObjectRef __object; |
| 74 | OSObjectRef provider; |
| 75 | uint32_t index; |
| 76 | }; |
| 77 | #pragma pack(4) |
| 78 | struct IOInterruptDispatchSource_GetInterruptType_Msg |
| 79 | { |
| 80 | IORPCMessageMach mach; |
| 81 | mach_msg_port_descriptor_t __object__descriptor; |
| 82 | mach_msg_port_descriptor_t provider__descriptor; |
| 83 | IOInterruptDispatchSource_GetInterruptType_Msg_Content content; |
| 84 | }; |
| 85 | #pragma pack() |
| 86 | #define IOInterruptDispatchSource_GetInterruptType_Msg_ObjRefs (2) |
| 87 | |
| 88 | struct IOInterruptDispatchSource_GetInterruptType_Rpl_Content |
| 89 | { |
| 90 | IORPCMessage __hdr; |
| 91 | unsigned long long interruptType; |
| 92 | }; |
| 93 | #pragma pack(4) |
| 94 | struct IOInterruptDispatchSource_GetInterruptType_Rpl |
| 95 | { |
| 96 | IORPCMessageMach mach; |
| 97 | IOInterruptDispatchSource_GetInterruptType_Rpl_Content content; |
| 98 | }; |
| 99 | #pragma pack() |
| 100 | #define IOInterruptDispatchSource_GetInterruptType_Rpl_ObjRefs (0) |
| 101 | |
| 102 | |
| 103 | typedef union |
| 104 | { |
| 105 | const IORPC rpc; |
| 106 | struct |
| 107 | { |
| 108 | const struct IOInterruptDispatchSource_GetInterruptType_Msg * message; |
| 109 | struct IOInterruptDispatchSource_GetInterruptType_Rpl * reply; |
| 110 | uint32_t sendSize; |
| 111 | uint32_t replySize; |
| 112 | }; |
| 113 | } |
| 114 | IOInterruptDispatchSource_GetInterruptType_Invocation; |
| 115 | struct IOInterruptDispatchSource_SetHandler_Msg_Content |
| 116 | { |
| 117 | IORPCMessage __hdr; |
| 118 | OSObjectRef __object; |
| 119 | OSObjectRef action; |
| 120 | }; |
| 121 | #pragma pack(4) |
| 122 | struct IOInterruptDispatchSource_SetHandler_Msg |
| 123 | { |
| 124 | IORPCMessageMach mach; |
| 125 | mach_msg_port_descriptor_t __object__descriptor; |
| 126 | mach_msg_port_descriptor_t action__descriptor; |
| 127 | IOInterruptDispatchSource_SetHandler_Msg_Content content; |
| 128 | }; |
| 129 | #pragma pack() |
| 130 | #define IOInterruptDispatchSource_SetHandler_Msg_ObjRefs (2) |
| 131 | |
| 132 | struct IOInterruptDispatchSource_SetHandler_Rpl_Content |
| 133 | { |
| 134 | IORPCMessage __hdr; |
| 135 | }; |
| 136 | #pragma pack(4) |
| 137 | struct IOInterruptDispatchSource_SetHandler_Rpl |
| 138 | { |
| 139 | IORPCMessageMach mach; |
| 140 | IOInterruptDispatchSource_SetHandler_Rpl_Content content; |
| 141 | }; |
| 142 | #pragma pack() |
| 143 | #define IOInterruptDispatchSource_SetHandler_Rpl_ObjRefs (0) |
| 144 | |
| 145 | |
| 146 | typedef union |
| 147 | { |
| 148 | const IORPC rpc; |
| 149 | struct |
| 150 | { |
| 151 | const struct IOInterruptDispatchSource_SetHandler_Msg * message; |
| 152 | struct IOInterruptDispatchSource_SetHandler_Rpl * reply; |
| 153 | uint32_t sendSize; |
| 154 | uint32_t replySize; |
| 155 | }; |
| 156 | } |
| 157 | IOInterruptDispatchSource_SetHandler_Invocation; |
| 158 | struct IOInterruptDispatchSource_GetLastInterrupt_Msg_Content |
| 159 | { |
| 160 | IORPCMessage __hdr; |
| 161 | OSObjectRef __object; |
| 162 | }; |
| 163 | #pragma pack(4) |
| 164 | struct IOInterruptDispatchSource_GetLastInterrupt_Msg |
| 165 | { |
| 166 | IORPCMessageMach mach; |
| 167 | mach_msg_port_descriptor_t __object__descriptor; |
| 168 | IOInterruptDispatchSource_GetLastInterrupt_Msg_Content content; |
| 169 | }; |
| 170 | #pragma pack() |
| 171 | #define IOInterruptDispatchSource_GetLastInterrupt_Msg_ObjRefs (1) |
| 172 | |
| 173 | struct IOInterruptDispatchSource_GetLastInterrupt_Rpl_Content |
| 174 | { |
| 175 | IORPCMessage __hdr; |
| 176 | unsigned long long count; |
| 177 | unsigned long long time; |
| 178 | }; |
| 179 | #pragma pack(4) |
| 180 | struct IOInterruptDispatchSource_GetLastInterrupt_Rpl |
| 181 | { |
| 182 | IORPCMessageMach mach; |
| 183 | IOInterruptDispatchSource_GetLastInterrupt_Rpl_Content content; |
| 184 | }; |
| 185 | #pragma pack() |
| 186 | #define IOInterruptDispatchSource_GetLastInterrupt_Rpl_ObjRefs (0) |
| 187 | |
| 188 | |
| 189 | typedef union |
| 190 | { |
| 191 | const IORPC rpc; |
| 192 | struct |
| 193 | { |
| 194 | const struct IOInterruptDispatchSource_GetLastInterrupt_Msg * message; |
| 195 | struct IOInterruptDispatchSource_GetLastInterrupt_Rpl * reply; |
| 196 | uint32_t sendSize; |
| 197 | uint32_t replySize; |
| 198 | }; |
| 199 | } |
| 200 | IOInterruptDispatchSource_GetLastInterrupt_Invocation; |
| 201 | struct IOInterruptDispatchSource_InterruptOccurred_Msg_Content |
| 202 | { |
| 203 | IORPCMessage __hdr; |
| 204 | OSObjectRef __object; |
| 205 | OSObjectRef action; |
| 206 | uint64_t count; |
| 207 | uint64_t time; |
| 208 | }; |
| 209 | #pragma pack(4) |
| 210 | struct IOInterruptDispatchSource_InterruptOccurred_Msg |
| 211 | { |
| 212 | IORPCMessageMach mach; |
| 213 | mach_msg_port_descriptor_t __object__descriptor; |
| 214 | mach_msg_port_descriptor_t action__descriptor; |
| 215 | IOInterruptDispatchSource_InterruptOccurred_Msg_Content content; |
| 216 | }; |
| 217 | #pragma pack() |
| 218 | #define IOInterruptDispatchSource_InterruptOccurred_Msg_ObjRefs (2) |
| 219 | |
| 220 | struct IOInterruptDispatchSource_InterruptOccurred_Rpl_Content |
| 221 | { |
| 222 | IORPCMessage __hdr; |
| 223 | }; |
| 224 | #pragma pack(4) |
| 225 | struct IOInterruptDispatchSource_InterruptOccurred_Rpl |
| 226 | { |
| 227 | IORPCMessageMach mach; |
| 228 | IOInterruptDispatchSource_InterruptOccurred_Rpl_Content content; |
| 229 | }; |
| 230 | #pragma pack() |
| 231 | #define IOInterruptDispatchSource_InterruptOccurred_Rpl_ObjRefs (0) |
| 232 | |
| 233 | |
| 234 | typedef union |
| 235 | { |
| 236 | const IORPC rpc; |
| 237 | struct |
| 238 | { |
| 239 | const struct IOInterruptDispatchSource_InterruptOccurred_Msg * message; |
| 240 | struct IOInterruptDispatchSource_InterruptOccurred_Rpl * reply; |
| 241 | uint32_t sendSize; |
| 242 | uint32_t replySize; |
| 243 | }; |
| 244 | } |
| 245 | IOInterruptDispatchSource_InterruptOccurred_Invocation; |
| 246 | #if !KERNEL |
| 247 | extern OSMetaClass * gOSContainerMetaClass; |
| 248 | extern OSMetaClass * gOSDataMetaClass; |
| 249 | extern OSMetaClass * gOSNumberMetaClass; |
| 250 | extern OSMetaClass * gOSBooleanMetaClass; |
| 251 | extern OSMetaClass * gOSDictionaryMetaClass; |
| 252 | extern OSMetaClass * gOSArrayMetaClass; |
| 253 | extern OSMetaClass * gOSSetMetaClass; |
| 254 | extern OSMetaClass * gOSOrderedSetMetaClass; |
| 255 | extern OSMetaClass * gOSStringMetaClass; |
| 256 | extern OSMetaClass * gIOMemoryDescriptorMetaClass; |
| 257 | extern OSMetaClass * gIOBufferMemoryDescriptorMetaClass; |
| 258 | extern OSMetaClass * gIOUserClientMetaClass; |
| 259 | extern OSMetaClass * gIOServiceStateNotificationDispatchSourceMetaClass; |
| 260 | #endif /* !KERNEL */ |
| 261 | |
| 262 | #if KERNEL |
| 263 | OSDefineMetaClassAndStructors(IOInterruptDispatchSource, IODispatchSource); |
| 264 | #endif /* KERNEL */ |
| 265 | |
| 266 | #if !KERNEL |
| 267 | |
| 268 | #define IOInterruptDispatchSource_QueueNames "" |
| 269 | |
| 270 | #define IOInterruptDispatchSource_MethodNames "" |
| 271 | |
| 272 | #define IOInterruptDispatchSourceMetaClass_MethodNames "" |
| 273 | |
| 274 | struct OSClassDescription_IOInterruptDispatchSource_t |
| 275 | { |
| 276 | OSClassDescription base; |
| 277 | uint64_t methodOptions[2 * 0]; |
| 278 | uint64_t metaMethodOptions[2 * 0]; |
| 279 | char queueNames[sizeof(IOInterruptDispatchSource_QueueNames)]; |
| 280 | char methodNames[sizeof(IOInterruptDispatchSource_MethodNames)]; |
| 281 | char metaMethodNames[sizeof(IOInterruptDispatchSourceMetaClass_MethodNames)]; |
| 282 | }; |
| 283 | |
| 284 | const struct OSClassDescription_IOInterruptDispatchSource_t |
| 285 | OSClassDescription_IOInterruptDispatchSource = |
| 286 | { |
| 287 | .base = |
| 288 | { |
| 289 | .descriptionSize = sizeof(OSClassDescription_IOInterruptDispatchSource_t), |
| 290 | .name = "IOInterruptDispatchSource" , |
| 291 | .superName = "IODispatchSource" , |
| 292 | .methodOptionsSize = 2 * sizeof(uint64_t) * 0, |
| 293 | .methodOptionsOffset = __builtin_offsetof(struct OSClassDescription_IOInterruptDispatchSource_t, methodOptions), |
| 294 | .metaMethodOptionsSize = 2 * sizeof(uint64_t) * 0, |
| 295 | .metaMethodOptionsOffset = __builtin_offsetof(struct OSClassDescription_IOInterruptDispatchSource_t, metaMethodOptions), |
| 296 | .queueNamesSize = sizeof(IOInterruptDispatchSource_QueueNames), |
| 297 | .queueNamesOffset = __builtin_offsetof(struct OSClassDescription_IOInterruptDispatchSource_t, queueNames), |
| 298 | .methodNamesSize = sizeof(IOInterruptDispatchSource_MethodNames), |
| 299 | .methodNamesOffset = __builtin_offsetof(struct OSClassDescription_IOInterruptDispatchSource_t, methodNames), |
| 300 | .metaMethodNamesSize = sizeof(IOInterruptDispatchSourceMetaClass_MethodNames), |
| 301 | .metaMethodNamesOffset = __builtin_offsetof(struct OSClassDescription_IOInterruptDispatchSource_t, metaMethodNames), |
| 302 | .flags = 1*kOSClassCanRemote, |
| 303 | }, |
| 304 | .methodOptions = |
| 305 | { |
| 306 | }, |
| 307 | .metaMethodOptions = |
| 308 | { |
| 309 | }, |
| 310 | .queueNames = IOInterruptDispatchSource_QueueNames, |
| 311 | .methodNames = IOInterruptDispatchSource_MethodNames, |
| 312 | .metaMethodNames = IOInterruptDispatchSourceMetaClass_MethodNames, |
| 313 | }; |
| 314 | |
| 315 | OSMetaClass * gIOInterruptDispatchSourceMetaClass; |
| 316 | |
| 317 | static kern_return_t |
| 318 | IOInterruptDispatchSource_New(OSMetaClass * instance); |
| 319 | |
| 320 | const OSClassLoadInformation |
| 321 | IOInterruptDispatchSource_Class = |
| 322 | { |
| 323 | .description = &OSClassDescription_IOInterruptDispatchSource.base, |
| 324 | .metaPointer = &gIOInterruptDispatchSourceMetaClass, |
| 325 | .version = 1, |
| 326 | .instanceSize = sizeof(IOInterruptDispatchSource), |
| 327 | |
| 328 | .New = &IOInterruptDispatchSource_New, |
| 329 | }; |
| 330 | |
| 331 | extern const void * const |
| 332 | gIOInterruptDispatchSource_Declaration; |
| 333 | const void * const |
| 334 | gIOInterruptDispatchSource_Declaration |
| 335 | __attribute__((visibility("hidden" ),section("__DATA_CONST,__osclassinfo,regular,no_dead_strip" ),no_sanitize("address" ))) |
| 336 | = &IOInterruptDispatchSource_Class; |
| 337 | |
| 338 | static kern_return_t |
| 339 | IOInterruptDispatchSource_New(OSMetaClass * instance) |
| 340 | { |
| 341 | if (!new(instance) IOInterruptDispatchSourceMetaClass) return (kIOReturnNoMemory); |
| 342 | return (kIOReturnSuccess); |
| 343 | } |
| 344 | |
| 345 | kern_return_t |
| 346 | IOInterruptDispatchSourceMetaClass::New(OSObject * instance) |
| 347 | { |
| 348 | if (!new(instance) IOInterruptDispatchSource) return (kIOReturnNoMemory); |
| 349 | return (kIOReturnSuccess); |
| 350 | } |
| 351 | |
| 352 | #endif /* !KERNEL */ |
| 353 | |
| 354 | kern_return_t |
| 355 | IOInterruptDispatchSource::Dispatch(const IORPC rpc) |
| 356 | { |
| 357 | return _Dispatch(self: this, rpc); |
| 358 | } |
| 359 | |
| 360 | kern_return_t |
| 361 | IOInterruptDispatchSource::_Dispatch(IOInterruptDispatchSource * self, const IORPC rpc) |
| 362 | { |
| 363 | kern_return_t ret = kIOReturnUnsupported; |
| 364 | IORPCMessage * msg = IORPCMessageFromMach(msg: rpc.message, reply: false); |
| 365 | |
| 366 | switch (msg->msgid) |
| 367 | { |
| 368 | case IOInterruptDispatchSource_SetHandler_ID: |
| 369 | { |
| 370 | ret = IOInterruptDispatchSource::SetHandler_Invoke(rpc, target: self, SimpleMemberFunctionCast(IOInterruptDispatchSource::SetHandler_Handler, *self, &IOInterruptDispatchSource::SetHandler_Impl)); |
| 371 | break; |
| 372 | } |
| 373 | case IODispatchSource_SetEnableWithCompletion_ID: |
| 374 | { |
| 375 | ret = IODispatchSource::SetEnableWithCompletion_Invoke(rpc, target: self, SimpleMemberFunctionCast(IODispatchSource::SetEnableWithCompletion_Handler, *self, &IOInterruptDispatchSource::SetEnableWithCompletion_Impl)); |
| 376 | break; |
| 377 | } |
| 378 | case IODispatchSource_Cancel_ID: |
| 379 | { |
| 380 | ret = IODispatchSource::Cancel_Invoke(rpc, target: self, SimpleMemberFunctionCast(IODispatchSource::Cancel_Handler, *self, &IOInterruptDispatchSource::Cancel_Impl)); |
| 381 | break; |
| 382 | } |
| 383 | #if KERNEL |
| 384 | case IOInterruptDispatchSource_GetLastInterrupt_ID: |
| 385 | { |
| 386 | ret = IOInterruptDispatchSource::GetLastInterrupt_Invoke(rpc, target: self, SimpleMemberFunctionCast(IOInterruptDispatchSource::GetLastInterrupt_Handler, *self, &IOInterruptDispatchSource::GetLastInterrupt_Impl)); |
| 387 | break; |
| 388 | } |
| 389 | #endif /* !KERNEL */ |
| 390 | case IODispatchSource_CheckForWork_ID: |
| 391 | { |
| 392 | ret = IODispatchSource::CheckForWork_Invoke(rpc, target: self, SimpleMemberFunctionCast(IODispatchSource::CheckForWork_Handler, *self, &IOInterruptDispatchSource::CheckForWork_Impl)); |
| 393 | break; |
| 394 | } |
| 395 | case IOInterruptDispatchSource_InterruptOccurred_ID: |
| 396 | { |
| 397 | ret = IOInterruptDispatchSource::InterruptOccurred_Invoke(rpc, target: self, SimpleMemberFunctionCast(IOInterruptDispatchSource::InterruptOccurred_Handler, *self, &IOInterruptDispatchSource::InterruptOccurred_Impl)); |
| 398 | break; |
| 399 | } |
| 400 | |
| 401 | default: |
| 402 | ret = IODispatchSource::_Dispatch(self, rpc); |
| 403 | break; |
| 404 | } |
| 405 | |
| 406 | return (ret); |
| 407 | } |
| 408 | |
| 409 | #if KERNEL |
| 410 | kern_return_t |
| 411 | IOInterruptDispatchSource::MetaClass::Dispatch(const IORPC rpc) |
| 412 | { |
| 413 | #else /* KERNEL */ |
| 414 | kern_return_t |
| 415 | IOInterruptDispatchSourceMetaClass::Dispatch(const IORPC rpc) |
| 416 | { |
| 417 | #endif /* !KERNEL */ |
| 418 | |
| 419 | kern_return_t ret = kIOReturnUnsupported; |
| 420 | IORPCMessage * msg = IORPCMessageFromMach(msg: rpc.message, reply: false); |
| 421 | |
| 422 | switch (msg->msgid) |
| 423 | { |
| 424 | #if KERNEL |
| 425 | case IOInterruptDispatchSource_Create_ID: |
| 426 | ret = IOInterruptDispatchSource::Create_Invoke(rpc, func: &IOInterruptDispatchSource::Create_Impl); |
| 427 | break; |
| 428 | #endif /* !KERNEL */ |
| 429 | #if KERNEL |
| 430 | case IOInterruptDispatchSource_GetInterruptType_ID: |
| 431 | ret = IOInterruptDispatchSource::GetInterruptType_Invoke(rpc, func: &IOInterruptDispatchSource::GetInterruptType_Impl); |
| 432 | break; |
| 433 | #endif /* !KERNEL */ |
| 434 | |
| 435 | default: |
| 436 | ret = OSMetaClassBase::Dispatch(rpc); |
| 437 | break; |
| 438 | } |
| 439 | |
| 440 | return (ret); |
| 441 | } |
| 442 | |
| 443 | kern_return_t |
| 444 | IOInterruptDispatchSource::Create_Call( |
| 445 | IOService * provider, |
| 446 | uint32_t index, |
| 447 | IODispatchQueue * queue, |
| 448 | IOInterruptDispatchSource ** source) |
| 449 | { |
| 450 | kern_return_t ret; |
| 451 | union |
| 452 | { |
| 453 | IOInterruptDispatchSource_Create_Msg msg; |
| 454 | struct |
| 455 | { |
| 456 | IOInterruptDispatchSource_Create_Rpl rpl; |
| 457 | mach_msg_max_trailer_t trailer; |
| 458 | } rpl; |
| 459 | } buf; |
| 460 | struct IOInterruptDispatchSource_Create_Msg * msg = &buf.msg; |
| 461 | struct IOInterruptDispatchSource_Create_Rpl * rpl = &buf.rpl.rpl; |
| 462 | |
| 463 | memset(s: msg, c: 0, n: sizeof(struct IOInterruptDispatchSource_Create_Msg)); |
| 464 | msg->mach.msgh.msgh_id = kIORPCVersion190615; |
| 465 | msg->mach.msgh.msgh_size = sizeof(*msg); |
| 466 | msg->content.__hdr.flags = 0*kIORPCMessageOneway |
| 467 | | 0*kIORPCMessageSimpleReply |
| 468 | | 0*kIORPCMessageLocalHost |
| 469 | | 0*kIORPCMessageOnqueue; |
| 470 | msg->content.__hdr.msgid = IOInterruptDispatchSource_Create_ID; |
| 471 | msg->content.__object = (OSObjectRef) OSTypeID(IOInterruptDispatchSource); |
| 472 | msg->content.__hdr.objectRefs = IOInterruptDispatchSource_Create_Msg_ObjRefs; |
| 473 | msg->mach.msgh_body.msgh_descriptor_count = 3; |
| 474 | |
| 475 | msg->__object__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
| 476 | |
| 477 | msg->provider__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
| 478 | msg->content.provider = (OSObjectRef) provider; |
| 479 | |
| 480 | msg->content.index = index; |
| 481 | |
| 482 | msg->queue__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
| 483 | msg->content.queue = (OSObjectRef) queue; |
| 484 | |
| 485 | IORPC rpc = { .message = &buf.msg.mach, .reply = &buf.rpl.rpl.mach, .sendSize = sizeof(buf.msg), .replySize = sizeof(buf.rpl) }; |
| 486 | ret = OSMTypeID(IOInterruptDispatchSource)->Invoke(rpc); |
| 487 | |
| 488 | if (kIOReturnSuccess == ret) |
| 489 | do { |
| 490 | { |
| 491 | if (rpl->mach.msgh.msgh_size != sizeof(*rpl)) { ret = kIOReturnIPCError; break; }; |
| 492 | if (rpl->content.__hdr.msgid != IOInterruptDispatchSource_Create_ID) { ret = kIOReturnIPCError; break; }; |
| 493 | if (rpl->mach.msgh_body.msgh_descriptor_count != 1) { ret = kIOReturnIPCError; break; }; |
| 494 | if (IOInterruptDispatchSource_Create_Rpl_ObjRefs != rpl->content.__hdr.objectRefs) { ret = kIOReturnIPCError; break; }; |
| 495 | } |
| 496 | } |
| 497 | while (false); |
| 498 | if (kIOReturnSuccess == ret) |
| 499 | { |
| 500 | *source = OSDynamicCast(IOInterruptDispatchSource, (OSObject *) rpl->content.source); |
| 501 | if (rpl->content.source && !*source) ret = kIOReturnBadArgument; |
| 502 | } |
| 503 | |
| 504 | |
| 505 | return (ret); |
| 506 | } |
| 507 | |
| 508 | kern_return_t |
| 509 | IOInterruptDispatchSource::GetInterruptType( |
| 510 | IOService * provider, |
| 511 | uint32_t index, |
| 512 | uint64_t * interruptType) |
| 513 | { |
| 514 | kern_return_t ret; |
| 515 | union |
| 516 | { |
| 517 | IOInterruptDispatchSource_GetInterruptType_Msg msg; |
| 518 | struct |
| 519 | { |
| 520 | IOInterruptDispatchSource_GetInterruptType_Rpl rpl; |
| 521 | mach_msg_max_trailer_t trailer; |
| 522 | } rpl; |
| 523 | } buf; |
| 524 | struct IOInterruptDispatchSource_GetInterruptType_Msg * msg = &buf.msg; |
| 525 | struct IOInterruptDispatchSource_GetInterruptType_Rpl * rpl = &buf.rpl.rpl; |
| 526 | |
| 527 | memset(s: msg, c: 0, n: sizeof(struct IOInterruptDispatchSource_GetInterruptType_Msg)); |
| 528 | msg->mach.msgh.msgh_id = kIORPCVersion190615; |
| 529 | msg->mach.msgh.msgh_size = sizeof(*msg); |
| 530 | msg->content.__hdr.flags = 0*kIORPCMessageOneway |
| 531 | | 1*kIORPCMessageSimpleReply |
| 532 | | 0*kIORPCMessageLocalHost |
| 533 | | 0*kIORPCMessageOnqueue; |
| 534 | msg->content.__hdr.msgid = IOInterruptDispatchSource_GetInterruptType_ID; |
| 535 | msg->content.__object = (OSObjectRef) OSTypeID(IOInterruptDispatchSource); |
| 536 | msg->content.__hdr.objectRefs = IOInterruptDispatchSource_GetInterruptType_Msg_ObjRefs; |
| 537 | msg->mach.msgh_body.msgh_descriptor_count = 2; |
| 538 | |
| 539 | msg->__object__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
| 540 | |
| 541 | msg->provider__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
| 542 | msg->content.provider = (OSObjectRef) provider; |
| 543 | |
| 544 | msg->content.index = index; |
| 545 | |
| 546 | IORPC rpc = { .message = &buf.msg.mach, .reply = &buf.rpl.rpl.mach, .sendSize = sizeof(buf.msg), .replySize = sizeof(buf.rpl) }; |
| 547 | ret = OSMTypeID(IOInterruptDispatchSource)->Invoke(rpc); |
| 548 | |
| 549 | if (kIOReturnSuccess == ret) |
| 550 | do { |
| 551 | { |
| 552 | if (rpl->mach.msgh.msgh_size != sizeof(*rpl)) { ret = kIOReturnIPCError; break; }; |
| 553 | if (rpl->content.__hdr.msgid != IOInterruptDispatchSource_GetInterruptType_ID) { ret = kIOReturnIPCError; break; }; |
| 554 | if (rpl->mach.msgh_body.msgh_descriptor_count != 0) { ret = kIOReturnIPCError; break; }; |
| 555 | if (IOInterruptDispatchSource_GetInterruptType_Rpl_ObjRefs != rpl->content.__hdr.objectRefs) { ret = kIOReturnIPCError; break; }; |
| 556 | } |
| 557 | } |
| 558 | while (false); |
| 559 | if (kIOReturnSuccess == ret) |
| 560 | { |
| 561 | if (interruptType) *interruptType = rpl->content.interruptType; |
| 562 | } |
| 563 | |
| 564 | |
| 565 | return (ret); |
| 566 | } |
| 567 | |
| 568 | kern_return_t |
| 569 | IOInterruptDispatchSource::SetHandler( |
| 570 | OSAction * action, |
| 571 | OSDispatchMethod supermethod) |
| 572 | { |
| 573 | kern_return_t ret; |
| 574 | union |
| 575 | { |
| 576 | IOInterruptDispatchSource_SetHandler_Msg msg; |
| 577 | struct |
| 578 | { |
| 579 | IOInterruptDispatchSource_SetHandler_Rpl rpl; |
| 580 | mach_msg_max_trailer_t trailer; |
| 581 | } rpl; |
| 582 | } buf; |
| 583 | struct IOInterruptDispatchSource_SetHandler_Msg * msg = &buf.msg; |
| 584 | struct IOInterruptDispatchSource_SetHandler_Rpl * rpl = &buf.rpl.rpl; |
| 585 | |
| 586 | memset(s: msg, c: 0, n: sizeof(struct IOInterruptDispatchSource_SetHandler_Msg)); |
| 587 | msg->mach.msgh.msgh_id = kIORPCVersion190615; |
| 588 | msg->mach.msgh.msgh_size = sizeof(*msg); |
| 589 | msg->content.__hdr.flags = 0*kIORPCMessageOneway |
| 590 | | 1*kIORPCMessageSimpleReply |
| 591 | | 0*kIORPCMessageLocalHost |
| 592 | | 0*kIORPCMessageOnqueue; |
| 593 | msg->content.__hdr.msgid = IOInterruptDispatchSource_SetHandler_ID; |
| 594 | msg->content.__object = (OSObjectRef) this; |
| 595 | msg->content.__hdr.objectRefs = IOInterruptDispatchSource_SetHandler_Msg_ObjRefs; |
| 596 | msg->mach.msgh_body.msgh_descriptor_count = 2; |
| 597 | |
| 598 | msg->__object__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
| 599 | |
| 600 | msg->action__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
| 601 | msg->content.action = (OSObjectRef) action; |
| 602 | |
| 603 | IORPC rpc = { .message = &buf.msg.mach, .reply = &buf.rpl.rpl.mach, .sendSize = sizeof(buf.msg), .replySize = sizeof(buf.rpl) }; |
| 604 | if (supermethod) ret = supermethod((OSObject *)this, rpc); |
| 605 | else ret = ((OSObject *)this)->Invoke(rpc); |
| 606 | |
| 607 | if (kIOReturnSuccess == ret) |
| 608 | do { |
| 609 | { |
| 610 | if (rpl->mach.msgh.msgh_size != sizeof(*rpl)) { ret = kIOReturnIPCError; break; }; |
| 611 | if (rpl->content.__hdr.msgid != IOInterruptDispatchSource_SetHandler_ID) { ret = kIOReturnIPCError; break; }; |
| 612 | if (rpl->mach.msgh_body.msgh_descriptor_count != 0) { ret = kIOReturnIPCError; break; }; |
| 613 | if (IOInterruptDispatchSource_SetHandler_Rpl_ObjRefs != rpl->content.__hdr.objectRefs) { ret = kIOReturnIPCError; break; }; |
| 614 | } |
| 615 | } |
| 616 | while (false); |
| 617 | if (kIOReturnSuccess == ret) |
| 618 | { |
| 619 | } |
| 620 | |
| 621 | |
| 622 | return (ret); |
| 623 | } |
| 624 | |
| 625 | kern_return_t |
| 626 | IOInterruptDispatchSource::GetLastInterrupt( |
| 627 | uint64_t * count, |
| 628 | uint64_t * time, |
| 629 | OSDispatchMethod supermethod) |
| 630 | { |
| 631 | kern_return_t ret; |
| 632 | union |
| 633 | { |
| 634 | IOInterruptDispatchSource_GetLastInterrupt_Msg msg; |
| 635 | struct |
| 636 | { |
| 637 | IOInterruptDispatchSource_GetLastInterrupt_Rpl rpl; |
| 638 | mach_msg_max_trailer_t trailer; |
| 639 | } rpl; |
| 640 | } buf; |
| 641 | struct IOInterruptDispatchSource_GetLastInterrupt_Msg * msg = &buf.msg; |
| 642 | struct IOInterruptDispatchSource_GetLastInterrupt_Rpl * rpl = &buf.rpl.rpl; |
| 643 | |
| 644 | memset(s: msg, c: 0, n: sizeof(struct IOInterruptDispatchSource_GetLastInterrupt_Msg)); |
| 645 | msg->mach.msgh.msgh_id = kIORPCVersion190615; |
| 646 | msg->mach.msgh.msgh_size = sizeof(*msg); |
| 647 | msg->content.__hdr.flags = 0*kIORPCMessageOneway |
| 648 | | 1*kIORPCMessageSimpleReply |
| 649 | | 0*kIORPCMessageLocalHost |
| 650 | | 0*kIORPCMessageOnqueue; |
| 651 | msg->content.__hdr.msgid = IOInterruptDispatchSource_GetLastInterrupt_ID; |
| 652 | msg->content.__object = (OSObjectRef) this; |
| 653 | msg->content.__hdr.objectRefs = IOInterruptDispatchSource_GetLastInterrupt_Msg_ObjRefs; |
| 654 | msg->mach.msgh_body.msgh_descriptor_count = 1; |
| 655 | |
| 656 | msg->__object__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
| 657 | |
| 658 | IORPC rpc = { .message = &buf.msg.mach, .reply = &buf.rpl.rpl.mach, .sendSize = sizeof(buf.msg), .replySize = sizeof(buf.rpl) }; |
| 659 | if (supermethod) ret = supermethod((OSObject *)this, rpc); |
| 660 | else ret = ((OSObject *)this)->Invoke(rpc); |
| 661 | |
| 662 | if (kIOReturnSuccess == ret) |
| 663 | do { |
| 664 | { |
| 665 | if (rpl->mach.msgh.msgh_size != sizeof(*rpl)) { ret = kIOReturnIPCError; break; }; |
| 666 | if (rpl->content.__hdr.msgid != IOInterruptDispatchSource_GetLastInterrupt_ID) { ret = kIOReturnIPCError; break; }; |
| 667 | if (rpl->mach.msgh_body.msgh_descriptor_count != 0) { ret = kIOReturnIPCError; break; }; |
| 668 | if (IOInterruptDispatchSource_GetLastInterrupt_Rpl_ObjRefs != rpl->content.__hdr.objectRefs) { ret = kIOReturnIPCError; break; }; |
| 669 | } |
| 670 | } |
| 671 | while (false); |
| 672 | if (kIOReturnSuccess == ret) |
| 673 | { |
| 674 | if (count) *count = rpl->content.count; |
| 675 | if (time) *time = rpl->content.time; |
| 676 | } |
| 677 | |
| 678 | |
| 679 | return (ret); |
| 680 | } |
| 681 | |
| 682 | kern_return_t |
| 683 | IOInterruptDispatchSource::InterruptOccurred( |
| 684 | IORPC rpc, |
| 685 | OSAction * action, |
| 686 | uint64_t count, |
| 687 | uint64_t time, |
| 688 | OSDispatchMethod supermethod) |
| 689 | { |
| 690 | kern_return_t ret; |
| 691 | struct IOInterruptDispatchSource_InterruptOccurred_Msg * msg = (typeof(msg)) rpc.reply; |
| 692 | |
| 693 | |
| 694 | memset(s: msg, c: 0, n: sizeof(struct IOInterruptDispatchSource_InterruptOccurred_Msg)); |
| 695 | msg->mach.msgh.msgh_id = kIORPCVersion190615; |
| 696 | msg->mach.msgh.msgh_size = sizeof(*msg); |
| 697 | msg->content.__hdr.flags = 1*kIORPCMessageOneway |
| 698 | | 1*kIORPCMessageSimpleReply |
| 699 | | 0*kIORPCMessageLocalHost |
| 700 | | 1*kIORPCMessageOnqueue; |
| 701 | msg->content.__hdr.msgid = IOInterruptDispatchSource_InterruptOccurred_ID; |
| 702 | msg->content.__object = (OSObjectRef) action; |
| 703 | msg->content.__hdr.objectRefs = IOInterruptDispatchSource_InterruptOccurred_Msg_ObjRefs; |
| 704 | msg->mach.msgh_body.msgh_descriptor_count = 2; |
| 705 | |
| 706 | msg->__object__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
| 707 | |
| 708 | msg->action__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
| 709 | msg->content.action = (OSObjectRef) action; |
| 710 | |
| 711 | msg->content.count = count; |
| 712 | |
| 713 | msg->content.time = time; |
| 714 | |
| 715 | |
| 716 | ret = kIOReturnSuccess; |
| 717 | |
| 718 | return (ret); |
| 719 | } |
| 720 | |
| 721 | kern_return_t |
| 722 | IOInterruptDispatchSource::Create_Invoke(const IORPC _rpc, |
| 723 | Create_Handler func) |
| 724 | { |
| 725 | IOInterruptDispatchSource_Create_Invocation rpc = { .rpc: _rpc }; |
| 726 | kern_return_t ret; |
| 727 | IOService * provider; |
| 728 | IODispatchQueue * queue; |
| 729 | |
| 730 | if (3 != rpc.message->mach.msgh_body.msgh_descriptor_count) return (kIOReturnIPCError); |
| 731 | if (IOInterruptDispatchSource_Create_Msg_ObjRefs != rpc.message->content.__hdr.objectRefs) return (kIOReturnIPCError); |
| 732 | if (rpc.message != NULL && rpc.sendSize < sizeof(IOInterruptDispatchSource_Create_Msg)) return (kIOReturnIPCError); |
| 733 | if (rpc.reply != NULL && rpc.replySize < sizeof(IOInterruptDispatchSource_Create_Rpl)) return (kIOReturnIPCError); |
| 734 | provider = OSDynamicCast(IOService, (OSObject *) rpc.message->content.provider); |
| 735 | if (!provider && rpc.message->content.provider) return (kIOReturnBadArgument); |
| 736 | queue = OSDynamicCast(IODispatchQueue, (OSObject *) rpc.message->content.queue); |
| 737 | if (!queue && rpc.message->content.queue) return (kIOReturnBadArgument); |
| 738 | |
| 739 | ret = (*func)( provider, |
| 740 | rpc.message->content.index, |
| 741 | queue, |
| 742 | (IOInterruptDispatchSource **)&rpc.reply->content.source); |
| 743 | |
| 744 | if (kIOReturnSuccess != ret) return (ret); |
| 745 | |
| 746 | rpc.reply->content.__hdr.msgid = IOInterruptDispatchSource_Create_ID; |
| 747 | rpc.reply->content.__hdr.flags = kIORPCMessageOneway; |
| 748 | rpc.reply->mach.msgh.msgh_id = kIORPCVersion190615Reply; |
| 749 | rpc.reply->mach.msgh.msgh_size = sizeof(*rpc.reply); |
| 750 | rpc.reply->mach.msgh_body.msgh_descriptor_count = 1; |
| 751 | rpc.reply->content.__hdr.objectRefs = IOInterruptDispatchSource_Create_Rpl_ObjRefs; |
| 752 | rpc.reply->source__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
| 753 | |
| 754 | return (ret); |
| 755 | } |
| 756 | |
| 757 | kern_return_t |
| 758 | IOInterruptDispatchSource::GetInterruptType_Invoke(const IORPC _rpc, |
| 759 | GetInterruptType_Handler func) |
| 760 | { |
| 761 | IOInterruptDispatchSource_GetInterruptType_Invocation rpc = { .rpc: _rpc }; |
| 762 | kern_return_t ret; |
| 763 | IOService * provider; |
| 764 | |
| 765 | if (2 != rpc.message->mach.msgh_body.msgh_descriptor_count) return (kIOReturnIPCError); |
| 766 | if (IOInterruptDispatchSource_GetInterruptType_Msg_ObjRefs != rpc.message->content.__hdr.objectRefs) return (kIOReturnIPCError); |
| 767 | if (rpc.message != NULL && rpc.sendSize < sizeof(IOInterruptDispatchSource_GetInterruptType_Msg)) return (kIOReturnIPCError); |
| 768 | if (rpc.reply != NULL && rpc.replySize < sizeof(IOInterruptDispatchSource_GetInterruptType_Rpl)) return (kIOReturnIPCError); |
| 769 | provider = OSDynamicCast(IOService, (OSObject *) rpc.message->content.provider); |
| 770 | if (!provider && rpc.message->content.provider) return (kIOReturnBadArgument); |
| 771 | |
| 772 | ret = (*func)( provider, |
| 773 | rpc.message->content.index, |
| 774 | &rpc.reply->content.interruptType); |
| 775 | |
| 776 | if (kIOReturnSuccess != ret) return (ret); |
| 777 | |
| 778 | rpc.reply->content.__hdr.msgid = IOInterruptDispatchSource_GetInterruptType_ID; |
| 779 | rpc.reply->content.__hdr.flags = kIORPCMessageOneway; |
| 780 | rpc.reply->mach.msgh.msgh_id = kIORPCVersion190615Reply; |
| 781 | rpc.reply->mach.msgh.msgh_size = sizeof(*rpc.reply); |
| 782 | rpc.reply->mach.msgh_body.msgh_descriptor_count = 0; |
| 783 | rpc.reply->content.__hdr.objectRefs = IOInterruptDispatchSource_GetInterruptType_Rpl_ObjRefs; |
| 784 | |
| 785 | return (ret); |
| 786 | } |
| 787 | |
| 788 | kern_return_t |
| 789 | IOInterruptDispatchSource::SetHandler_Invoke(const IORPC _rpc, |
| 790 | OSMetaClassBase * target, |
| 791 | SetHandler_Handler func) |
| 792 | { |
| 793 | IOInterruptDispatchSource_SetHandler_Invocation rpc = { .rpc: _rpc }; |
| 794 | kern_return_t ret; |
| 795 | OSAction * action; |
| 796 | |
| 797 | if (2 != rpc.message->mach.msgh_body.msgh_descriptor_count) return (kIOReturnIPCError); |
| 798 | if (IOInterruptDispatchSource_SetHandler_Msg_ObjRefs != rpc.message->content.__hdr.objectRefs) return (kIOReturnIPCError); |
| 799 | if (rpc.message != NULL && rpc.sendSize < sizeof(IOInterruptDispatchSource_SetHandler_Msg)) return (kIOReturnIPCError); |
| 800 | if (rpc.reply != NULL && rpc.replySize < sizeof(IOInterruptDispatchSource_SetHandler_Rpl)) return (kIOReturnIPCError); |
| 801 | action = OSDynamicCast(OSAction, (OSObject *) rpc.message->content.action); |
| 802 | if (!action && rpc.message->content.action) return (kIOReturnBadArgument); |
| 803 | |
| 804 | ret = (*func)(target, |
| 805 | action); |
| 806 | |
| 807 | if (kIOReturnSuccess != ret) return (ret); |
| 808 | |
| 809 | rpc.reply->content.__hdr.msgid = IOInterruptDispatchSource_SetHandler_ID; |
| 810 | rpc.reply->content.__hdr.flags = kIORPCMessageOneway; |
| 811 | rpc.reply->mach.msgh.msgh_id = kIORPCVersion190615Reply; |
| 812 | rpc.reply->mach.msgh.msgh_size = sizeof(*rpc.reply); |
| 813 | rpc.reply->mach.msgh_body.msgh_descriptor_count = 0; |
| 814 | rpc.reply->content.__hdr.objectRefs = IOInterruptDispatchSource_SetHandler_Rpl_ObjRefs; |
| 815 | |
| 816 | return (ret); |
| 817 | } |
| 818 | |
| 819 | kern_return_t |
| 820 | IOInterruptDispatchSource::GetLastInterrupt_Invoke(const IORPC _rpc, |
| 821 | OSMetaClassBase * target, |
| 822 | GetLastInterrupt_Handler func) |
| 823 | { |
| 824 | IOInterruptDispatchSource_GetLastInterrupt_Invocation rpc = { .rpc: _rpc }; |
| 825 | kern_return_t ret; |
| 826 | |
| 827 | if (1 != rpc.message->mach.msgh_body.msgh_descriptor_count) return (kIOReturnIPCError); |
| 828 | if (IOInterruptDispatchSource_GetLastInterrupt_Msg_ObjRefs != rpc.message->content.__hdr.objectRefs) return (kIOReturnIPCError); |
| 829 | if (rpc.message != NULL && rpc.sendSize < sizeof(IOInterruptDispatchSource_GetLastInterrupt_Msg)) return (kIOReturnIPCError); |
| 830 | if (rpc.reply != NULL && rpc.replySize < sizeof(IOInterruptDispatchSource_GetLastInterrupt_Rpl)) return (kIOReturnIPCError); |
| 831 | |
| 832 | ret = (*func)(target, |
| 833 | &rpc.reply->content.count, |
| 834 | &rpc.reply->content.time); |
| 835 | |
| 836 | if (kIOReturnSuccess != ret) return (ret); |
| 837 | |
| 838 | rpc.reply->content.__hdr.msgid = IOInterruptDispatchSource_GetLastInterrupt_ID; |
| 839 | rpc.reply->content.__hdr.flags = kIORPCMessageOneway; |
| 840 | rpc.reply->mach.msgh.msgh_id = kIORPCVersion190615Reply; |
| 841 | rpc.reply->mach.msgh.msgh_size = sizeof(*rpc.reply); |
| 842 | rpc.reply->mach.msgh_body.msgh_descriptor_count = 0; |
| 843 | rpc.reply->content.__hdr.objectRefs = IOInterruptDispatchSource_GetLastInterrupt_Rpl_ObjRefs; |
| 844 | |
| 845 | return (ret); |
| 846 | } |
| 847 | |
| 848 | kern_return_t |
| 849 | IOInterruptDispatchSource::InterruptOccurred_Invoke(const IORPC _rpc, |
| 850 | OSMetaClassBase * target, |
| 851 | InterruptOccurred_Handler func) |
| 852 | { |
| 853 | return IOInterruptDispatchSource::InterruptOccurred_Invoke(rpc: _rpc, target, func, NULL); |
| 854 | } |
| 855 | |
| 856 | kern_return_t |
| 857 | IOInterruptDispatchSource::InterruptOccurred_Invoke(const IORPC _rpc, |
| 858 | OSMetaClassBase * target, |
| 859 | InterruptOccurred_Handler func, |
| 860 | const OSMetaClass * targetActionClass) |
| 861 | { |
| 862 | IOInterruptDispatchSource_InterruptOccurred_Invocation rpc = { .rpc: _rpc }; |
| 863 | OSAction * action; |
| 864 | |
| 865 | if (2 != rpc.message->mach.msgh_body.msgh_descriptor_count) return (kIOReturnIPCError); |
| 866 | if (IOInterruptDispatchSource_InterruptOccurred_Msg_ObjRefs != rpc.message->content.__hdr.objectRefs) return (kIOReturnIPCError); |
| 867 | if (rpc.message != NULL && rpc.sendSize < sizeof(IOInterruptDispatchSource_InterruptOccurred_Msg)) return (kIOReturnIPCError); |
| 868 | if (rpc.reply != NULL && rpc.replySize < sizeof(IOInterruptDispatchSource_InterruptOccurred_Rpl)) return (kIOReturnIPCError); |
| 869 | if (targetActionClass) { |
| 870 | action = (OSAction *) OSMetaClassBase::safeMetaCast(anObject: (OSObject *) rpc.message->content.action, toMeta: targetActionClass); |
| 871 | } else { |
| 872 | action = OSDynamicCast(OSAction, (OSObject *) rpc.message->content.action); |
| 873 | } |
| 874 | if (!action && rpc.message->content.action) return (kIOReturnBadArgument); |
| 875 | |
| 876 | (*func)(target, |
| 877 | action, |
| 878 | rpc.message->content.count, |
| 879 | rpc.message->content.time); |
| 880 | |
| 881 | |
| 882 | return (kIOReturnSuccess); |
| 883 | } |
| 884 | |
| 885 | |
| 886 | |
| 887 | |