]> git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/ppc/vm_types.h
b5b0bd8a48d9d1e70317ce1863f479710919dca0
[apple/xnu.git] / osfmk / mach / ppc / vm_types.h
1 /*
2 * Copyright (c) 2000-2004 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,1988 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 /*
54 * File: vm_types.h
55 * Author: Avadis Tevanian, Jr.
56 * Date: 1985
57 *
58 * Header file for VM data types. PPC version.
59 */
60
61 #ifndef _MACH_PPC_VM_TYPES_H_
62 #define _MACH_PPC_VM_TYPES_H_
63
64 #ifndef ASSEMBLER
65
66 #include <ppc/_types.h>
67 #include <ppc/vmparam.h>
68 #include <stdint.h>
69
70 /*
71 * natural_t and integer_t are Mach's legacy types for machine-
72 * independent integer types (unsigned, and signed, respectively).
73 * Their original purpose was to define other types in a machine/
74 * compiler independent way.
75 *
76 * They also had an implicit "same size as pointer" characteristic
77 * to them (i.e. Mach's traditional types are very ILP32 or ILP64
78 * centric). We support PowerPC ABIs that do not follow either of
79 * these models (specifically LP64). Therefore, we had to make a
80 * choice between making these types scale with pointers or stay
81 * tied to integers. Because their use is predominantly tied to
82 * to the size of an integer, we are keeping that association and
83 * breaking free from pointer size guarantees.
84 *
85 * New use of these types is discouraged.
86 */
87 typedef __darwin_natural_t natural_t;
88 typedef int integer_t;
89
90 #if defined(__ppc__)
91
92 /*
93 * For 32-bit PowerPC ABIs, the scalable types were
94 * always based upon natural_t (unsigned int).
95 * Because of potential legacy issues with name mangling,
96 * we cannot use the stdint uintptr_t type.
97 */
98 typedef natural_t vm_offset_t;
99 typedef natural_t vm_size_t;
100
101 #else /* __ppc64__ */
102
103 /*
104 * For 64-bit PowerPC ABIs, we have no legacy name mangling
105 * issues, so we use the stdint types for scaling these
106 * types to the same size as a pointer.
107 */
108 typedef uintptr_t vm_offset_t;
109 typedef uintptr_t vm_size_t;
110
111 #endif
112
113 /*
114 * This new type is independent of a particular vm map's
115 * implementation size - and represents appropriate types
116 * for all possible maps. This is used for interfaces
117 * where the size of the map is not known - or we don't
118 * want to have to distinguish.
119 */
120 typedef uint64_t mach_vm_address_t;
121 typedef uint64_t mach_vm_offset_t;
122 typedef uint64_t mach_vm_size_t;
123
124 /* LP64todo - convert these over for good */
125 #if 1
126 typedef uint64_t vm_map_offset_t;
127 typedef uint64_t vm_map_address_t;
128 typedef uint64_t vm_map_size_t;
129 #else
130 typedef uint32_t vm_map_offset_t;
131 typedef uint32_t vm_map_address_t;
132 typedef uint32_t vm_map_size_t;
133 #endif
134
135 #ifdef MACH_KERNEL_PRIVATE
136
137 #ifdef VM32_SUPPORT
138
139 /*
140 * These are types used internal to Mach to implement the
141 * legacy 32-bit VM APIs published by the kernel.
142 */
143 typedef uint32_t vm32_address_t;
144 typedef uint32_t vm32_offset_t;
145 typedef uint32_t vm32_size_t;
146
147 #endif /* VM32_SUPPORT */
148
149 #endif /* MACH_KERNEL_PRIVATE */
150
151 #endif /* ASSEMBLER */
152
153 /*
154 * If composing messages by hand (please do not)
155 */
156 #define MACH_MSG_TYPE_INTEGER_T MACH_MSG_TYPE_INTEGER_32
157
158 #endif /* _MACH_PPC_VM_TYPES_H_ */