summaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/i387.c
diff options
context:
space:
mode:
authorSuresh Siddha <suresh.b.siddha@intel.com>2010-02-22 14:51:33 -0800
committerH. Peter Anvin <hpa@zytor.com>2010-02-23 13:45:27 -0800
commitff7fbc72e0c3ef7e94a27a3a918fd09ec9a30204 (patch)
tree1e07cfb9d41d8c7c155ae781f901e287f3833273 /arch/x86/kernel/i387.c
parentc6a0dd7ec6fb2d4927979ed4dc562fc5c122d826 (diff)
downloadop-kernel-dev-ff7fbc72e0c3ef7e94a27a3a918fd09ec9a30204.zip
op-kernel-dev-ff7fbc72e0c3ef7e94a27a3a918fd09ec9a30204.tar.gz
x86, ptrace: Simplify xstateregs_get()
48 bytes (bytes 464..511) of the xstateregs payload come from the kernel defined structure (xstate_fx_sw_bytes). Rest comes from the xstate regs structure in the thread struct. Instead of having multiple user_regset_copyout()'s, simplify the xstateregs_get() by first copying the SW bytes into the xstate regs structure in the thread structure and then using one user_regset_copyout() to copyout the xstateregs. Requested-by: Roland McGrath <roland@redhat.com> Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> LKML-Reference: <20100222225240.494688491@sbs-t61.sc.intel.com> Acked-by: Roland McGrath <roland@redhat.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com> Cc: Oleg Nesterov <oleg@redhat.com>
Diffstat (limited to 'arch/x86/kernel/i387.c')
-rw-r--r--arch/x86/kernel/i387.c30
1 files changed, 7 insertions, 23 deletions
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
index 7a8a193..81e23bf 100644
--- a/arch/x86/kernel/i387.c
+++ b/arch/x86/kernel/i387.c
@@ -243,34 +243,18 @@ int xstateregs_get(struct task_struct *target, const struct user_regset *regset,
return ret;
/*
- * First copy the fxsave bytes 0..463.
+ * Copy the 48bytes defined by the software first into the xstate
+ * memory layout in the thread struct, so that we can copy the entire
+ * xstateregs to the user using one user_regset_copyout().
*/
- ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
- &target->thread.xstate->xsave, 0,
- offsetof(struct user_xstateregs,
- i387.xstate_fx_sw));
- if (ret)
- return ret;
-
- /*
- * Copy the 48bytes defined by software.
- */
- ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
- xstate_fx_sw_bytes,
- offsetof(struct user_xstateregs,
- i387.xstate_fx_sw),
- offsetof(struct user_xstateregs,
- xsave_hdr));
- if (ret)
- return ret;
+ memcpy(&target->thread.xstate->fxsave.sw_reserved,
+ xstate_fx_sw_bytes, sizeof(xstate_fx_sw_bytes));
/*
- * Copy the rest of xstate memory layout.
+ * Copy the xstate memory layout.
*/
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
- &target->thread.xstate->xsave.xsave_hdr,
- offsetof(struct user_xstateregs,
- xsave_hdr), -1);
+ &target->thread.xstate->xsave, 0, -1);
return ret;
}
OpenPOWER on IntegriCloud