summaryrefslogtreecommitdiff
path: root/sys/uvm
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2024-08-24 10:38:45 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2024-08-24 10:38:45 +0000
commit7e826855d7a6c72fd9eedf05161f618c4e77007f (patch)
treedc29c748fc4534d2bb55dad62e3ec1c4432747ad /sys/uvm
parent689fb255282255687cd343c43afeac9ca6593f89 (diff)
Kill uvm_km_alloc(9) and uvm_km_alloc1(9).
ok guenther@
Diffstat (limited to 'sys/uvm')
-rw-r--r--sys/uvm/uvm_extern.h8
-rw-r--r--sys/uvm/uvm_km.c21
2 files changed, 12 insertions, 17 deletions
diff --git a/sys/uvm/uvm_extern.h b/sys/uvm/uvm_extern.h
index 847eb356597..973c4ab1b52 100644
--- a/sys/uvm/uvm_extern.h
+++ b/sys/uvm/uvm_extern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_extern.h,v 1.175 2024/07/24 12:17:31 mpi Exp $ */
+/* $OpenBSD: uvm_extern.h,v 1.176 2024/08/24 10:38:44 mpi Exp $ */
/* $NetBSD: uvm_extern.h,v 1.57 2001/03/09 01:02:12 chs Exp $ */
/*
@@ -256,10 +256,6 @@ extern struct vm_map *phys_map;
/* base of kernel virtual memory */
extern vaddr_t vm_min_kernel_address;
-/* zalloc zeros memory, alloc does not */
-#define uvm_km_zalloc(MAP,SIZE) uvm_km_alloc1(MAP,SIZE,0,TRUE)
-#define uvm_km_alloc(MAP,SIZE) uvm_km_alloc1(MAP,SIZE,0,FALSE)
-
#define vm_resident_count(vm) (pmap_resident_count((vm)->vm_map.pmap))
struct plimit;
@@ -291,7 +287,7 @@ int uvm_io(vm_map_t, struct uio *, int);
#define UVM_IO_FIXPROT 0x01
-vaddr_t uvm_km_alloc1(vm_map_t, vsize_t, vsize_t, boolean_t);
+vaddr_t uvm_km_zalloc(vm_map_t, vsize_t, vsize_t);
void uvm_km_free(vm_map_t, vaddr_t, vsize_t);
vaddr_t uvm_km_kmemalloc_pla(struct vm_map *,
struct uvm_object *, vsize_t, vsize_t, int,
diff --git a/sys/uvm/uvm_km.c b/sys/uvm/uvm_km.c
index a715173529a..9d3af6cf962 100644
--- a/sys/uvm/uvm_km.c
+++ b/sys/uvm/uvm_km.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_km.c,v 1.152 2024/03/27 15:41:40 kurt Exp $ */
+/* $OpenBSD: uvm_km.c,v 1.153 2024/08/24 10:38:44 mpi Exp $ */
/* $NetBSD: uvm_km.c,v 1.42 2001/01/14 02:10:01 thorpej Exp $ */
/*
@@ -117,10 +117,10 @@
* address minus the vm_map_min(kernel_map).
* example:
* suppose kernel_map starts at 0xf8000000 and the kernel does a
- * uvm_km_alloc(kernel_map, PAGE_SIZE) [allocate 1 wired down page in the
- * kernel map]. if uvm_km_alloc returns virtual address 0xf8235000,
- * then that means that the page at offset 0x235000 in kernel_object is
- * mapped at 0xf8235000.
+ * km_alloc(PAGE_SIZE, &kv_any, &kp_none, &kd_waitok)) [allocate 1 wired
+ * down page in the kernel map]. if km_alloc() returns virtual address
+ * 0xf8235000, then that means that the page at offset 0x235000 in
+ * kernel_object is mapped at 0xf8235000.
*
* kernel objects have one other special property: when the kernel virtual
* memory mapping them is unmapped, the backing memory in the object is
@@ -434,12 +434,12 @@ uvm_km_free(struct vm_map *map, vaddr_t addr, vsize_t size)
}
/*
- * uvm_km_alloc1: allocate wired down memory in the kernel map.
+ * uvm_km_zalloc: allocate wired down memory in the kernel map.
*
* => we can sleep if needed
*/
vaddr_t
-uvm_km_alloc1(struct vm_map *map, vsize_t size, vsize_t align, boolean_t zeroit)
+uvm_km_zalloc(struct vm_map *map, vsize_t size, vsize_t align)
{
vaddr_t kva, loopva;
voff_t offset;
@@ -483,7 +483,7 @@ uvm_km_alloc1(struct vm_map *map, vsize_t size, vsize_t align, boolean_t zeroit)
uvm_unmap(map, kva, loopva - kva);
return (0);
} else {
- uvm_wait("km_alloc1w"); /* wait for memory */
+ uvm_wait("km_zallocw"); /* wait for memory */
continue;
}
}
@@ -501,13 +501,12 @@ uvm_km_alloc1(struct vm_map *map, vsize_t size, vsize_t align, boolean_t zeroit)
size -= PAGE_SIZE;
}
pmap_update(map->pmap);
-
+
/*
* zero on request (note that "size" is now zero due to the above loop
* so we need to subtract kva from loopva to reconstruct the size).
*/
- if (zeroit)
- memset((caddr_t)kva, 0, loopva - kva);
+ memset((caddr_t)kva, 0, loopva - kva);
return kva;
}