]> git.saurik.com Git - apple/xnu.git/blame - osfmk/mach/vm_types.h
xnu-344.21.73.tar.gz
[apple/xnu.git] / osfmk / mach / vm_types.h
CommitLineData
1c79356b 1/*
9bccf70c 2 * Copyright (c) 2002,2000 Apple Computer, Inc. All rights reserved.
1c79356b
A
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
d7e50217 6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
1c79356b 7 *
d7e50217
A
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
1c79356b
A
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
d7e50217
A
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.
1c79356b
A
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
9bccf70c
A
32#include <stdint.h>
33#include <sys/appleapiopts.h>
34
0b4e3aa0 35#include <mach/port.h>
1c79356b
A
36#include <mach/machine/vm_types.h>
37
38typedef vm_offset_t pointer_t;
39typedef vm_offset_t vm_address_t;
9bccf70c 40typedef uint64_t vm_object_offset_t;
1c79356b 41
d7e50217
A
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 */
48typedef 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 */
60typedef 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 */
67typedef uint32_t ppnum_t; /* Physical page number */
68
69
1c79356b
A
70#ifdef KERNEL_PRIVATE
71
9bccf70c 72#if !defined(__APPLE_API_PRIVATE) || !defined(MACH_KERNEL_PRIVATE)
0b4e3aa0 73
1c79356b
A
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 */
1c79356b
A
80struct vm_map ;
81struct vm_object ;
9bccf70c
A
82
83#endif /* !__APPLE_API_PRIVATE || !MACH_KERNEL_PRIVATE */
84
85typedef struct vm_map *vm_map_t;
86typedef struct vm_object *vm_object_t;
87#define VM_OBJECT_NULL ((vm_object_t) 0)
88
89#else /* KERNEL_PRIVATE */
90
91typedef 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
103struct upl ;
1c79356b 104struct vm_map_copy ;
0b4e3aa0 105struct vm_named_entry ;
1c79356b
A
106#endif /* !MACH_KERNEL_PRIVATE */
107
0b4e3aa0 108typedef struct upl *upl_t;
9bccf70c 109typedef struct vm_map_copy *vm_map_copy_t;
0b4e3aa0
A
110typedef struct vm_named_entry *vm_named_entry_t;
111
0b4e3aa0
A
112#define VM_MAP_COPY_NULL ((vm_map_copy_t) 0)
113
114#else /* !KERNEL_PRIVATE */
115
116typedef mach_port_t upl_t;
0b4e3aa0
A
117typedef mach_port_t vm_named_entry_t;
118
119#endif /* !KERNEL_PRIVATE */
1c79356b 120
0b4e3aa0 121#define UPL_NULL ((upl_t) 0)
0b4e3aa0 122#define VM_NAMED_ENTRY_NULL ((vm_named_entry_t) 0)
1c79356b 123
9bccf70c
A
124#endif /* __APPLE_API_EVOLVING */
125
1c79356b
A
126#endif /* MACH_VM_TYPES_H_ */
127
128