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