]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
91447636 | 2 | * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved. |
1c79356b | 3 | * |
8ad349bb | 4 | * @APPLE_LICENSE_OSREFERENCE_HEADER_START@ |
1c79356b | 5 | * |
8ad349bb A |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. The rights granted to you under the | |
10 | * License may not be used to create, or enable the creation or | |
11 | * redistribution of, unlawful or unlicensed copies of an Apple operating | |
12 | * system, or to circumvent, violate, or enable the circumvention or | |
13 | * violation of, any terms of an Apple operating system software license | |
14 | * agreement. | |
15 | * | |
16 | * Please obtain a copy of the License at | |
17 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
18 | * file. | |
19 | * | |
20 | * The Original Code and all software distributed under the License are | |
21 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
22 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
23 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
24 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
25 | * Please see the License for the specific language governing rights and | |
26 | * limitations under the License. | |
27 | * | |
28 | * @APPLE_LICENSE_OSREFERENCE_HEADER_END@ | |
1c79356b A |
29 | */ |
30 | /* | |
31 | * @OSF_COPYRIGHT@ | |
32 | */ | |
33 | ||
91447636 A |
34 | #ifndef _KERN_IPC_MIG_H_ |
35 | #define _KERN_IPC_MIG_H_ | |
1c79356b | 36 | |
0b4e3aa0 | 37 | #include <mach/mig.h> |
91447636 | 38 | #include <mach/mach_types.h> |
1c79356b | 39 | #include <mach/message.h> |
91447636 A |
40 | #include <kern/kern_types.h> |
41 | ||
42 | #include <sys/cdefs.h> | |
43 | ||
44 | #ifdef XNU_KERNEL_PRIVATE | |
45 | ||
1c79356b A |
46 | #include <sys/kdebug.h> |
47 | ||
48 | /* | |
49 | * Define the trace points for MIG-generated calls. One traces the input parameters | |
50 | * to MIG called things, another traces the outputs, and one traces bad message IDs. | |
51 | */ | |
52 | #ifdef _MIG_TRACE_PARAMETERS_ | |
53 | ||
54 | #define __BeforeRcvCallTrace(msgid,arg1,arg2,arg3,arg4) \ | |
55 | KERNEL_DEBUG_CONSTANT(KDBG_MIGCODE(msgid) | DBG_FUNC_START, \ | |
56 | (unsigned int)(arg1), \ | |
57 | (unsigned int)(arg2), \ | |
58 | (unsigned int)(arg3), \ | |
59 | (unsigned int)(arg4), \ | |
60 | (unsigned int)(0)); | |
61 | ||
62 | #define __AfterRcvCallTrace(msgid,arg1,arg2,arg3,arg4) \ | |
63 | KERNEL_DEBUG_CONSTANT(KDBG_MIGCODE(msgid) | DBG_FUNC_END, \ | |
64 | (unsigned int)(arg1), \ | |
65 | (unsigned int)(arg2), \ | |
66 | (unsigned int)(arg3), \ | |
67 | (unsigned int)(arg4), \ | |
68 | (unsigned int)(0)); | |
69 | ||
70 | #define __BeforeSimpleCallTrace(msgid,arg1,arg2,arg3,arg4) \ | |
71 | KERNEL_DEBUG_CONSTANT(KDBG_MIGCODE(msgid) | DBG_FUNC_START, \ | |
72 | (unsigned int)(arg1), \ | |
73 | (unsigned int)(arg2), \ | |
74 | (unsigned int)(arg3), \ | |
75 | (unsigned int)(arg4), \ | |
76 | (unsigned int)(0)); | |
77 | ||
78 | #define __AfterSimpleCallTrace(msgid,arg1,arg2,arg3,arg4) \ | |
79 | KERNEL_DEBUG_CONSTANT(KDBG_MIGCODE(msgid) | DBG_FUNC_END, \ | |
80 | (unsigned int)(arg1), \ | |
81 | (unsigned int)(arg2), \ | |
82 | (unsigned int)(arg3), \ | |
83 | (unsigned int)(arg4), \ | |
84 | (unsigned int)(0)); | |
85 | ||
86 | #else /* !_MIG_TRACE_PARAMETERS_ */ | |
87 | ||
88 | #define __BeforeRcvRpc(msgid, _NAME_) \ | |
89 | KERNEL_DEBUG_CONSTANT(KDBG_MIGCODE(msgid) | DBG_FUNC_START, \ | |
90 | (unsigned int)(0), \ | |
91 | (unsigned int)(0), \ | |
92 | (unsigned int)(0), \ | |
93 | (unsigned int)(0), \ | |
94 | (unsigned int)(0)); | |
95 | ||
96 | #define __AfterRcvRpc(msgid, _NAME_) \ | |
97 | KERNEL_DEBUG_CONSTANT(KDBG_MIGCODE(msgid) | DBG_FUNC_END, \ | |
98 | (unsigned int)(0), \ | |
99 | (unsigned int)(0), \ | |
100 | (unsigned int)(0), \ | |
101 | (unsigned int)(0), \ | |
102 | (unsigned int)(0)); | |
103 | ||
104 | ||
105 | #define __BeforeRcvSimple(msgid, _NAME_) \ | |
106 | KERNEL_DEBUG_CONSTANT(KDBG_MIGCODE(msgid) | DBG_FUNC_START, \ | |
107 | (unsigned int)(0), \ | |
108 | (unsigned int)(0), \ | |
109 | (unsigned int)(0), \ | |
110 | (unsigned int)(0), \ | |
111 | (unsigned int)(0)); | |
112 | ||
113 | #define __AfterRcvSimple(msgid, _NAME_) \ | |
114 | KERNEL_DEBUG_CONSTANT(KDBG_MIGCODE(msgid) | DBG_FUNC_END, \ | |
115 | (unsigned int)(0), \ | |
116 | (unsigned int)(0), \ | |
117 | (unsigned int)(0), \ | |
118 | (unsigned int)(0), \ | |
119 | (unsigned int)(0)); | |
120 | ||
121 | #endif /* !_MIG_TRACE_PARAMETERS_ */ | |
122 | ||
123 | #define _MIG_MSGID_INVALID(msgid) \ | |
124 | KERNEL_DEBUG_CONSTANT(MACHDBG_CODE(DBG_MACH_MSGID_INVALID, (msgid)), \ | |
125 | (unsigned int)(0), \ | |
126 | (unsigned int)(0), \ | |
127 | (unsigned int)(0), \ | |
128 | (unsigned int)(0), \ | |
129 | (unsigned int)(0)) | |
130 | ||
91447636 A |
131 | #endif /* XNU_KERNEL_PRIVATE */ |
132 | ||
133 | __BEGIN_DECLS | |
134 | ||
1c79356b A |
135 | /* Send a message from the kernel */ |
136 | extern mach_msg_return_t mach_msg_send_from_kernel( | |
137 | mach_msg_header_t *msg, | |
138 | mach_msg_size_t send_size); | |
139 | ||
140 | ||
141 | extern mach_msg_return_t mach_msg_rpc_from_kernel( | |
142 | mach_msg_header_t *msg, | |
143 | mach_msg_size_t send_size, | |
144 | mach_msg_size_t rcv_size); | |
145 | ||
91447636 A |
146 | __END_DECLS |
147 | ||
148 | #ifdef MACH_KERNEL_PRIVATE | |
149 | ||
1c79356b A |
150 | extern void mach_msg_receive_continue(void); |
151 | ||
91447636 A |
152 | /* Initialize kernel server dispatch table */ |
153 | extern void mig_init(void); | |
9bccf70c | 154 | |
0b4e3aa0 A |
155 | /* |
156 | * Kernel implementation of the MIG object base class | |
157 | * | |
158 | * Conforms to the MIGObjectInterface defined in <mach/mig.h> | |
159 | * Ports are automatically allocated for the duration of outstanding | |
160 | * cross-task references and then released. | |
161 | */ | |
162 | ||
163 | typedef struct mig_object { | |
91447636 | 164 | const IMIGObjectVtbl *pVtbl; /* our interface def */ |
0b4e3aa0 A |
165 | mach_port_t port; /* our port pointer */ |
166 | } mig_object_data_t; | |
167 | ||
168 | ||
169 | /* | |
170 | * MIG notify base class definition | |
171 | * These are chained off the mig object to which the are registered. | |
172 | * When that object triggers a notification delivery, we walk this | |
173 | * chain and deliver the appropriate notification. | |
174 | */ | |
175 | typedef struct mig_notify_object { | |
91447636 | 176 | const IMIGNotifyObjectVtbl *pVtbl; /* our interface def */ |
0b4e3aa0 A |
177 | mach_port_t port; /* our port pointer */ |
178 | } mig_notify_object_data_t; | |
179 | ||
91447636 A |
180 | extern kern_return_t mig_object_init( |
181 | mig_object_t mig_object, | |
182 | const IMIGObject *interface); | |
183 | ||
184 | extern void mig_object_destroy( | |
185 | mig_object_t mig_object); | |
186 | ||
187 | extern void mig_object_reference( | |
188 | mig_object_t mig_object); | |
189 | ||
190 | extern void mig_object_deallocate( | |
191 | mig_object_t mig_object); | |
192 | ||
193 | extern ipc_port_t convert_mig_object_to_port( | |
194 | mig_object_t mig_object); | |
195 | ||
196 | extern mig_object_t convert_port_to_mig_object( | |
197 | ipc_port_t port, | |
198 | const MIGIID *iid); | |
199 | ||
200 | boolean_t mig_object_no_senders( | |
201 | ipc_port_t port, | |
202 | mach_port_mscount_t mscount); | |
203 | ||
204 | #endif /* MACH_KERNEL_PRIVATE */ | |
0b4e3aa0 | 205 | |
91447636 | 206 | #endif /* _KERN_IPC_MIG_H_ */ |