This allows to check that the entire object falls into the direct map.
Added the PHYS_SZ_IN_DMAP macro as requested.
Currently this is only added for arm64 and amd64, which are the platforms that use it.
I'm not sure what the policy is in this case, should I add the same macro for other archs to keep the interface consistent?
|248 ↗||(On Diff #122749)|
Should the check verify pa+sz-1 instead of pa+sz? Consider the last page in the DMAP, at the address x. If you want to check if the whole page belongs to DMAP-mapped region, you would check the x+PAGE_SIZE address, which lives in the next page not covered by DMAP.
|247 ↗||(On Diff #122755)|
FYI, downstream in CheriBSD we have found uses for this on RISC-V as well, so I had suggested to Alfredo to move this to <vm/vm_param.h>. While PHYS_IN_DMAP is inherently MD, this new macro is not.
You do not need this guard for #define.
I'll drop the guard if it isn't necessary. I think vm_param.h seems a more natural place since the original definitions are in machine/vmparam.h instead of machine/pmap.h, but I can move it if avoiding extra includes is a priority.
I had guessed at vm/vm_param.h when suggesting to move this downstream due to the machine/vmparam.h for the original location, but vm/pmap.h might indeed be the better header? I can never remember which headers to actually include for the DMAP macros and tend to just start adding more vm/*.h until it compiles. :( We could really use a DMAP.9 or the like that described the API and gave the suggested #includes to use, etc.