tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: [PATCH v2 2/2] Implement PT_GETXSTATE and PT_SETXSTATE
On Jun 5, 5:08pm, mgorny%gentoo.org@localhost (=?UTF-8?q?Micha=C5=82=20G=C3=B3rny?=) wrote:
-- Subject: [PATCH v2 2/2] 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_xstate_bv' 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).
LGTM:
- There is no need for '} else {' after return
- Style says 'return a;' not 'return (a);'
- While no early returns in
+ if (kl < 0)
+ error = EINVAL;
and below?
Best,
christos
Home |
Main Index |
Thread Index |
Old Index