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