xstate
process_machdep_read_xstate(struct lwp *l, struct xstate *regs)
process_machdep_write_xstate(struct lwp *l, const struct xstate *regs)
if (iov.iov_len > sizeof(struct xstate))
iov.iov_len = sizeof(struct xstate);
struct xstate r; /* XXX FIXME big stack object */
struct xstate xstate; /* XXX FIXME big stack object */ \
memset(&xstate, 0, sizeof(xstate)); \
if (!process_read_xstate(l, &xstate)) \
&xstate, sizeof(xstate)); \
process_machdep_read_xstate(struct lwp *l, struct xstate *regs)
process_machdep_write_xstate(struct lwp *l, const struct xstate *regs)
if (iov.iov_len > sizeof(struct xstate))
iov.iov_len = sizeof(struct xstate);
struct xstate r; /* XXX FIXME big stack object */
struct xstate xstate; /* XXX FIXME big stack object */ \
memset(&xstate, 0, sizeof(xstate)); \
if (!process_read_xstate(l, &xstate)) \
&xstate, sizeof(xstate)); \
int process_read_xstate(struct lwp *, struct xstate *);
int process_verify_xstate(const struct xstate *);
int process_write_xstate(struct lwp *, const struct xstate *);
memcpy(fpu_save->sv_xmm.fx_87_ac, xstate->xs_fxsave.fx_87_ac,
sizeof(xstate->xs_fxsave.fx_87_ac));
if (xstate->xs_xstate_bv & (XCR0_SSE|XCR0_YMM_Hi128)) {
fpu_save->sv_xmm.fx_mxcsr_mask = xstate->xs_fxsave.fx_mxcsr_mask
fpu_save->sv_xmm.fx_mxcsr = xstate->xs_fxsave.fx_mxcsr &
if (xstate->xs_xstate_bv & XCR0_SSE) {
xstate->xs_fxsave.fx_xmm, sizeof(xstate->xs_fxsave.fx_xmm));
if (xstate->xs_xstate_bv & xcr0_val) { \
>= sizeof(xstate->field)); \
&xstate->field, sizeof(xstate->field)); \
fpu_xstate_reload(union savefpu *fpu_save, uint64_t xstate)
fpu_save->sv_xsave_hdr.xsh_xstate_bv |= xstate;
process_read_xstate(struct lwp *l, struct xstate *xstate)
memset(&xstate->xs_fxsave, 0, sizeof(xstate->xs_fxsave));
process_s87_to_xmm(&fpu_save->sv_87, &xstate->xs_fxsave);
xstate->xs_rfbm = XCR0_X87;
xstate->xs_xstate_bv = XCR0_X87;
memcpy(&xstate->xs_fxsave, fpu_save->sv_xsave_hdr.xsh_fxsave,
sizeof(xstate->xs_fxsave));
xstate->xs_rfbm = XCR0_X87 | XCR0_SSE;
xstate->xs_xstate_bv = XCR0_X87 | XCR0_SSE;
xstate->xs_rfbm = x86_xsave_features & XCR0_FPU;
xstate->xs_xstate_bv = fpu_save->sv_xsave_hdr.xsh_xstate_bv;
KASSERT(!(xstate->xs_xstate_bv & ~xstate->xs_rfbm));
if (xstate->xs_xstate_bv & xcr0_val) { \
>= sizeof(xstate->field)); \
memcpy(&xstate->field, \
sizeof(xstate->field)); \
process_verify_xstate(const struct xstate *xstate)
if (xstate->xs_xstate_bv & ~xstate->xs_rfbm)
if ((xstate->xs_rfbm & ~XCR0_X87))
if ((xstate->xs_rfbm & ~(XCR0_X87 | XCR0_SSE)))
if ((xstate->xs_rfbm & ~(x86_xsave_features & XCR0_FPU)) != 0)
process_write_xstate(struct lwp *l, const struct xstate *xstate)
if (xstate->xs_xstate_bv & XCR0_X87)
process_xmm_to_s87(&xstate->xs_fxsave, &fpu_save->sv_87);
(fpu_save->sv_xsave_hdr.xsh_xstate_bv & ~xstate->xs_rfbm) |
xstate->xs_xstate_bv;
if (xstate->xs_xstate_bv & XCR0_X87) {
memcpy(&fpu_save->sv_xmm, &xstate->xs_fxsave, 24);
struct xstate xst;