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