Please sign in to comment.
Implement PT_GETXSTATE and PT_SETXSTATE
Introduce two new ptrace() requests: PT_GETXSTATE and PT_SETXSTATE, that provide access to the extended (and extensible) set of FPU registers on amd64 and i386. At the moment, this covers AVX (YMM) and AVX-512 (ZMM, opmask) registers. It can be easily extended to cover further register types without breaking backwards compatibility. PT_GETXSTATE issues the XSAVE instruction with all kernel-supported extended components enabled. The data is copied into 'struct xstate' (which -- unlike the XSAVE area itself -- has stable format and offsets). PT_SETXSTATE issues the XRSTOR instruction to restore the register values from user-provided 'struct xstate'. The function replaces only the specific XSAVE components that are listed in 'xs_rfbm' field, making it possible to issue partial updates. Both syscalls take a 'struct iovec' pointer rather than a direct argument. This requires the caller to explicitly specify the buffer size. As a result, existing code will continue to work correctly when the structure is extended (performing partial reads/updates).
- Loading branch information...
Showing with 1,502 additions and 43 deletions.
- +75 −3 lib/libc/sys/ptrace.2
- +4 −2 sys/arch/amd64/amd64/netbsd32_machdep.c
- +133 −2 sys/arch/amd64/amd64/process_machdep.c
- +3 −1 sys/arch/amd64/include/netbsd32_machdep.h
- +23 −2 sys/arch/amd64/include/ptrace.h
- +108 −21 sys/arch/i386/i386/process_machdep.c
- +11 −4 sys/arch/i386/include/ptrace.h
- +83 −1 sys/arch/x86/include/cpu_extended_state.h
- +5 −1 sys/arch/x86/include/fpu.h
- +161 −2 sys/arch/x86/x86/fpu.c
- +4 −2 tests/lib/libc/sys/t_ptrace_wait.c
- +892 −2 tests/lib/libc/sys/t_ptrace_x86_wait.h
Oops, something went wrong.