powerpc: BookE hardware watchpoint support
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / powerpc / kernel / signal.c
index c434d6c4e4e6c5d9577deb44a66d00887403bb2d..7aada783ec6a78d54c74e7e2f11a428d014342ee 100644 (file)
 
 #include "signal.h"
 
+/* Log an error when sending an unhandled signal to a process. Controlled
+ * through debug.exception-trace sysctl.
+ */
+
+int show_unhandled_signals = 0;
+
 /*
  * Allocate space for the signal frame
  */
@@ -114,7 +120,7 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
        int ret;
        int is32 = is_32bit_task();
 
-       if (test_thread_flag(TIF_RESTORE_SIGMASK))
+       if (current_thread_info()->local_flags & _TLF_RESTORE_SIGMASK)
                oldset = &current->saved_sigmask;
        else if (!oldset)
                oldset = &current->blocked;
@@ -125,9 +131,10 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
        check_syscall_restart(regs, &ka, signr > 0);
 
        if (signr <= 0) {
+               struct thread_info *ti = current_thread_info();
                /* No signal to deliver -- put the saved sigmask back */
-               if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
-                       clear_thread_flag(TIF_RESTORE_SIGMASK);
+               if (ti->local_flags & _TLF_RESTORE_SIGMASK) {
+                       ti->local_flags &= ~_TLF_RESTORE_SIGMASK;
                        sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
                }
                return 0;               /* no signals delivered */
@@ -138,8 +145,12 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
         * user space. The DABR will have been cleared if it
         * triggered inside the kernel.
         */
-       if (current->thread.dabr)
+       if (current->thread.dabr) {
                set_dabr(current->thread.dabr);
+#if defined(CONFIG_44x) || defined(CONFIG_BOOKE)
+               mtspr(SPRN_DBCR0, current->thread.dbcr0);
+#endif
+       }
 
        if (is32) {
                if (ka.sa.sa_flags & SA_SIGINFO)
@@ -163,10 +174,9 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
 
                /*
                 * A signal was successfully delivered; the saved sigmask is in
-                * its frame, and we can clear the TIF_RESTORE_SIGMASK flag.
+                * its frame, and we can clear the TLF_RESTORE_SIGMASK flag.
                 */
-               if (test_thread_flag(TIF_RESTORE_SIGMASK))
-                       clear_thread_flag(TIF_RESTORE_SIGMASK);
+               current_thread_info()->local_flags &= ~_TLF_RESTORE_SIGMASK;
        }
 
        return ret;