aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2008-04-20 18:06:49 -0400
committerDavid S. Miller <davem@davemloft.net>2008-07-27 20:32:19 -0400
commite35a8925e0e7af8b26161a2c161ea31be0296b80 (patch)
tree708008d1494a91f76277f9140a219ac24e88e432
parentbadcbf0e8654c4a4ca51fe46c75a70376e83c1ef (diff)
sparc64: tracehook: TIF_NOTIFY_RESUME
This adds TIF_NOTIFY_RESUME support for sparc64. When set, we call tracehook_notify_resume() on the way to user mode. Signed-off-by: Roland McGrath <roland@redhat.com>
-rw-r--r--arch/sparc/include/asm/thread_info_64.h8
-rw-r--r--arch/sparc64/kernel/rtrap.S6
-rw-r--r--arch/sparc64/kernel/signal.c5
3 files changed, 13 insertions, 6 deletions
diff --git a/arch/sparc/include/asm/thread_info_64.h b/arch/sparc/include/asm/thread_info_64.h
index 960969d5ad06..c0a737d7292c 100644
--- a/arch/sparc/include/asm/thread_info_64.h
+++ b/arch/sparc/include/asm/thread_info_64.h
@@ -219,7 +219,7 @@ register struct thread_info *current_thread_info_reg asm("g6");
219 * nop 219 * nop
220 */ 220 */
221#define TIF_SYSCALL_TRACE 0 /* syscall trace active */ 221#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
222/* flags bit 1 is available */ 222#define TIF_NOTIFY_RESUME 1 /* callback before returning to user */
223#define TIF_SIGPENDING 2 /* signal pending */ 223#define TIF_SIGPENDING 2 /* signal pending */
224#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ 224#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
225#define TIF_PERFCTR 4 /* performance counters active */ 225#define TIF_PERFCTR 4 /* performance counters active */
@@ -239,6 +239,7 @@ register struct thread_info *current_thread_info_reg asm("g6");
239#define TIF_POLLING_NRFLAG 14 239#define TIF_POLLING_NRFLAG 14
240 240
241#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 241#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
242#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
242#define _TIF_SIGPENDING (1<<TIF_SIGPENDING) 243#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
243#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 244#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
244#define _TIF_PERFCTR (1<<TIF_PERFCTR) 245#define _TIF_PERFCTR (1<<TIF_PERFCTR)
@@ -250,8 +251,9 @@ register struct thread_info *current_thread_info_reg asm("g6");
250#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 251#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
251 252
252#define _TIF_USER_WORK_MASK ((0xff << TI_FLAG_WSAVED_SHIFT) | \ 253#define _TIF_USER_WORK_MASK ((0xff << TI_FLAG_WSAVED_SHIFT) | \
253 (_TIF_SIGPENDING | \ 254 _TIF_DO_NOTIFY_RESUME_MASK | \
254 _TIF_NEED_RESCHED | _TIF_PERFCTR)) 255 _TIF_NEED_RESCHED | _TIF_PERFCTR)
256#define _TIF_DO_NOTIFY_RESUME_MASK (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING)
255 257
256/* 258/*
257 * Thread-synchronous status. 259 * Thread-synchronous status.
diff --git a/arch/sparc64/kernel/rtrap.S b/arch/sparc64/kernel/rtrap.S
index c6fc695fe1fe..97a993c1f7f3 100644
--- a/arch/sparc64/kernel/rtrap.S
+++ b/arch/sparc64/kernel/rtrap.S
@@ -46,7 +46,7 @@ __handle_user_windows:
46 wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate 46 wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate
47 ldx [%g6 + TI_FLAGS], %l0 47 ldx [%g6 + TI_FLAGS], %l0
48 48
491: andcc %l0, _TIF_SIGPENDING, %g0 491: andcc %l0, _TIF_DO_NOTIFY_RESUME_MASK, %g0
50 be,pt %xcc, __handle_user_windows_continue 50 be,pt %xcc, __handle_user_windows_continue
51 nop 51 nop
52 mov %l5, %o1 52 mov %l5, %o1
@@ -86,7 +86,7 @@ __handle_perfctrs:
86 wrpr %g0, RTRAP_PSTATE, %pstate 86 wrpr %g0, RTRAP_PSTATE, %pstate
87 wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate 87 wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate
88 ldx [%g6 + TI_FLAGS], %l0 88 ldx [%g6 + TI_FLAGS], %l0
891: andcc %l0, _TIF_SIGPENDING, %g0 891: andcc %l0, _TIF_DO_NOTIFY_RESUME_MASK, %g0
90 90
91 be,pt %xcc, __handle_perfctrs_continue 91 be,pt %xcc, __handle_perfctrs_continue
92 sethi %hi(TSTATE_PEF), %o0 92 sethi %hi(TSTATE_PEF), %o0
@@ -195,7 +195,7 @@ __handle_preemption_continue:
195 andcc %l1, %o0, %g0 195 andcc %l1, %o0, %g0
196 andcc %l0, _TIF_NEED_RESCHED, %g0 196 andcc %l0, _TIF_NEED_RESCHED, %g0
197 bne,pn %xcc, __handle_preemption 197 bne,pn %xcc, __handle_preemption
198 andcc %l0, _TIF_SIGPENDING, %g0 198 andcc %l0, _TIF_DO_NOTIFY_RESUME_MASK, %g0
199 bne,pn %xcc, __handle_signal 199 bne,pn %xcc, __handle_signal
200__handle_signal_continue: 200__handle_signal_continue:
201 ldub [%g6 + TI_WSAVED], %o2 201 ldub [%g6 + TI_WSAVED], %o2
diff --git a/arch/sparc64/kernel/signal.c b/arch/sparc64/kernel/signal.c
index 9667e96fd513..9424fdab306c 100644
--- a/arch/sparc64/kernel/signal.c
+++ b/arch/sparc64/kernel/signal.c
@@ -17,6 +17,7 @@
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/wait.h> 18#include <linux/wait.h>
19#include <linux/ptrace.h> 19#include <linux/ptrace.h>
20#include <linux/tracehook.h>
20#include <linux/unistd.h> 21#include <linux/unistd.h>
21#include <linux/mm.h> 22#include <linux/mm.h>
22#include <linux/tty.h> 23#include <linux/tty.h>
@@ -605,4 +606,8 @@ void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0, unsigned long
605{ 606{
606 if (thread_info_flags & _TIF_SIGPENDING) 607 if (thread_info_flags & _TIF_SIGPENDING)
607 do_signal(regs, orig_i0); 608 do_signal(regs, orig_i0);
609 if (thread_info_flags & _TIF_NOTIFY_RESUME) {
610 clear_thread_flag(TIF_NOTIFY_RESUME);
611 tracehook_notify_resume(regs);
612 }
608} 613}