summaryrefslogtreecommitdiff
path: root/vm/vm_kern.c
diff options
context:
space:
mode:
Diffstat (limited to 'vm/vm_kern.c')
-rw-r--r--vm/vm_kern.c46
1 files changed, 38 insertions, 8 deletions
diff --git a/vm/vm_kern.c b/vm/vm_kern.c
index a84553d6..2e333ee1 100644
--- a/vm/vm_kern.c
+++ b/vm/vm_kern.c
@@ -432,17 +432,14 @@ retry:
}
/*
- * kmem_alloc_wired:
+ * kmem_valloc:
*
- * Allocate wired-down memory in the kernel's address map
- * or a submap. The memory is not zero-filled.
- *
- * The memory is allocated in the kernel_object.
- * It may not be copied with vm_map_copy.
+ * Allocate addressing space in the kernel's address map
+ * or a submap. The adressing space does not map anything.
*/
kern_return_t
-kmem_alloc_wired(
+kmem_valloc(
vm_map_t map,
vm_offset_t *addrp,
vm_size_t size)
@@ -476,7 +473,7 @@ retry:
goto retry;
}
- printf_once("no more room for kmem_alloc_wired in %p (%s)\n",
+ printf_once("no more room for kmem_valloc in %p (%s)\n",
map, map->name);
return kr;
}
@@ -504,6 +501,39 @@ retry:
vm_map_unlock(map);
/*
+ * Return the memory, not mapped.
+ */
+ *addrp = addr;
+ return KERN_SUCCESS;
+}
+
+/*
+ * kmem_alloc_wired:
+ *
+ * Allocate wired-down memory in the kernel's address map
+ * or a submap. The memory is not zero-filled.
+ *
+ * The memory is allocated in the kernel_object.
+ * It may not be copied with vm_map_copy.
+ */
+
+kern_return_t
+kmem_alloc_wired(
+ vm_map_t map,
+ vm_offset_t *addrp,
+ vm_size_t size)
+{
+ vm_offset_t offset;
+ vm_offset_t addr;
+ kern_return_t kr;
+
+ kr = kmem_valloc(map, &addr, size);
+ if (kr != KERN_SUCCESS)
+ return kr;
+
+ offset = addr - VM_MIN_KERNEL_ADDRESS;
+
+ /*
* Allocate wired-down memory in the kernel_object,
* for this entry, and enter it in the kernel pmap.
*/