I'm re-writing XIP-capable memory disk based on md(4) following people's suggestions.
md(4) mmap has to return "mdpgno" of char md_root_image[]. I can get physical address of md_root_image[] by pmap_extract(9). There's no API to convert physical address to "mdpgno" (opposite of pmap_phys_address(9)). What I ended up is pmap_mmap(9), which is exactly mmmmap(), but made public. Does this sound right?
