]> git.saurik.com Git - apple/xnu.git/blob - osfmk/kern/ipc_mig.h
2759aa5e6f5f2a9bf7bffefadaedb03070b34c35
[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/message.h>
30 #include <sys/kdebug.h>
31
32 /*
33 * Define the trace points for MIG-generated calls. One traces the input parameters
34 * to MIG called things, another traces the outputs, and one traces bad message IDs.
35 */
36 #ifdef _MIG_TRACE_PARAMETERS_
37
38 #define __BeforeRcvCallTrace(msgid,arg1,arg2,arg3,arg4) \
39 KERNEL_DEBUG_CONSTANT(KDBG_MIGCODE(msgid) | DBG_FUNC_START, \
40 (unsigned int)(arg1), \
41 (unsigned int)(arg2), \
42 (unsigned int)(arg3), \
43 (unsigned int)(arg4), \
44 (unsigned int)(0));
45
46 #define __AfterRcvCallTrace(msgid,arg1,arg2,arg3,arg4) \
47 KERNEL_DEBUG_CONSTANT(KDBG_MIGCODE(msgid) | DBG_FUNC_END, \
48 (unsigned int)(arg1), \
49 (unsigned int)(arg2), \
50 (unsigned int)(arg3), \
51 (unsigned int)(arg4), \
52 (unsigned int)(0));
53
54 #define __BeforeSimpleCallTrace(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 __AfterSimpleCallTrace(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 #else /* !_MIG_TRACE_PARAMETERS_ */
71
72 #define __BeforeRcvRpc(msgid, _NAME_) \
73 KERNEL_DEBUG_CONSTANT(KDBG_MIGCODE(msgid) | DBG_FUNC_START, \
74 (unsigned int)(0), \
75 (unsigned int)(0), \
76 (unsigned int)(0), \
77 (unsigned int)(0), \
78 (unsigned int)(0));
79
80 #define __AfterRcvRpc(msgid, _NAME_) \
81 KERNEL_DEBUG_CONSTANT(KDBG_MIGCODE(msgid) | DBG_FUNC_END, \
82 (unsigned int)(0), \
83 (unsigned int)(0), \
84 (unsigned int)(0), \
85 (unsigned int)(0), \
86 (unsigned int)(0));
87
88
89 #define __BeforeRcvSimple(msgid, _NAME_) \
90 KERNEL_DEBUG_CONSTANT(KDBG_MIGCODE(msgid) | DBG_FUNC_START, \
91 (unsigned int)(0), \
92 (unsigned int)(0), \
93 (unsigned int)(0), \
94 (unsigned int)(0), \
95 (unsigned int)(0));
96
97 #define __AfterRcvSimple(msgid, _NAME_) \
98 KERNEL_DEBUG_CONSTANT(KDBG_MIGCODE(msgid) | DBG_FUNC_END, \
99 (unsigned int)(0), \
100 (unsigned int)(0), \
101 (unsigned int)(0), \
102 (unsigned int)(0), \
103 (unsigned int)(0));
104
105 #endif /* !_MIG_TRACE_PARAMETERS_ */
106
107 #define _MIG_MSGID_INVALID(msgid) \
108 KERNEL_DEBUG_CONSTANT(MACHDBG_CODE(DBG_MACH_MSGID_INVALID, (msgid)), \
109 (unsigned int)(0), \
110 (unsigned int)(0), \
111 (unsigned int)(0), \
112 (unsigned int)(0), \
113 (unsigned int)(0))
114
115 /* Send a message from the kernel */
116 extern mach_msg_return_t mach_msg_send_from_kernel(
117 mach_msg_header_t *msg,
118 mach_msg_size_t send_size);
119
120
121 extern mach_msg_return_t mach_msg_rpc_from_kernel(
122 mach_msg_header_t *msg,
123 mach_msg_size_t send_size,
124 mach_msg_size_t rcv_size);
125
126 extern void mach_msg_receive_continue(void);
127
128 #endif /* _IPC_MIG_H_ */