106 |
* This initializes all of the zones. |
* This initializes all of the zones. |
107 |
*/ |
*/ |
108 |
|
|
109 |
|
#ifndef NDEBUG |
110 |
|
static int kalloc_init_called; |
111 |
|
#endif |
112 |
|
|
113 |
void kalloc_init() |
void kalloc_init() |
114 |
{ |
{ |
115 |
vm_offset_t min, max; |
vm_offset_t min, max; |
116 |
vm_size_t size; |
vm_size_t size; |
117 |
register int i; |
register int i; |
118 |
|
|
119 |
|
assert (! kalloc_init_called); |
120 |
|
|
121 |
kalloc_map = kmem_suballoc(kernel_map, &min, &max, |
kalloc_map = kmem_suballoc(kernel_map, &min, &max, |
122 |
kalloc_map_size, FALSE); |
kalloc_map_size, FALSE); |
123 |
|
|
148 |
size >= PAGE_SIZE ? ZONE_COLLECTABLE : 0, |
size >= PAGE_SIZE ? ZONE_COLLECTABLE : 0, |
149 |
k_zone_name[i]); |
k_zone_name[i]); |
150 |
} |
} |
151 |
|
|
152 |
|
#ifndef NDEBUG |
153 |
|
kalloc_init_called = 1; |
154 |
|
#endif |
155 |
} |
} |
156 |
|
|
157 |
vm_offset_t kalloc(size) |
vm_offset_t kalloc(size) |
163 |
|
|
164 |
/* compute the size of the block that we will actually allocate */ |
/* compute the size of the block that we will actually allocate */ |
165 |
|
|
166 |
|
assert (kalloc_init_called); |
167 |
|
|
168 |
allocsize = size; |
allocsize = size; |
169 |
if (size < kalloc_max) { |
if (size < kalloc_max) { |
170 |
allocsize = MINSIZE; |
allocsize = MINSIZE; |
197 |
register vm_size_t allocsize; |
register vm_size_t allocsize; |
198 |
vm_offset_t addr; |
vm_offset_t addr; |
199 |
|
|
200 |
|
assert (kalloc_init_called); |
201 |
|
|
202 |
/* compute the size of the block that we will actually allocate */ |
/* compute the size of the block that we will actually allocate */ |
203 |
|
|
204 |
allocsize = size; |
allocsize = size; |
233 |
register int zindex; |
register int zindex; |
234 |
register vm_size_t freesize; |
register vm_size_t freesize; |
235 |
|
|
236 |
|
assert (kalloc_init_called); |
237 |
|
|
238 |
freesize = size; |
freesize = size; |
239 |
if (size < kalloc_max) { |
if (size < kalloc_max) { |
240 |
freesize = MINSIZE; |
freesize = MINSIZE; |