Add a freebsd32_ptrace() and move as many freebsd32 shims as possible
to freebsd32_ptrace(). Aside from register sets, freebsd32 passes
pointers to native structures to kern_ptrace() and converts to/from
native/32-bit structure formats in freebsd32_ptrace() outside of
kern_ptrace().
Details
- Reviewers
kib brooks - Commits
- rS361975: Refactor ptrace() ABI compatibility.
- 32-bit ptrace_test (i386) passes when run under an amd64 kernel
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
In CheriBSD in particular we have additional ABIs and this approach is much cleaner by permitting other ABIs to be self-contained when using kern_ptrace().
Would be nice to not include generated bits into review.
Would kern_ptrace() split into two functions, one for prologue and one for the switch() by ops, I suspect it would allow to go a step further and move handling of compat32 PT_{GET,SET}*REGS into freebsd32_ptrace(). Then you can eliminate READ_PROC/WRITE_PROC. This might be tried after this patch lands.
Overall I like it very much.
My thought on the register sets is to get the register set API fleshed out, and then emulate the older calls in terms of register set operations. The register set handler for NT_FPREGSET, etc. would use the passed in size to determine whether they are populating the 32-bit vs 64-bit register set.