]> git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/vm_types.h
cfc8fddfc7e9b8a131494cb872444727524f9bb7
[apple/xnu.git] / osfmk / mach / 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 #ifndef _MACH_VM_TYPES_H_
35 #define _MACH_VM_TYPES_H_
36
37 #include <mach/port.h>
38 #include <mach/machine/vm_types.h>
39
40 #include <stdint.h>
41
42 typedef vm_offset_t pointer_t;
43 typedef vm_offset_t vm_address_t;
44
45 /*
46 * We use addr64_t for 64-bit addresses that are used on both
47 * 32 and 64-bit machines. On PPC, they are passed and returned as
48 * two adjacent 32-bit GPRs. We use addr64_t in places where
49 * common code must be useable both on 32 and 64-bit machines.
50 */
51 typedef uint64_t addr64_t; /* Basic effective address */
52
53 /*
54 * We use reg64_t for addresses that are 32 bits on a 32-bit
55 * machine, and 64 bits on a 64-bit machine, but are always
56 * passed and returned in a single GPR on PPC. This type
57 * cannot be used in generic 32-bit c, since on a 64-bit
58 * machine the upper half of the register will be ignored
59 * by the c compiler in 32-bit mode. In c, we can only use the
60 * type in prototypes of functions that are written in and called
61 * from assembly language. This type is basically a comment.
62 */
63 typedef uint32_t reg64_t;
64
65 /*
66 * To minimize the use of 64-bit fields, we keep some physical
67 * addresses (that are page aligned) as 32-bit page numbers.
68 * This limits the physical address space to 16TB of RAM.
69 */
70 typedef uint32_t ppnum_t; /* Physical page number */
71 #define PPNUM_MAX UINT32_MAX
72
73
74 #ifdef KERNEL_PRIVATE
75
76 #include <sys/cdefs.h>
77
78 #ifndef MACH_KERNEL_PRIVATE
79 /*
80 * Use specifically typed null structures for these in
81 * other parts of the kernel to enable compiler warnings
82 * about type mismatches, etc... Otherwise, these would
83 * be void*.
84 */
85 __BEGIN_DECLS
86
87 struct pmap ;
88 struct vm_map ;
89 struct vm_object ;
90
91 __END_DECLS
92
93 #endif /* MACH_KERNEL_PRIVATE */
94
95 typedef struct pmap *pmap_t;
96 typedef struct vm_map *vm_map_t;
97 typedef struct vm_object *vm_object_t;
98
99 #define PMAP_NULL ((pmap_t) 0)
100 #define VM_OBJECT_NULL ((vm_object_t) 0)
101
102 #else /* KERNEL_PRIVATE */
103
104 typedef mach_port_t vm_map_t;
105
106 #endif /* KERNEL_PRIVATE */
107
108 #define VM_MAP_NULL ((vm_map_t) 0)
109
110 /*
111 * Evolving definitions, likely to change.
112 */
113
114 typedef uint64_t vm_object_offset_t;
115 typedef uint64_t vm_object_size_t;
116
117 #ifdef KERNEL_PRIVATE
118
119 #ifndef MACH_KERNEL_PRIVATE
120
121 __BEGIN_DECLS
122
123 struct upl ;
124 struct vm_map_copy ;
125 struct vm_named_entry ;
126
127 __END_DECLS
128
129 #endif /* MACH_KERNEL_PRIVATE */
130
131 typedef struct upl *upl_t;
132 typedef struct vm_map_copy *vm_map_copy_t;
133 typedef struct vm_named_entry *vm_named_entry_t;
134
135 #define VM_MAP_COPY_NULL ((vm_map_copy_t) 0)
136
137 #else /* KERNEL_PRIVATE */
138
139 typedef mach_port_t upl_t;
140 typedef mach_port_t vm_named_entry_t;
141
142 #endif /* KERNEL_PRIVATE */
143
144 #define UPL_NULL ((upl_t) 0)
145 #define VM_NAMED_ENTRY_NULL ((vm_named_entry_t) 0)
146
147 #endif /* _MACH_VM_TYPES_H_ */