]> git.saurik.com Git - apple/xnu.git/blob - osfmk/kern/ipc_kobject.h
d2a517c5521adfb76acd15dd56efc994c65ffe6e
[apple/xnu.git] / osfmk / kern / ipc_kobject.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 * Mach Operating System
27 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
28 * All Rights Reserved.
29 *
30 * Permission to use, copy, modify and distribute this software and its
31 * documentation is hereby granted, provided that both the copyright
32 * notice and this permission notice appear in all copies of the
33 * software, derivative works or modified versions, and any portions
34 * thereof, and that both notices appear in supporting documentation.
35 *
36 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
37 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
38 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
39 *
40 * Carnegie Mellon requests users of this software to return to
41 *
42 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
43 * School of Computer Science
44 * Carnegie Mellon University
45 * Pittsburgh PA 15213-3890
46 *
47 * any improvements or extensions that they make and grant Carnegie Mellon
48 * the rights to redistribute these changes.
49 */
50 /*
51 */
52 /*
53 * File: kern/ipc_kobject.h
54 * Author: Rich Draves
55 * Date: 1989
56 *
57 * Declarations for letting a port represent a kernel object.
58 */
59
60 #include <ipc/ipc_kmsg.h>
61 #include <ipc/ipc_port.h>
62
63 #ifndef _KERN_IPC_KOBJECT_H_
64 #define _KERN_IPC_KOBJECT_H_
65
66 #ifdef KERNEL_PRIVATE
67 /*
68 * This is the legacy in-kernel ipc-object mechanism. Over the next
69 * several months, this will be phased out in favor of a mechanism that
70 * is less Mach IPC specific, and common across in-mach, in-kernel-component,
71 * and user-level-component (Plugin) models.
72 */
73 #include <mach/machine/vm_types.h>
74 #include <mach/mach_types.h>
75
76 typedef natural_t ipc_kobject_type_t;
77
78 #define IKOT_NONE 0
79 #define IKOT_THREAD 1
80 #define IKOT_TASK 2
81 #define IKOT_HOST 3
82 #define IKOT_HOST_PRIV 4
83 #define IKOT_PROCESSOR 5
84 #define IKOT_PSET 6
85 #define IKOT_PSET_NAME 7
86 #define IKOT_TIMER 8
87 #define IKOT_PAGING_REQUEST 9
88 #define IKOT_DEVICE 10
89 #define IKOT_XMM_OBJECT 11
90 #define IKOT_XMM_PAGER 12
91 #define IKOT_XMM_KERNEL 13
92 #define IKOT_XMM_REPLY 14
93 #define IKOT_UND_REPLY 15
94 /* NOT DEFINED 16 */
95 #define IKOT_HOST_SECURITY 17
96 #define IKOT_LEDGER 18
97 #define IKOT_MASTER_DEVICE 19
98 #define IKOT_ACT 20
99 #define IKOT_SUBSYSTEM 21
100 #define IKOT_IO_DONE_QUEUE 22
101 #define IKOT_SEMAPHORE 23
102 #define IKOT_LOCK_SET 24
103 #define IKOT_CLOCK 25
104 #define IKOT_CLOCK_CTRL 26
105 #define IKOT_IOKIT_SPARE 27
106 #define IKOT_NAMED_ENTRY 28
107 #define IKOT_IOKIT_CONNECT 29
108 #define IKOT_IOKIT_OBJECT 30
109 #define IKOT_UPL 31
110 /* << new entries here */
111 #define IKOT_UNKNOWN 32 /* magic catchall */
112 #define IKOT_MAX_TYPE 33 /* # of IKOT_ types */
113
114 /* Please keep ipc/ipc_object.c:ikot_print_array up to date */
115
116 #define is_ipc_kobject(ikot) ((ikot) != IKOT_NONE)
117
118 /*
119 * Define types of kernel objects that use page lists instead
120 * of entry lists for copyin of out of line memory.
121 */
122
123 #define ipc_kobject_vm_page_list(ikot) \
124 ((ikot) == IKOT_PAGING_REQUEST || (ikot) == IKOT_DEVICE)
125
126 #define ipc_kobject_vm_page_steal(ikot) ((ikot) == IKOT_PAGING_REQUEST)
127
128 /* Initialize kernel server dispatch table */
129 extern void mig_init(void);
130
131 /* Dispatch a kernel server function */
132 extern ipc_kmsg_t ipc_kobject_server(
133 ipc_kmsg_t request);
134
135 /* Make a port represent a kernel object of the given type */
136 extern void ipc_kobject_set(
137 ipc_port_t port,
138 ipc_kobject_t kobject,
139 ipc_kobject_type_t type);
140
141 extern void ipc_kobject_set_atomically(
142 ipc_port_t port,
143 ipc_kobject_t kobject,
144 ipc_kobject_type_t type);
145
146 /* Release any kernel object resources associated with a port */
147 extern void ipc_kobject_destroy(
148 ipc_port_t port);
149
150 #define null_conversion(port) (port)
151
152 #endif /* KERNEL_PRIVATE */
153
154 #endif /* _KERN_IPC_KOBJECT_H_ */