xref: /trueos/sys/sys/mach/std_types.h (revision 4661f43f10ddcbf430bd8379b8358cca9c918ba9)
1 /*
2  * Copyright 1991-1998 by Open Software Foundation, Inc.
3  *              All Rights Reserved
4  *
5  * Permission to use, copy, modify, and distribute this software and
6  * its documentation for any purpose and without fee is hereby granted,
7  * provided that the above copyright notice appears in all copies and
8  * that both the copyright notice and this permission notice appear in
9  * supporting documentation.
10  *
11  * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
12  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
13  * FOR A PARTICULAR PURPOSE.
14  *
15  * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
16  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17  * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
18  * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
19  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20  */
21 /*
22  * MkLinux
23  */
24 /* CMU_HIST */
25 /*
26  * Revision 2.4  91/06/25  10:30:50  rpd
27  * 	Added ipc/ipc_port.h inside the kernel.
28  * 	[91/05/27            rpd]
29  *
30  * Revision 2.3  91/05/14  16:59:01  mrt
31  * 	Correcting copyright
32  *
33  * Revision 2.2  91/02/05  17:35:39  mrt
34  * 	Changed to new Mach copyright
35  * 	[91/02/01  17:20:57  mrt]
36  *
37  * Revision 2.1  89/08/03  16:04:44  rwd
38  * Created.
39  *
40  * Revision 2.3  89/02/25  18:40:23  gm0w
41  * 	Changes for cleanup.
42  *
43  * Revision 2.2  89/01/15  16:31:59  rpd
44  * 	Moved from kern/ to mach/.
45  * 	[89/01/15  14:34:14  rpd]
46  *
47  * Revision 2.2  89/01/12  07:59:07  rpd
48  * 	Created.
49  * 	[89/01/12  04:15:40  rpd]
50  *
51  */
52 /* CMU_ENDHIST */
53 /*
54  * Mach Operating System
55  * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
56  * All Rights Reserved.
57  *
58  * Permission to use, copy, modify and distribute this software and its
59  * documentation is hereby granted, provided that both the copyright
60  * notice and this permission notice appear in all copies of the
61  * software, derivative works or modified versions, and any portions
62  * thereof, and that both notices appear in supporting documentation.
63  *
64  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
65  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
66  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
67  *
68  * Carnegie Mellon requests users of this software to return to
69  *
70  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
71  *  School of Computer Science
72  *  Carnegie Mellon University
73  *  Pittsburgh PA 15213-3890
74  *
75  * any improvements or extensions that they make and grant Carnegie Mellon
76  * the rights to redistribute these changes.
77  */
78 /*
79  */
80 /*
81  *	Mach standard external interface type definitions.
82  *
83  */
84 
85 #ifndef	STD_TYPES_H_
86 #define	STD_TYPES_H_
87 #define MACH_KDB 0
88 #define MACH_COUNTERS 0
89 #define ZONE_DEBUG 0
90 #include <sys/mach/kern_return.h>
91 #include <sys/mach/port.h>
92 #include <sys/mach/vm_types.h>
93 
94 #ifdef _KERNEL
95 #include <sys/mach/mach_vm.h>
96 #include <sys/cdefs.h>
97 #include <sys/types.h>
98 #include <sys/param.h>
99 #include <sys/systm.h>
100 #include <sys/lock.h>
101 #include <sys/mutex.h>
102 
103 
104 #ifndef MACH_VERBOSE_DEBUGGING
105 #define MACH_VERBOSE_DEBUGGING 0
106 #endif
107 
108 #ifndef MDPRINTF
109 #if MACH_VERBOSE_DEBUGGING
110 #define MDPRINTF(x) printf x
111 #else
112 #define MDPRINTF(...)
113 #endif
114 #endif
115 
116 
117 #define decl_mutex_data(__annot, __lock) __annot struct mtx __lock;
118 #define assert(exp) KASSERT(exp, (#exp))
119 #define MACH_VERIFY(exp, str) do {					\
120 		if (!(exp)) printf str;				\
121 	} while (0)
122 #define mach_mutex_init(a, b) mtx_init(a, b, NULL, MTX_DEF|MTX_DUPOK)
123 #define MACH_IPC_DEBUG 0
124 #define MACH_DEBUG 0
125 #define MACH_MACHINE_ROUTINES 0
126 #define BYTE_SIZE NBBY
127 #define THREAD_NULL NULL
128 #define XK_PROXY 0
129 #define NORMA_IPC 0
130 #define VM_MAP_COPYIN_OPT_SRC_DESTROY 0
131 #define VM_MAP_COPYIN_OPT_STEAL_PAGES 0
132 #define VM_MAP_COPYIN_OPT_STEAL_PAGES 0
133 #define VM_MAP_REMOVE_WAIT_FOR_KWIRE 0
134 #define VM_MAP_REMOVE_INTERRUPTIBLE 0
135 #define page_aligned(addr) ((addr & PAGE_MASK) == 0)
136 /* XXX FIX THIS */
137 #define zinit(size1, sizemax, size2, name) uma_zcreate(name, size1, NULL, NULL, NULL, NULL, 0, 0)
138 #define zone_change(zone, flag, val)
139 #define kalloc(size) malloc(size, M_MACH_KALLOC, M_WAITOK)
140 #define KALLOC(size, rt) ((vm_offset_t)malloc(size, M_MACH_KALLOC, M_WAITOK))
141 #define kfree(ptr, size) free((void *)(ptr), M_MACH_KALLOC)
142 #define KFREE(ptr, size, rt) free((void *)(ptr), M_MACH_KALLOC)
143 #define copyinmsg copyin
144 #define copyoutmsg copyout
145 #if MACH_DEBUG && defined(INVARIANTS)
146 #define UNSUPPORTED { panic("%s not supported", __FUNCTION__); return (KERN_NOT_SUPPORTED); }
147 #elif defined(INVARIANTS)
148 #define UNSUPPORTED { printf("%s not supported", __FUNCTION__); return (KERN_NOT_SUPPORTED); }
149 #else
150 #define UNSUPPORTED { return (KERN_NOT_SUPPORTED); }
151 #endif
152 /* drop reference */
153 #define vm_map_copyin_page_list(map, addr, length, options, etc0, etc1) 0
154 #define vm_map_deallocate(map)
155 #define vm_object_pager_wakeup(map)
156 #define ds_notify(map) 0
157 #define ds_master_notify(map) 0
158 #define vm_map_copy_steal_pages(copy)
159 #define thread_deallocate(thread)
160 #define task_name_deallocate(task)
161 #define assert_wait(a, b)
162 #define cpu_number() curcpu
163 #define copyoutmap(a, b, c, d) copyout((const void *)b, (void *)c, d)
164 #define copyinmap(a, b, c, d) copyin((const void *)b, (void *)c, d)
165 
166 #define vm_allocate mach_vm_allocate
167 #define vm_deallocate mach_vm_deallocate
168 
169 #define decl_simple_lock_data(a, b) a struct mtx b;
170 
171 #include <vm/vm.h>
172 
173 #define VM_MAP_COPY_PAGE_LIST_MAX	20
174 #define	VM_MAP_COPY_PAGE_LIST_MAX_SIZE	(VM_MAP_COPY_PAGE_LIST_MAX * PAGE_SIZE)
175 
176 
177 #include <sys/mach/macro_help.h>
178 #else
179 #define decl_simple_lock_data(a, b)
180 #define decl_mutex_data(__annot, __lock)
181 #endif
182 #endif	/* STD_TYPES_H_ */
183