1/* iig(DriverKit-286 Mar 29 2024 10:27:09) generated from IOMemoryMap.iig */
2
3#undef IIG_IMPLEMENTATION
4#define IIG_IMPLEMENTATION IOMemoryMap.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/IOMemoryMap.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
22struct IOMemoryMap__CopyState_Msg_Content
23{
24 IORPCMessage __hdr;
25 OSObjectRef __object;
26};
27#pragma pack(4)
28struct IOMemoryMap__CopyState_Msg
29{
30 IORPCMessageMach mach;
31 mach_msg_port_descriptor_t __object__descriptor;
32 IOMemoryMap__CopyState_Msg_Content content;
33};
34#pragma pack()
35#define IOMemoryMap__CopyState_Msg_ObjRefs (1)
36
37struct IOMemoryMap__CopyState_Rpl_Content
38{
39 IORPCMessage __hdr;
40 _IOMemoryMapPrivateState state;
41};
42#pragma pack(4)
43struct IOMemoryMap__CopyState_Rpl
44{
45 IORPCMessageMach mach;
46 IOMemoryMap__CopyState_Rpl_Content content;
47};
48#pragma pack()
49#define IOMemoryMap__CopyState_Rpl_ObjRefs (0)
50
51
52typedef union
53{
54 const IORPC rpc;
55 struct
56 {
57 const struct IOMemoryMap__CopyState_Msg * message;
58 struct IOMemoryMap__CopyState_Rpl * reply;
59 uint32_t sendSize;
60 uint32_t replySize;
61 };
62}
63IOMemoryMap__CopyState_Invocation;
64#if !KERNEL
65extern OSMetaClass * gOSContainerMetaClass;
66extern OSMetaClass * gOSDataMetaClass;
67extern OSMetaClass * gOSNumberMetaClass;
68extern OSMetaClass * gOSStringMetaClass;
69extern OSMetaClass * gOSBooleanMetaClass;
70extern OSMetaClass * gOSDictionaryMetaClass;
71extern OSMetaClass * gOSArrayMetaClass;
72extern OSMetaClass * gOSSetMetaClass;
73extern OSMetaClass * gOSOrderedSetMetaClass;
74extern OSMetaClass * gIODispatchQueueMetaClass;
75#endif /* !KERNEL */
76
77#if !KERNEL
78
79#define IOMemoryMap_QueueNames ""
80
81#define IOMemoryMap_MethodNames ""
82
83#define IOMemoryMapMetaClass_MethodNames ""
84
85struct OSClassDescription_IOMemoryMap_t
86{
87 OSClassDescription base;
88 uint64_t methodOptions[2 * 0];
89 uint64_t metaMethodOptions[2 * 0];
90 char queueNames[sizeof(IOMemoryMap_QueueNames)];
91 char methodNames[sizeof(IOMemoryMap_MethodNames)];
92 char metaMethodNames[sizeof(IOMemoryMapMetaClass_MethodNames)];
93};
94
95const struct OSClassDescription_IOMemoryMap_t
96OSClassDescription_IOMemoryMap =
97{
98 .base =
99 {
100 .descriptionSize = sizeof(OSClassDescription_IOMemoryMap_t),
101 .name = "IOMemoryMap",
102 .superName = "OSObject",
103 .methodOptionsSize = 2 * sizeof(uint64_t) * 0,
104 .methodOptionsOffset = __builtin_offsetof(struct OSClassDescription_IOMemoryMap_t, methodOptions),
105 .metaMethodOptionsSize = 2 * sizeof(uint64_t) * 0,
106 .metaMethodOptionsOffset = __builtin_offsetof(struct OSClassDescription_IOMemoryMap_t, metaMethodOptions),
107 .queueNamesSize = sizeof(IOMemoryMap_QueueNames),
108 .queueNamesOffset = __builtin_offsetof(struct OSClassDescription_IOMemoryMap_t, queueNames),
109 .methodNamesSize = sizeof(IOMemoryMap_MethodNames),
110 .methodNamesOffset = __builtin_offsetof(struct OSClassDescription_IOMemoryMap_t, methodNames),
111 .metaMethodNamesSize = sizeof(IOMemoryMapMetaClass_MethodNames),
112 .metaMethodNamesOffset = __builtin_offsetof(struct OSClassDescription_IOMemoryMap_t, metaMethodNames),
113 .flags = 1*kOSClassCanRemote,
114 },
115 .methodOptions =
116 {
117 },
118 .metaMethodOptions =
119 {
120 },
121 .queueNames = IOMemoryMap_QueueNames,
122 .methodNames = IOMemoryMap_MethodNames,
123 .metaMethodNames = IOMemoryMapMetaClass_MethodNames,
124};
125
126OSMetaClass * gIOMemoryMapMetaClass;
127
128static kern_return_t
129IOMemoryMap_New(OSMetaClass * instance);
130
131const OSClassLoadInformation
132IOMemoryMap_Class =
133{
134 .description = &OSClassDescription_IOMemoryMap.base,
135 .metaPointer = &gIOMemoryMapMetaClass,
136 .version = 1,
137 .instanceSize = sizeof(IOMemoryMap),
138
139 .New = &IOMemoryMap_New,
140};
141
142extern const void * const
143gIOMemoryMap_Declaration;
144const void * const
145gIOMemoryMap_Declaration
146__attribute__((visibility("hidden"),section("__DATA_CONST,__osclassinfo,regular,no_dead_strip"),no_sanitize("address")))
147 = &IOMemoryMap_Class;
148
149static kern_return_t
150IOMemoryMap_New(OSMetaClass * instance)
151{
152 if (!new(instance) IOMemoryMapMetaClass) return (kIOReturnNoMemory);
153 return (kIOReturnSuccess);
154}
155
156kern_return_t
157IOMemoryMapMetaClass::New(OSObject * instance)
158{
159 if (!new(instance) IOMemoryMap) return (kIOReturnNoMemory);
160 return (kIOReturnSuccess);
161}
162
163#endif /* !KERNEL */
164
165kern_return_t
166IOMemoryMap::Dispatch(const IORPC rpc)
167{
168 return _Dispatch(self: this, rpc);
169}
170
171kern_return_t
172IOMemoryMap::_Dispatch(IOMemoryMap * self, const IORPC rpc)
173{
174 kern_return_t ret = kIOReturnUnsupported;
175 IORPCMessage * msg = IORPCMessageFromMach(msg: rpc.message, reply: false);
176
177 switch (msg->msgid)
178 {
179#if KERNEL
180 case IOMemoryMap__CopyState_ID:
181 {
182 ret = IOMemoryMap::_CopyState_Invoke(rpc, target: self, SimpleMemberFunctionCast(IOMemoryMap::_CopyState_Handler, *self, &IOMemoryMap::_CopyState_Impl));
183 break;
184 }
185#endif /* !KERNEL */
186
187 default:
188 ret = OSObject::_Dispatch(self, rpc);
189 break;
190 }
191
192 return (ret);
193}
194
195#if KERNEL
196kern_return_t
197IOMemoryMap::MetaClass::Dispatch(const IORPC rpc)
198{
199#else /* KERNEL */
200kern_return_t
201IOMemoryMapMetaClass::Dispatch(const IORPC rpc)
202{
203#endif /* !KERNEL */
204
205 kern_return_t ret = kIOReturnUnsupported;
206 IORPCMessage * msg = IORPCMessageFromMach(msg: rpc.message, reply: false);
207
208 switch (msg->msgid)
209 {
210
211 default:
212 ret = OSMetaClassBase::Dispatch(rpc);
213 break;
214 }
215
216 return (ret);
217}
218
219kern_return_t
220IOMemoryMap::_CopyState(
221 _IOMemoryMapPrivateState * state,
222 OSDispatchMethod supermethod)
223{
224 kern_return_t ret;
225 union
226 {
227 IOMemoryMap__CopyState_Msg msg;
228 struct
229 {
230 IOMemoryMap__CopyState_Rpl rpl;
231 mach_msg_max_trailer_t trailer;
232 } rpl;
233 } buf;
234 struct IOMemoryMap__CopyState_Msg * msg = &buf.msg;
235 struct IOMemoryMap__CopyState_Rpl * rpl = &buf.rpl.rpl;
236
237 memset(s: msg, c: 0, n: sizeof(struct IOMemoryMap__CopyState_Msg));
238 msg->mach.msgh.msgh_id = kIORPCVersion190615;
239 msg->mach.msgh.msgh_size = sizeof(*msg);
240 msg->content.__hdr.flags = 0*kIORPCMessageOneway
241 | 1*kIORPCMessageSimpleReply
242 | 0*kIORPCMessageLocalHost
243 | 0*kIORPCMessageOnqueue;
244 msg->content.__hdr.msgid = IOMemoryMap__CopyState_ID;
245 msg->content.__object = (OSObjectRef) this;
246 msg->content.__hdr.objectRefs = IOMemoryMap__CopyState_Msg_ObjRefs;
247 msg->mach.msgh_body.msgh_descriptor_count = 1;
248
249 msg->__object__descriptor.type = MACH_MSG_PORT_DESCRIPTOR;
250
251 IORPC rpc = { .message = &buf.msg.mach, .reply = &buf.rpl.rpl.mach, .sendSize = sizeof(buf.msg), .replySize = sizeof(buf.rpl) };
252 if (supermethod) ret = supermethod((OSObject *)this, rpc);
253 else ret = ((OSObject *)this)->Invoke(rpc);
254
255 if (kIOReturnSuccess == ret)
256 do {
257 {
258 if (rpl->mach.msgh.msgh_size != sizeof(*rpl)) { ret = kIOReturnIPCError; break; };
259 if (rpl->content.__hdr.msgid != IOMemoryMap__CopyState_ID) { ret = kIOReturnIPCError; break; };
260 if (rpl->mach.msgh_body.msgh_descriptor_count != 0) { ret = kIOReturnIPCError; break; };
261 if (IOMemoryMap__CopyState_Rpl_ObjRefs != rpl->content.__hdr.objectRefs) { ret = kIOReturnIPCError; break; };
262 }
263 }
264 while (false);
265 if (kIOReturnSuccess == ret)
266 {
267 if (state) *state = rpl->content.state;
268 }
269
270
271 return (ret);
272}
273
274kern_return_t
275IOMemoryMap::_CopyState_Invoke(const IORPC _rpc,
276 OSMetaClassBase * target,
277 _CopyState_Handler func)
278{
279 IOMemoryMap__CopyState_Invocation rpc = { .rpc: _rpc };
280 kern_return_t ret;
281
282 if (1 != rpc.message->mach.msgh_body.msgh_descriptor_count) return (kIOReturnIPCError);
283 if (IOMemoryMap__CopyState_Msg_ObjRefs != rpc.message->content.__hdr.objectRefs) return (kIOReturnIPCError);
284 if (rpc.message != NULL && rpc.sendSize < sizeof(IOMemoryMap__CopyState_Msg)) return (kIOReturnIPCError);
285 if (rpc.reply != NULL && rpc.replySize < sizeof(IOMemoryMap__CopyState_Rpl)) return (kIOReturnIPCError);
286
287 ret = (*func)(target,
288 &rpc.reply->content.state);
289
290 if (kIOReturnSuccess != ret) return (ret);
291
292 rpc.reply->content.__hdr.msgid = IOMemoryMap__CopyState_ID;
293 rpc.reply->content.__hdr.flags = kIORPCMessageOneway;
294 rpc.reply->mach.msgh.msgh_id = kIORPCVersion190615Reply;
295 rpc.reply->mach.msgh.msgh_size = sizeof(*rpc.reply);
296 rpc.reply->mach.msgh_body.msgh_descriptor_count = 0;
297 rpc.reply->content.__hdr.objectRefs = IOMemoryMap__CopyState_Rpl_ObjRefs;
298
299 return (ret);
300}
301
302
303
304