]> git.saurik.com Git - apple/xnu.git/blob - osfmk/kern/ipc_mig.h
72a7afa137babdd86d5a05bd8192143343134933
[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 * 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.
11 *
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
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
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.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /*
23 * @OSF_COPYRIGHT@
24 */
25
26 #ifndef _IPC_MIG_H_
27 #define _IPC_MIG_H_
28
29 #include <mach/mig.h>
30 #include <mach/message.h>
31 #include <sys/kdebug.h>
32
33 /*
34 * Define the trace points for MIG-generated calls. One traces the input parameters
35 * to MIG called things, another traces the outputs, and one traces bad message IDs.
36 */
37 #ifdef _MIG_TRACE_PARAMETERS_
38
39 #define __BeforeRcvCallTrace(msgid,arg1,arg2,arg3,arg4) \
40 KERNEL_DEBUG_CONSTANT(KDBG_MIGCODE(msgid) | DBG_FUNC_START, \
41 (unsigned int)(arg1), \
42 (unsigned int)(arg2), \
43 (unsigned int)(arg3), \
44 (unsigned int)(arg4), \
45 (unsigned int)(0));
46
47 #define __AfterRcvCallTrace(msgid,arg1,arg2,arg3,arg4) \
48 KERNEL_DEBUG_CONSTANT(KDBG_MIGCODE(msgid) | DBG_FUNC_END, \
49 (unsigned int)(arg1), \
50 (unsigned int)(arg2), \
51 (unsigned int)(arg3), \
52 (unsigned int)(arg4), \
53 (unsigned int)(0));
54
55 #define __BeforeSimpleCallTrace(msgid,arg1,arg2,arg3,arg4) \
56 KERNEL_DEBUG_CONSTANT(KDBG_MIGCODE(msgid) | DBG_FUNC_START, \
57 (unsigned int)(arg1), \
58 (unsigned int)(arg2), \
59 (unsigned int)(arg3), \
60 (unsigned int)(arg4), \
61 (unsigned int)(0));
62
63 #define __AfterSimpleCallTrace(msgid,arg1,arg2,arg3,arg4) \
64 KERNEL_DEBUG_CONSTANT(KDBG_MIGCODE(msgid) | DBG_FUNC_END, \
65 (unsigned int)(arg1), \
66 (unsigned int)(arg2), \
67 (unsigned int)(arg3), \
68 (unsigned int)(arg4), \
69 (unsigned int)(0));
70
71 #else /* !_MIG_TRACE_PARAMETERS_ */
72
73 #define __BeforeRcvRpc(msgid, _NAME_) \
74 KERNEL_DEBUG_CONSTANT(KDBG_MIGCODE(msgid) | DBG_FUNC_START, \
75 (unsigned int)(0), \
76 (unsigned int)(0), \
77 (unsigned int)(0), \
78 (unsigned int)(0), \
79 (unsigned int)(0));
80
81 #define __AfterRcvRpc(msgid, _NAME_) \
82 KERNEL_DEBUG_CONSTANT(KDBG_MIGCODE(msgid) | DBG_FUNC_END, \
83 (unsigned int)(0), \
84 (unsigned int)(0), \
85 (unsigned int)(0), \
86 (unsigned int)(0), \
87 (unsigned int)(0));
88
89
90 #define __BeforeRcvSimple(msgid, _NAME_) \
91 KERNEL_DEBUG_CONSTANT(KDBG_MIGCODE(msgid) | DBG_FUNC_START, \
92 (unsigned int)(0), \
93 (unsigned int)(0), \
94 (unsigned int)(0), \
95 (unsigned int)(0), \
96 (unsigned int)(0));
97
98 #define __AfterRcvSimple(msgid, _NAME_) \
99 KERNEL_DEBUG_CONSTANT(KDBG_MIGCODE(msgid) | DBG_FUNC_END, \
100 (unsigned int)(0), \
101 (unsigned int)(0), \
102 (unsigned int)(0), \
103 (unsigned int)(0), \
104 (unsigned int)(0));
105
106 #endif /* !_MIG_TRACE_PARAMETERS_ */
107
108 #define _MIG_MSGID_INVALID(msgid) \
109 KERNEL_DEBUG_CONSTANT(MACHDBG_CODE(DBG_MACH_MSGID_INVALID, (msgid)), \
110 (unsigned int)(0), \
111 (unsigned int)(0), \
112 (unsigned int)(0), \
113 (unsigned int)(0), \
114 (unsigned int)(0))
115
116 /* Send a message from the kernel */
117 extern mach_msg_return_t mach_msg_send_from_kernel(
118 mach_msg_header_t *msg,
119 mach_msg_size_t send_size);
120
121
122 extern mach_msg_return_t mach_msg_rpc_from_kernel(
123 mach_msg_header_t *msg,
124 mach_msg_size_t send_size,
125 mach_msg_size_t rcv_size);
126
127 extern void mach_msg_receive_continue(void);
128
129 /*
130 * Kernel implementation of the MIG object base class
131 *
132 * Conforms to the MIGObjectInterface defined in <mach/mig.h>
133 * Ports are automatically allocated for the duration of outstanding
134 * cross-task references and then released.
135 */
136
137 typedef struct mig_object {
138 IMIGObjectVtbl *pVtbl; /* our interface def */
139 mach_port_t port; /* our port pointer */
140 } mig_object_data_t;
141
142
143 /*
144 * MIG notify base class definition
145 * These are chained off the mig object to which the are registered.
146 * When that object triggers a notification delivery, we walk this
147 * chain and deliver the appropriate notification.
148 */
149 typedef struct mig_notify_object {
150 IMIGNotifyObjectVtbl *pVtbl; /* our interface def */
151 mach_port_t port; /* our port pointer */
152 } mig_notify_object_data_t;
153
154
155 #endif /* _IPC_MIG_H_ */