]> git.saurik.com Git - apple/xnu.git/blob - osfmk/kern/ipc_mig.h
637b78fad6911e8e88e50e0d5c6926aae6db6045
[apple/xnu.git] / osfmk / kern / ipc_mig.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25 /*
26 * @OSF_COPYRIGHT@
27 */
28
29 #ifndef _IPC_MIG_H_
30 #define _IPC_MIG_H_
31
32 #include <mach/mig.h>
33 #include <mach/message.h>
34 #include <sys/kdebug.h>
35
36 /*
37 * Define the trace points for MIG-generated calls. One traces the input parameters
38 * to MIG called things, another traces the outputs, and one traces bad message IDs.
39 */
40 #ifdef _MIG_TRACE_PARAMETERS_
41
42 #define __BeforeRcvCallTrace(msgid,arg1,arg2,arg3,arg4) \
43 KERNEL_DEBUG_CONSTANT(KDBG_MIGCODE(msgid) | DBG_FUNC_START, \
44 (unsigned int)(arg1), \
45 (unsigned int)(arg2), \
46 (unsigned int)(arg3), \
47 (unsigned int)(arg4), \
48 (unsigned int)(0));
49
50 #define __AfterRcvCallTrace(msgid,arg1,arg2,arg3,arg4) \
51 KERNEL_DEBUG_CONSTANT(KDBG_MIGCODE(msgid) | DBG_FUNC_END, \
52 (unsigned int)(arg1), \
53 (unsigned int)(arg2), \
54 (unsigned int)(arg3), \
55 (unsigned int)(arg4), \
56 (unsigned int)(0));
57
58 #define __BeforeSimpleCallTrace(msgid,arg1,arg2,arg3,arg4) \
59 KERNEL_DEBUG_CONSTANT(KDBG_MIGCODE(msgid) | DBG_FUNC_START, \
60 (unsigned int)(arg1), \
61 (unsigned int)(arg2), \
62 (unsigned int)(arg3), \
63 (unsigned int)(arg4), \
64 (unsigned int)(0));
65
66 #define __AfterSimpleCallTrace(msgid,arg1,arg2,arg3,arg4) \
67 KERNEL_DEBUG_CONSTANT(KDBG_MIGCODE(msgid) | DBG_FUNC_END, \
68 (unsigned int)(arg1), \
69 (unsigned int)(arg2), \
70 (unsigned int)(arg3), \
71 (unsigned int)(arg4), \
72 (unsigned int)(0));
73
74 #else /* !_MIG_TRACE_PARAMETERS_ */
75
76 #define __BeforeRcvRpc(msgid, _NAME_) \
77 KERNEL_DEBUG_CONSTANT(KDBG_MIGCODE(msgid) | DBG_FUNC_START, \
78 (unsigned int)(0), \
79 (unsigned int)(0), \
80 (unsigned int)(0), \
81 (unsigned int)(0), \
82 (unsigned int)(0));
83
84 #define __AfterRcvRpc(msgid, _NAME_) \
85 KERNEL_DEBUG_CONSTANT(KDBG_MIGCODE(msgid) | DBG_FUNC_END, \
86 (unsigned int)(0), \
87 (unsigned int)(0), \
88 (unsigned int)(0), \
89 (unsigned int)(0), \
90 (unsigned int)(0));
91
92
93 #define __BeforeRcvSimple(msgid, _NAME_) \
94 KERNEL_DEBUG_CONSTANT(KDBG_MIGCODE(msgid) | DBG_FUNC_START, \
95 (unsigned int)(0), \
96 (unsigned int)(0), \
97 (unsigned int)(0), \
98 (unsigned int)(0), \
99 (unsigned int)(0));
100
101 #define __AfterRcvSimple(msgid, _NAME_) \
102 KERNEL_DEBUG_CONSTANT(KDBG_MIGCODE(msgid) | DBG_FUNC_END, \
103 (unsigned int)(0), \
104 (unsigned int)(0), \
105 (unsigned int)(0), \
106 (unsigned int)(0), \
107 (unsigned int)(0));
108
109 #endif /* !_MIG_TRACE_PARAMETERS_ */
110
111 #define _MIG_MSGID_INVALID(msgid) \
112 KERNEL_DEBUG_CONSTANT(MACHDBG_CODE(DBG_MACH_MSGID_INVALID, (msgid)), \
113 (unsigned int)(0), \
114 (unsigned int)(0), \
115 (unsigned int)(0), \
116 (unsigned int)(0), \
117 (unsigned int)(0))
118
119 /* Send a message from the kernel */
120 extern mach_msg_return_t mach_msg_send_from_kernel(
121 mach_msg_header_t *msg,
122 mach_msg_size_t send_size);
123
124
125 extern mach_msg_return_t mach_msg_rpc_from_kernel(
126 mach_msg_header_t *msg,
127 mach_msg_size_t send_size,
128 mach_msg_size_t rcv_size);
129
130 extern void mach_msg_receive_continue(void);
131
132 #include <sys/appleapiopts.h>
133
134 #ifdef __APPLE_API_EVOLVING
135 /*
136 * Kernel implementation of the MIG object base class
137 *
138 * Conforms to the MIGObjectInterface defined in <mach/mig.h>
139 * Ports are automatically allocated for the duration of outstanding
140 * cross-task references and then released.
141 */
142
143 typedef struct mig_object {
144 IMIGObjectVtbl *pVtbl; /* our interface def */
145 mach_port_t port; /* our port pointer */
146 } mig_object_data_t;
147
148
149 /*
150 * MIG notify base class definition
151 * These are chained off the mig object to which the are registered.
152 * When that object triggers a notification delivery, we walk this
153 * chain and deliver the appropriate notification.
154 */
155 typedef struct mig_notify_object {
156 IMIGNotifyObjectVtbl *pVtbl; /* our interface def */
157 mach_port_t port; /* our port pointer */
158 } mig_notify_object_data_t;
159
160 #endif /* __APPLE_API_EVOLVING */
161
162 #endif /* _IPC_MIG_H_ */