]> git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/i386/vm_types.h
d76d83026d15c9b908ec52bfcd8be2fd8081d30c
[apple/xnu.git] / osfmk / mach / i386 / vm_types.h
1 /*
2 * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
14 * agreement.
15 *
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
18 * file.
19 *
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
27 *
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
29 */
30 /*
31 * @OSF_COPYRIGHT@
32 */
33 /*
34 * Mach Operating System
35 * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
36 * All Rights Reserved.
37 *
38 * Permission to use, copy, modify and distribute this software and its
39 * documentation is hereby granted, provided that both the copyright
40 * notice and this permission notice appear in all copies of the
41 * software, derivative works or modified versions, and any portions
42 * thereof, and that both notices appear in supporting documentation.
43 *
44 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
45 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
46 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
47 *
48 * Carnegie Mellon requests users of this software to return to
49 *
50 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
51 * School of Computer Science
52 * Carnegie Mellon University
53 * Pittsburgh PA 15213-3890
54 *
55 * any improvements or extensions that they make and grant Carnegie Mellon
56 * the rights to redistribute these changes.
57 */
58 /*
59 */
60
61 /*
62 * File: vm_types.h
63 * Author: Avadis Tevanian, Jr.
64 * Date: 1985
65 *
66 * Header file for VM data types. I386 version.
67 */
68
69 #ifndef _MACH_I386_VM_TYPES_H_
70 #define _MACH_I386_VM_TYPES_H_
71
72 #ifndef ASSEMBLER
73
74 #include <i386/_types.h>
75 #include <stdint.h>
76
77 /*
78 * natural_t and integer_t are Mach's legacy types for machine-
79 * independent integer types (unsigned, and signed, respectively).
80 * Their original purpose was to define other types in a machine/
81 * compiler independent way.
82 *
83 * They also had an implicit "same size as pointer" characteristic
84 * to them (i.e. Mach's traditional types are very ILP32 or ILP64
85 * centric). We will likely support x86 ABIs that do not follow
86 * either ofthese models (specifically LP64). Therefore, we had to
87 * make a choice between making these types scale with pointers or stay
88 * tied to integers. Because their use is predominantly tied to
89 * to the size of an integer, we are keeping that association and
90 * breaking free from pointer size guarantees.
91 *
92 * New use of these types is discouraged.
93 */
94 typedef __darwin_natural_t natural_t;
95 typedef int integer_t;
96
97 /*
98 * A vm_offset_t is a type-neutral pointer,
99 * e.g. an offset into a virtual memory space.
100 */
101 typedef natural_t vm_offset_t;
102
103 /*
104 * A vm_size_t is the proper type for e.g.
105 * expressing the difference between two
106 * vm_offset_t entities.
107 */
108 typedef natural_t vm_size_t;
109
110 /*
111 * This new type is independent of a particular vm map's
112 * implementation size - and represents appropriate types
113 * for all possible maps. This is used for interfaces
114 * where the size of the map is not known - or we don't
115 * want to have to distinguish.
116 */
117 typedef uint32_t mach_vm_address_t;
118 typedef uint32_t mach_vm_offset_t;
119 typedef uint32_t mach_vm_size_t;
120
121 /* LP64todo - convert these over for good */
122 #if 0
123 typedef uint64_t vm_map_offset_t;
124 typedef uint64_t vm_map_address_t;
125 typedef uint64_t vm_map_size_t;
126 #define VM_MAP_MIN_ADDRESS MACH_VM_MIN_ADDRESS
127 #define VM_MAP_MAX_ADDRESS MACH_VM_MAX_ADDRESS
128 #else
129 typedef uint32_t vm_map_offset_t;
130 typedef uint32_t vm_map_address_t;
131 typedef uint32_t vm_map_size_t;
132 #define VM_MAP_MIN_ADDRESS VM_MIN_ADDRESS
133 #define VM_MAP_MAX_ADDRESS VM_MAX_ADDRESS
134 #endif
135
136 #ifdef MACH_KERNEL_PRIVATE
137
138 #ifdef VM32_SUPPORT
139
140 /*
141 * These are types used internal to Mach to implement the
142 * legacy 32-bit VM APIs published by the kernel.
143 */
144 typedef uint32_t vm32_address_t;
145 typedef uint32_t vm32_offset_t;
146 typedef uint32_t vm32_size_t;
147
148 #endif /* VM32_SUPPORT */
149
150 #endif /* MACH_KERNEL_PRIVATE */
151
152 #endif /* ASSEMBLER */
153
154 /*
155 * If composing messages by hand (please do not)
156 */
157 #define MACH_MSG_TYPE_INTEGER_T MACH_MSG_TYPE_INTEGER_32
158
159 #endif /* _MACH_I386_VM_TYPES_H_ */