]> git.saurik.com Git - apple/xnu.git/blob - osfmk/vm/vm_kern.h
95302993fc75f5011fa7a4b77e19c378dac6ee69
[apple/xnu.git] / osfmk / vm / vm_kern.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /*
23 * @OSF_COPYRIGHT@
24 */
25 /*
26 * Mach Operating System
27 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
28 * All Rights Reserved.
29 *
30 * Permission to use, copy, modify and distribute this software and its
31 * documentation is hereby granted, provided that both the copyright
32 * notice and this permission notice appear in all copies of the
33 * software, derivative works or modified versions, and any portions
34 * thereof, and that both notices appear in supporting documentation.
35 *
36 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
37 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
38 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
39 *
40 * Carnegie Mellon requests users of this software to return to
41 *
42 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
43 * School of Computer Science
44 * Carnegie Mellon University
45 * Pittsburgh PA 15213-3890
46 *
47 * any improvements or extensions that they make and grant Carnegie Mellon
48 * the rights to redistribute these changes.
49 */
50 /*
51 */
52 /*
53 * File: vm/vm_kern.h
54 * Author: Avadis Tevanian, Jr., Michael Wayne Young
55 * Date: 1985
56 *
57 * Kernel memory management definitions.
58 */
59
60 #ifndef _VM_VM_KERN_H_
61 #define _VM_VM_KERN_H_
62
63 #include <mach/boolean.h>
64 #include <mach/kern_return.h>
65 #include <mach/machine/vm_types.h>
66 #include <vm/vm_map.h>
67
68 extern void kmem_init(
69 vm_offset_t start,
70 vm_offset_t end);
71
72 extern kern_return_t kernel_memory_allocate(
73 vm_map_t map,
74 vm_offset_t *addrp,
75 vm_size_t size,
76 vm_offset_t mask,
77 int flags);
78
79 /* flags for kernel_memory_allocate */
80 #define KMA_HERE 0x01
81 #define KMA_NOPAGEWAIT 0x02
82 #define KMA_KOBJECT 0x04
83
84 extern kern_return_t kmem_alloc_contig(
85 vm_map_t map,
86 vm_offset_t *addrp,
87 vm_size_t size,
88 vm_offset_t mask,
89 int flags);
90
91 extern kern_return_t kmem_alloc(
92 vm_map_t map,
93 vm_offset_t *addrp,
94 vm_size_t size);
95
96 extern kern_return_t kmem_alloc_pageable(
97 vm_map_t map,
98 vm_offset_t *addrp,
99 vm_size_t size);
100
101 extern kern_return_t kmem_alloc_wired(
102 vm_map_t map,
103 vm_offset_t *addrp,
104 vm_size_t size);
105
106 extern kern_return_t kmem_alloc_aligned(
107 vm_map_t map,
108 vm_offset_t *addrp,
109 vm_size_t size);
110
111 extern kern_return_t kmem_realloc(
112 vm_map_t map,
113 vm_offset_t oldaddr,
114 vm_size_t oldsize,
115 vm_offset_t *newaddrp,
116 vm_size_t newsize);
117
118 extern void kmem_free(
119 vm_map_t map,
120 vm_offset_t addr,
121 vm_size_t size);
122
123 extern kern_return_t kmem_suballoc(
124 vm_map_t parent,
125 vm_offset_t *addr,
126 vm_size_t size,
127 boolean_t pageable,
128 boolean_t anywhere,
129 vm_map_t *new_map);
130
131 extern void kmem_io_object_deallocate(
132 vm_map_copy_t copy);
133
134 extern kern_return_t kmem_io_object_trunc(
135 vm_map_copy_t copy,
136 vm_size_t new_size);
137
138 extern boolean_t copyinmap(
139 vm_map_t map,
140 vm_offset_t fromaddr,
141 vm_offset_t toaddr,
142 vm_size_t length);
143
144 extern boolean_t copyoutmap(
145 vm_map_t map,
146 vm_offset_t fromaddr,
147 vm_offset_t toaddr,
148 vm_size_t length);
149
150 extern vm_map_t kernel_map;
151 extern vm_map_t kernel_pageable_map;
152 extern vm_map_t ipc_kernel_map;
153
154 #endif /* _VM_VM_KERN_H_ */