diff options
author | Suresh Siddha <suresh.b.siddha@intel.com> | 2010-02-22 17:51:33 -0500 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2010-02-23 16:45:27 -0500 |
commit | ff7fbc72e0c3ef7e94a27a3a918fd09ec9a30204 (patch) | |
tree | 1e07cfb9d41d8c7c155ae781f901e287f3833273 /arch/x86/kernel | |
parent | c6a0dd7ec6fb2d4927979ed4dc562fc5c122d826 (diff) |
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')
-rw-r--r-- | arch/x86/kernel/i387.c | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c index 7a8a193b5144..81e23bf12c12 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, | |||
243 | return ret; | 243 | return ret; |
244 | 244 | ||
245 | /* | 245 | /* |
246 | * First copy the fxsave bytes 0..463. | 246 | * Copy the 48bytes defined by the software first into the xstate |
247 | * memory layout in the thread struct, so that we can copy the entire | ||
248 | * xstateregs to the user using one user_regset_copyout(). | ||
247 | */ | 249 | */ |
248 | ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, | 250 | memcpy(&target->thread.xstate->fxsave.sw_reserved, |
249 | &target->thread.xstate->xsave, 0, | 251 | xstate_fx_sw_bytes, sizeof(xstate_fx_sw_bytes)); |
250 | offsetof(struct user_xstateregs, | ||
251 | i387.xstate_fx_sw)); | ||
252 | if (ret) | ||
253 | return ret; | ||
254 | |||
255 | /* | ||
256 | * Copy the 48bytes defined by software. | ||
257 | */ | ||
258 | ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, | ||
259 | xstate_fx_sw_bytes, | ||
260 | offsetof(struct user_xstateregs, | ||
261 | i387.xstate_fx_sw), | ||
262 | offsetof(struct user_xstateregs, | ||
263 | xsave_hdr)); | ||
264 | if (ret) | ||
265 | return ret; | ||
266 | 252 | ||
267 | /* | 253 | /* |
268 | * Copy the rest of xstate memory layout. | 254 | * Copy the xstate memory layout. |
269 | */ | 255 | */ |
270 | ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, | 256 | ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, |
271 | &target->thread.xstate->xsave.xsave_hdr, | 257 | &target->thread.xstate->xsave, 0, -1); |
272 | offsetof(struct user_xstateregs, | ||
273 | xsave_hdr), -1); | ||
274 | return ret; | 258 | return ret; |
275 | } | 259 | } |
276 | 260 | ||