]> git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/vm_types.h
1cc9723f412af14e6f7a8d3b13df74b27d76b31a
[apple/xnu.git] / osfmk / mach / vm_types.h
1 /*
2 * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_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. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23 /*
24 * @OSF_COPYRIGHT@
25 *
26 */
27 #ifndef _MACH_VM_TYPES_H_
28 #define _MACH_VM_TYPES_H_
29
30 #include <mach/port.h>
31 #include <mach/machine/vm_types.h>
32
33 #include <stdint.h>
34
35 typedef vm_offset_t pointer_t;
36 typedef vm_offset_t vm_address_t;
37
38 /*
39 * We use addr64_t for 64-bit addresses that are used on both
40 * 32 and 64-bit machines. On PPC, they are passed and returned as
41 * two adjacent 32-bit GPRs. We use addr64_t in places where
42 * common code must be useable both on 32 and 64-bit machines.
43 */
44 typedef uint64_t addr64_t; /* Basic effective address */
45
46 /*
47 * We use reg64_t for addresses that are 32 bits on a 32-bit
48 * machine, and 64 bits on a 64-bit machine, but are always
49 * passed and returned in a single GPR on PPC. This type
50 * cannot be used in generic 32-bit c, since on a 64-bit
51 * machine the upper half of the register will be ignored
52 * by the c compiler in 32-bit mode. In c, we can only use the
53 * type in prototypes of functions that are written in and called
54 * from assembly language. This type is basically a comment.
55 */
56 typedef uint32_t reg64_t;
57
58 /*
59 * To minimize the use of 64-bit fields, we keep some physical
60 * addresses (that are page aligned) as 32-bit page numbers.
61 * This limits the physical address space to 16TB of RAM.
62 */
63 typedef uint32_t ppnum_t; /* Physical page number */
64 #define PPNUM_MAX UINT32_MAX
65
66
67 #ifdef KERNEL_PRIVATE
68
69 #include <sys/cdefs.h>
70
71 #ifndef MACH_KERNEL_PRIVATE
72 /*
73 * Use specifically typed null structures for these in
74 * other parts of the kernel to enable compiler warnings
75 * about type mismatches, etc... Otherwise, these would
76 * be void*.
77 */
78 __BEGIN_DECLS
79
80 struct pmap ;
81 struct vm_map ;
82 struct vm_object ;
83
84 __END_DECLS
85
86 #endif /* MACH_KERNEL_PRIVATE */
87
88 typedef struct pmap *pmap_t;
89 typedef struct vm_map *vm_map_t;
90 typedef struct vm_object *vm_object_t;
91
92 #define PMAP_NULL ((pmap_t) 0)
93 #define VM_OBJECT_NULL ((vm_object_t) 0)
94
95 #else /* KERNEL_PRIVATE */
96
97 typedef mach_port_t vm_map_t;
98
99 #endif /* KERNEL_PRIVATE */
100
101 #define VM_MAP_NULL ((vm_map_t) 0)
102
103 /*
104 * Evolving definitions, likely to change.
105 */
106
107 typedef uint64_t vm_object_offset_t;
108 typedef uint64_t vm_object_size_t;
109
110 #ifdef KERNEL_PRIVATE
111
112 #ifndef MACH_KERNEL_PRIVATE
113
114 __BEGIN_DECLS
115
116 struct upl ;
117 struct vm_map_copy ;
118 struct vm_named_entry ;
119
120 __END_DECLS
121
122 #endif /* MACH_KERNEL_PRIVATE */
123
124 typedef struct upl *upl_t;
125 typedef struct vm_map_copy *vm_map_copy_t;
126 typedef struct vm_named_entry *vm_named_entry_t;
127
128 #define VM_MAP_COPY_NULL ((vm_map_copy_t) 0)
129
130 #else /* KERNEL_PRIVATE */
131
132 typedef mach_port_t upl_t;
133 typedef mach_port_t vm_named_entry_t;
134
135 #endif /* KERNEL_PRIVATE */
136
137 #define UPL_NULL ((upl_t) 0)
138 #define VM_NAMED_ENTRY_NULL ((vm_named_entry_t) 0)
139
140 #endif /* _MACH_VM_TYPES_H_ */