]> git.saurik.com Git - apple/xnu.git/blame - osfmk/kern/ipc_mig.h
xnu-517.11.1.tar.gz
[apple/xnu.git] / osfmk / kern / ipc_mig.h
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
e5568f75
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 *
e5568f75
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,
e5568f75
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
26#ifndef _IPC_MIG_H_
27#define _IPC_MIG_H_
28
0b4e3aa0 29#include <mach/mig.h>
1c79356b
A
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 */
117extern mach_msg_return_t mach_msg_send_from_kernel(
118 mach_msg_header_t *msg,
119 mach_msg_size_t send_size);
120
121
122extern 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
127extern void mach_msg_receive_continue(void);
128
9bccf70c
A
129#include <sys/appleapiopts.h>
130
131#ifdef __APPLE_API_EVOLVING
0b4e3aa0
A
132/*
133 * Kernel implementation of the MIG object base class
134 *
135 * Conforms to the MIGObjectInterface defined in <mach/mig.h>
136 * Ports are automatically allocated for the duration of outstanding
137 * cross-task references and then released.
138 */
139
140typedef struct mig_object {
141 IMIGObjectVtbl *pVtbl; /* our interface def */
142 mach_port_t port; /* our port pointer */
143} mig_object_data_t;
144
145
146/*
147 * MIG notify base class definition
148 * These are chained off the mig object to which the are registered.
149 * When that object triggers a notification delivery, we walk this
150 * chain and deliver the appropriate notification.
151 */
152typedef struct mig_notify_object {
153 IMIGNotifyObjectVtbl *pVtbl; /* our interface def */
154 mach_port_t port; /* our port pointer */
155} mig_notify_object_data_t;
156
9bccf70c 157#endif /* __APPLE_API_EVOLVING */
0b4e3aa0 158
1c79356b 159#endif /* _IPC_MIG_H_ */