A sysinit determines whether the pmap has enabled SV48 mode and
registers the corresponding sysentvec. In particular, only one ABI will
be in use in a running kernel. This is modelled after LA57 support on
amd64.
Details
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 44443 Build 41331: arc lint + arc unit
Event Timeline
I must say that in light of the fact we'll need to duplicate all of this for freebsd64 downstream, I wonder if it wouldn't be simpler to set the members that vary in elf64_register_sysvec instead (and keep a single sysvec)? That is something like:
static void elf64_register_sysvec(void *arg __unused) { switch (pmap_mode) { case PMAP_MODE_SV39: elf64_freebsd_sysvec.sv_usrstack = USRSTACK_SV39; ... break; case PMAP_MODE_SV48: elf64_freebsd_sysvec.sv_usrstack = USRSTACK_SV48; ... break; } }
You could even leave the INIT_SYSENTVEC as-is. It might be nice to actually have the fixup function take the sysvec pointer as its void *arg as in CheriBSD we will have to invoke it on two separate sysentvec's (one for stock freebsd64 and one for CHERI).
That seems reasonable and I implemented it. I wish we could make these structures const but there are already other fields that get filled in later during boot (relating to the shared page IIRC).
sys/riscv/riscv/elf_machdep.c | ||
---|---|---|
227 | Presumably you could execute this as soon as you know the pmap mode (that is, it could be earlier in case someone is nervous about the sysentvec not being initialized when the existing sysinits are executed?) That said, I think it probably doesn't really matter as we don't really use the sysentvec fields until we try to exec init. |
sys/riscv/riscv/elf_machdep.c | ||
---|---|---|
61 | Unnecessary. Already included by vm/pmap.h. |