aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel
diff options
context:
space:
mode:
authorPhil Edworthy <Phil.Edworthy@renesas.com>2011-03-18 10:16:31 -0400
committerPaul Mundt <lethal@linux-sh.org>2011-03-23 09:17:52 -0400
commitc49b6ecf0870e78fa40497cd8b142915c1d5c7c9 (patch)
tree17a0bb980bbf9ce734f62068016e69d4f46175ac /arch/sh/kernel
parent3f4caa8157449b96f8b166c7a98ee40c4bc35a55 (diff)
sh: Fix ptrace fpu state initialisation
Commit 0ea820cf introduced the PTRACE_GETFPREGS/SETFPREGS cmds, but gdb-server still accesses the FPU state using the PTRACE_PEEKUSR/POKEUSR commands. In this case, xstate was not initialised. Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com> Cc: stable@kernel.org Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel')
-rw-r--r--arch/sh/kernel/ptrace_32.c6
-rw-r--r--arch/sh/kernel/ptrace_64.c6
2 files changed, 12 insertions, 0 deletions
diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c
index 90a15d29feeb..b53664ef53e8 100644
--- a/arch/sh/kernel/ptrace_32.c
+++ b/arch/sh/kernel/ptrace_32.c
@@ -392,6 +392,9 @@ long arch_ptrace(struct task_struct *child, long request,
392 tmp = 0; 392 tmp = 0;
393 } else { 393 } else {
394 unsigned long index; 394 unsigned long index;
395 ret = init_fpu(child);
396 if (ret)
397 break;
395 index = addr - offsetof(struct user, fpu); 398 index = addr - offsetof(struct user, fpu);
396 tmp = ((unsigned long *)child->thread.xstate) 399 tmp = ((unsigned long *)child->thread.xstate)
397 [index >> 2]; 400 [index >> 2];
@@ -423,6 +426,9 @@ long arch_ptrace(struct task_struct *child, long request,
423 else if (addr >= offsetof(struct user, fpu) && 426 else if (addr >= offsetof(struct user, fpu) &&
424 addr < offsetof(struct user, u_fpvalid)) { 427 addr < offsetof(struct user, u_fpvalid)) {
425 unsigned long index; 428 unsigned long index;
429 ret = init_fpu(child);
430 if (ret)
431 break;
426 index = addr - offsetof(struct user, fpu); 432 index = addr - offsetof(struct user, fpu);
427 set_stopped_child_used_math(child); 433 set_stopped_child_used_math(child);
428 ((unsigned long *)child->thread.xstate) 434 ((unsigned long *)child->thread.xstate)
diff --git a/arch/sh/kernel/ptrace_64.c b/arch/sh/kernel/ptrace_64.c
index 4436eacddb15..c8f97649f354 100644
--- a/arch/sh/kernel/ptrace_64.c
+++ b/arch/sh/kernel/ptrace_64.c
@@ -403,6 +403,9 @@ long arch_ptrace(struct task_struct *child, long request,
403 else if ((addr >= offsetof(struct user, fpu)) && 403 else if ((addr >= offsetof(struct user, fpu)) &&
404 (addr < offsetof(struct user, u_fpvalid))) { 404 (addr < offsetof(struct user, u_fpvalid))) {
405 unsigned long index; 405 unsigned long index;
406 ret = init_fpu(child);
407 if (ret)
408 break;
406 index = addr - offsetof(struct user, fpu); 409 index = addr - offsetof(struct user, fpu);
407 tmp = get_fpu_long(child, index); 410 tmp = get_fpu_long(child, index);
408 } else if (addr == offsetof(struct user, u_fpvalid)) { 411 } else if (addr == offsetof(struct user, u_fpvalid)) {
@@ -442,6 +445,9 @@ long arch_ptrace(struct task_struct *child, long request,
442 else if ((addr >= offsetof(struct user, fpu)) && 445 else if ((addr >= offsetof(struct user, fpu)) &&
443 (addr < offsetof(struct user, u_fpvalid))) { 446 (addr < offsetof(struct user, u_fpvalid))) {
444 unsigned long index; 447 unsigned long index;
448 ret = init_fpu(child);
449 if (ret)
450 break;
445 index = addr - offsetof(struct user, fpu); 451 index = addr - offsetof(struct user, fpu);
446 ret = put_fpu_long(child, index, data); 452 ret = put_fpu_long(child, index, data);
447 } 453 }