Deleted Added
full compact
vm_kern.c (27899) vm_kern.c (32702)
1/*
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * The Mach Operating System project at Carnegie-Mellon University.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 47 unchanged lines hidden (view full) ---

56 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
57 * School of Computer Science
58 * Carnegie Mellon University
59 * Pittsburgh PA 15213-3890
60 *
61 * any improvements or extensions that they make and grant Carnegie the
62 * rights to redistribute these changes.
63 *
1/*
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * The Mach Operating System project at Carnegie-Mellon University.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 47 unchanged lines hidden (view full) ---

56 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
57 * School of Computer Science
58 * Carnegie Mellon University
59 * Pittsburgh PA 15213-3890
60 *
61 * any improvements or extensions that they make and grant Carnegie the
62 * rights to redistribute these changes.
63 *
64 * $Id: vm_kern.c,v 1.38 1997/08/02 14:33:26 bde Exp $
64 * $Id: vm_kern.c,v 1.39 1997/08/05 00:01:52 dyson Exp $
65 */
66
67/*
68 * Kernel memory management.
69 */
70
71#include <sys/param.h>
72#include <sys/systm.h>

--- 149 unchanged lines hidden (view full) ---

222 * Arguments are as follows:
223 *
224 * parent Map to take range from
225 * size Size of range to find
226 * min, max Returned endpoints of map
227 * pageable Can the region be paged
228 */
229vm_map_t
65 */
66
67/*
68 * Kernel memory management.
69 */
70
71#include <sys/param.h>
72#include <sys/systm.h>

--- 149 unchanged lines hidden (view full) ---

222 * Arguments are as follows:
223 *
224 * parent Map to take range from
225 * size Size of range to find
226 * min, max Returned endpoints of map
227 * pageable Can the region be paged
228 */
229vm_map_t
230kmem_suballoc(parent, min, max, size, pageable)
230kmem_suballoc(parent, min, max, size)
231 register vm_map_t parent;
232 vm_offset_t *min, *max;
233 register vm_size_t size;
231 register vm_map_t parent;
232 vm_offset_t *min, *max;
233 register vm_size_t size;
234 boolean_t pageable;
235{
236 register int ret;
237 vm_map_t result;
238
239 size = round_page(size);
240
241 *min = (vm_offset_t) vm_map_min(parent);
242 ret = vm_map_find(parent, NULL, (vm_offset_t) 0,
243 min, size, TRUE, VM_PROT_ALL, VM_PROT_ALL, 0);
244 if (ret != KERN_SUCCESS) {
245 printf("kmem_suballoc: bad status return of %d.\n", ret);
246 panic("kmem_suballoc");
247 }
248 *max = *min + size;
249 pmap_reference(vm_map_pmap(parent));
234{
235 register int ret;
236 vm_map_t result;
237
238 size = round_page(size);
239
240 *min = (vm_offset_t) vm_map_min(parent);
241 ret = vm_map_find(parent, NULL, (vm_offset_t) 0,
242 min, size, TRUE, VM_PROT_ALL, VM_PROT_ALL, 0);
243 if (ret != KERN_SUCCESS) {
244 printf("kmem_suballoc: bad status return of %d.\n", ret);
245 panic("kmem_suballoc");
246 }
247 *max = *min + size;
248 pmap_reference(vm_map_pmap(parent));
250 result = vm_map_create(vm_map_pmap(parent), *min, *max, pageable);
249 result = vm_map_create(vm_map_pmap(parent), *min, *max);
251 if (result == NULL)
252 panic("kmem_suballoc: cannot create submap");
253 if ((ret = vm_map_submap(parent, *min, *max, result)) != KERN_SUCCESS)
254 panic("kmem_suballoc: unable to change range to submap");
255 return (result);
256}
257
258/*

--- 175 unchanged lines hidden (view full) ---

434 * the range between `start' and `end' as free.
435 */
436void
437kmem_init(start, end)
438 vm_offset_t start, end;
439{
440 register vm_map_t m;
441
250 if (result == NULL)
251 panic("kmem_suballoc: cannot create submap");
252 if ((ret = vm_map_submap(parent, *min, *max, result)) != KERN_SUCCESS)
253 panic("kmem_suballoc: unable to change range to submap");
254 return (result);
255}
256
257/*

--- 175 unchanged lines hidden (view full) ---

433 * the range between `start' and `end' as free.
434 */
435void
436kmem_init(start, end)
437 vm_offset_t start, end;
438{
439 register vm_map_t m;
440
442 m = vm_map_create(kernel_pmap, VM_MIN_KERNEL_ADDRESS, end, FALSE);
441 m = vm_map_create(kernel_pmap, VM_MIN_KERNEL_ADDRESS, end);
443 vm_map_lock(m);
444 /* N.B.: cannot use kgdb to debug, starting with this assignment ... */
445 kernel_map = m;
446 kernel_map->system_map = 1;
447 (void) vm_map_insert(m, NULL, (vm_offset_t) 0,
448 VM_MIN_KERNEL_ADDRESS, start, VM_PROT_ALL, VM_PROT_ALL, 0);
449 /* ... and ending with the completion of the above `insert' */
450 vm_map_unlock(m);
451}
442 vm_map_lock(m);
443 /* N.B.: cannot use kgdb to debug, starting with this assignment ... */
444 kernel_map = m;
445 kernel_map->system_map = 1;
446 (void) vm_map_insert(m, NULL, (vm_offset_t) 0,
447 VM_MIN_KERNEL_ADDRESS, start, VM_PROT_ALL, VM_PROT_ALL, 0);
448 /* ... and ending with the completion of the above `insert' */
449 vm_map_unlock(m);
450}