From: Miod Vallat Subject: pmap_virtual_space and pmap_steal_memory are mutually exclusive To: tech@openbsd.org Date: Sun, 31 Mar 2024 16:52:58 +0000 The following diff removes unused pmap_virtual_space() from amd64 and makes sure either the uvm headers provide a prototype for pmap_virtual_space() or pmap_steal_memory(), but not both, since the code path involving pmap_virtual_space() is only compiled when pmap_steal_memory() does not exist. With a comment fix as a bonus. Index: sys/arch/amd64/amd64/pmap.c =================================================================== RCS file: /cvs/src/sys/arch/amd64/amd64/pmap.c,v retrieving revision 1.165 diff -u -p -r1.165 pmap.c --- sys/arch/amd64/amd64/pmap.c 29 Dec 2023 13:23:27 -0000 1.165 +++ sys/arch/amd64/amd64/pmap.c 31 Mar 2024 16:35:19 -0000 @@ -3105,13 +3105,6 @@ pmap_steal_memory(vsize_t size, vaddr_t return (va); } -void -pmap_virtual_space(vaddr_t *vstartp, vaddr_t *vendp) -{ - *vstartp = virtual_avail; - *vendp = VM_MAX_KERNEL_ADDRESS; -} - /* * pmap_convert * Index: sys/arch/i386/i386/pmap.c =================================================================== RCS file: /cvs/src/sys/arch/i386/i386/pmap.c,v retrieving revision 1.222 diff -u -p -r1.222 pmap.c --- sys/arch/i386/i386/pmap.c 13 Apr 2023 15:23:22 -0000 1.222 +++ sys/arch/i386/i386/pmap.c 31 Mar 2024 16:35:19 -0000 @@ -1555,7 +1555,7 @@ pmap_extract_86(struct pmap *pmap, vaddr } /* - * pmap_virtual_space: used during bootup [pmap_steal_memory] to + * pmap_virtual_space: used during bootup [uvm_pageboot_alloc] to * determine the bounds of the kernel virtual address space. */ Index: sys/uvm/uvm_pmap.h =================================================================== RCS file: /cvs/src/sys/uvm/uvm_pmap.h,v retrieving revision 1.33 diff -u -p -r1.33 uvm_pmap.h --- sys/uvm/uvm_pmap.h 13 Apr 2023 15:23:23 -0000 1.33 +++ sys/uvm/uvm_pmap.h 31 Mar 2024 16:35:19 -0000 @@ -173,9 +173,10 @@ void pmap_update(pmap_t); void pmap_zero_page(struct vm_page *); #endif -void pmap_virtual_space(vaddr_t *, vaddr_t *); #if defined(PMAP_STEAL_MEMORY) vaddr_t pmap_steal_memory(vsize_t, vaddr_t *, vaddr_t *); +#else +void pmap_virtual_space(vaddr_t *, vaddr_t *); #endif /* nested pmaps are used in i386/amd64 vmm */