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 --- 49 unchanged lines hidden (view full) --- 58 * rights to redistribute these changes. 59 */ 60 61/* 62 * Kernel memory management. 63 */ 64 65#include <sys/cdefs.h> |
66__FBSDID("$FreeBSD: head/sys/vm/vm_kern.c 129906 2004-05-31 21:46:06Z bmilekic $"); |
67 68#include <sys/param.h> 69#include <sys/systm.h> 70#include <sys/kernel.h> /* for ticks and hz */ 71#include <sys/lock.h> 72#include <sys/mutex.h> 73#include <sys/proc.h> 74#include <sys/malloc.h> --- 240 unchanged lines hidden (view full) --- 315 /* 316 * Locate sufficient space in the map. This will give us the final 317 * virtual address for the new memory, and thus will tell us the 318 * offset within the kernel map. 319 */ 320 vm_map_lock(map); 321 if (vm_map_findspace(map, vm_map_min(map), size, &addr)) { 322 vm_map_unlock(map); |
323 if ((flags & M_NOWAIT) == 0) 324 panic("kmem_malloc(%ld): kmem_map too small: %ld total allocated", 325 (long)size, (long)map->size); 326 return (0); 327 } 328 offset = addr - VM_MIN_KERNEL_ADDRESS; 329 vm_object_reference(kmem_object); 330 vm_map_insert(map, kmem_object, offset, addr, addr + size, --- 193 unchanged lines hidden --- |