Module Name: src Committed By: mgorny Date: Wed Jun 26 12:30:13 UTC 2019
Modified Files: src/lib/libc/sys: ptrace.2 src/sys/arch/amd64/amd64: netbsd32_machdep.c process_machdep.c src/sys/arch/amd64/include: netbsd32_machdep.h ptrace.h src/sys/arch/i386/i386: process_machdep.c src/sys/arch/i386/include: ptrace.h src/sys/arch/x86/include: cpu_extended_state.h fpu.h src/sys/arch/x86/x86: fpu.c src/tests/lib/libc/sys: t_ptrace_wait.c t_ptrace_x86_wait.h Log Message: 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). To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.75 src/lib/libc/sys/ptrace.2 cvs rdiff -u -r1.123 -r1.124 src/sys/arch/amd64/amd64/netbsd32_machdep.c cvs rdiff -u -r1.39 -r1.40 src/sys/arch/amd64/amd64/process_machdep.c cvs rdiff -u -r1.23 -r1.24 src/sys/arch/amd64/include/netbsd32_machdep.h cvs rdiff -u -r1.15 -r1.16 src/sys/arch/amd64/include/ptrace.h cvs rdiff -u -r1.92 -r1.93 src/sys/arch/i386/i386/process_machdep.c cvs rdiff -u -r1.22 -r1.23 src/sys/arch/i386/include/ptrace.h cvs rdiff -u -r1.16 -r1.17 src/sys/arch/x86/include/cpu_extended_state.h \ src/sys/arch/x86/include/fpu.h cvs rdiff -u -r1.53 -r1.54 src/sys/arch/x86/x86/fpu.c cvs rdiff -u -r1.128 -r1.129 src/tests/lib/libc/sys/t_ptrace_wait.c cvs rdiff -u -r1.15 -r1.16 src/tests/lib/libc/sys/t_ptrace_x86_wait.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.