]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/sh/kernel/ptrace_64.c
Merge branch 'linux-next' of git://git.infradead.org/~dedekind/ubi-2.6
[linux-2.6-omap-h63xx.git] / arch / sh / kernel / ptrace_64.c
index 8a2d339cf760b3df148e12bec2475e2b5c454b05..d453c47dc522176a75821903084b566ae7105dfc 100644 (file)
@@ -1,12 +1,8 @@
 /*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * arch/sh64/kernel/ptrace.c
+ * arch/sh/kernel/ptrace_64.c
  *
  * Copyright (C) 2000, 2001  Paolo Alberelli
- * Copyright (C) 2003  Paul Mundt
+ * Copyright (C) 2003 - 2007  Paul Mundt
  *
  * Started from SH3/4 version:
  *   SuperH version:   Copyright (C) 1999, 2000  Kaz Kojima & Niibe Yutaka
  *     By Ross Biro 1/23/92
  *     edited by Linus Torvalds
  *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
  */
-
 #include <linux/kernel.h>
 #include <linux/rwsem.h>
 #include <linux/sched.h>
 #include <linux/user.h>
 #include <linux/signal.h>
 #include <linux/syscalls.h>
-
+#include <linux/audit.h>
 #include <asm/io.h>
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/system.h>
 #include <asm/processor.h>
 #include <asm/mmu_context.h>
+#include <asm/fpu.h>
 
 /* This mask defines the bits of the SR which the user is not allowed to
    change, which are everything except S, Q, M, PR, SZ, FR. */
@@ -74,9 +73,9 @@ get_fpu_long(struct task_struct *task, unsigned long addr)
        }
 
        if (last_task_used_math == task) {
-               grab_fpu();
-               fpsave(&task->thread.fpu.hard);
-               release_fpu();
+               enable_fpu();
+               save_fpu(task, regs);
+               disable_fpu();
                last_task_used_math = 0;
                regs->sr |= SR_FD;
        }
@@ -110,9 +109,9 @@ put_fpu_long(struct task_struct *task, unsigned long addr, unsigned long data)
                fpinit(&task->thread.fpu.hard);
                set_stopped_child_used_math(task);
        } else if (last_task_used_math == task) {
-               grab_fpu();
-               fpsave(&task->thread.fpu.hard);
-               release_fpu();
+               enable_fpu();
+               save_fpu(task, regs);
+               disable_fpu();
                last_task_used_math = 0;
                regs->sr |= SR_FD;
        }
@@ -253,7 +252,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
 
 asmlinkage int sh64_ptrace(long request, long pid, long addr, long data)
 {
-       extern void poke_real_address_q(unsigned long long addr, unsigned long long data);
 #define WPC_DBRMODE 0x0d104008
        static int first_call = 1;
 
@@ -275,17 +273,23 @@ asmlinkage int sh64_ptrace(long request, long pid, long addr, long data)
        return sys_ptrace(request, pid, addr, data);
 }
 
-asmlinkage void syscall_trace(void)
+asmlinkage void syscall_trace(struct pt_regs *regs, int entryexit)
 {
        struct task_struct *tsk = current;
 
-       if (!test_thread_flag(TIF_SYSCALL_TRACE))
-               return;
+       if (unlikely(current->audit_context) && entryexit)
+               audit_syscall_exit(AUDITSC_RESULT(regs->regs[9]),
+                                  regs->regs[9]);
+
+       if (!test_thread_flag(TIF_SYSCALL_TRACE) &&
+           !test_thread_flag(TIF_SINGLESTEP))
+               goto out;
        if (!(tsk->ptrace & PT_PTRACED))
-               return;
+               goto out;
+
+       ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) &&
+                               !test_thread_flag(TIF_SINGLESTEP) ? 0x80 : 0));
 
-       ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
-                                ? 0x80 : 0));
        /*
         * this isn't the same as continuing with a signal, but it will do
         * for normal use.  strace only continues with a signal if the
@@ -295,6 +299,12 @@ asmlinkage void syscall_trace(void)
                send_sig(tsk->exit_code, tsk, 1);
                tsk->exit_code = 0;
        }
+
+out:
+       if (unlikely(current->audit_context) && !entryexit)
+               audit_syscall_entry(AUDIT_ARCH_SH, regs->regs[1],
+                                   regs->regs[2], regs->regs[3],
+                                   regs->regs[4], regs->regs[5]);
 }
 
 /* Called with interrupts disabled */