Replace our hand-rolled functions with the generic ones provided by
kern/subr_physmem.c. This greatly simplifies the initialization of
physical memory regions and kernel globals.
I've found this to fail to boot, because it didn't reserve memory for the DTB (supplied by BBL). I'm not entirely sure if that's a result of an issue with your patch, or if there's something wrong in our local tree.
How is the DTB memory supposed to be reserved?
The following fixes the immediate problem for me:
@@ -806,9 +808,11 @@ initriscv(struct riscv_bootparams *rvbp) #ifdef FDT try_load_dtb(kmdp, rvbp->dtbp_virt); #endif + /* Reserve memory for the DTB. */ + physmem_exclude_region(rvbp->dtbp_phys, L2_SIZE, EXFLAG_NOALLOC);