sparc_bus_protect() was copied from uvm_chgkprot() (which was a KGDB
support routine and is no longer present in uvm_glue.c).
The "cheezy hack" comment predates the pmap_extract() interface change
of 2001 (uvm_glue.c 1.15) and ought to have been removed back then.
Index: machdep.c
===================================================================
RCS file: /OpenBSD/src/sys/arch/sparc64/sparc64/machdep.c,v
retrieving revision 1.191
diff -u -p -r1.191 machdep.c
--- machdep.c 1 Apr 2019 07:00:52 -0000 1.191
+++ machdep.c 31 Dec 2019 08:00:16 -0000
@@ -1712,15 +1712,10 @@ sparc_bus_protect(bus_space_tag_t t, bus
eva = round_page((vaddr_t)addr + size);
for (sva = trunc_page((vaddr_t)addr); sva < eva; sva += PAGE_SIZE) {
- /*
- * Extract physical address for the page.
- * We use a cheezy hack to differentiate physical
- * page 0 from an invalid mapping, not that it
- * really matters...
- */
if (pmap_extract(pmap_kernel(), sva, &pa) == FALSE)
panic("bus_space_protect(): invalid page");
- pmap_enter(pmap_kernel(), sva, pa | pm_flags, prot, prot |
PMAP_WIRED);
+ pmap_enter(pmap_kernel(), sva, pa | pm_flags, prot,
+ prot | PMAP_WIRED);
}
pmap_update(pmap_kernel());