Commit e35a8925 authored by Roland McGrath's avatar Roland McGrath Committed by David S. Miller

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: default avatarRoland McGrath <roland@redhat.com>
parent badcbf0e
...@@ -219,7 +219,7 @@ register struct thread_info *current_thread_info_reg asm("g6"); ...@@ -219,7 +219,7 @@ register struct thread_info *current_thread_info_reg asm("g6");
* nop * nop
*/ */
#define TIF_SYSCALL_TRACE 0 /* syscall trace active */ #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
/* flags bit 1 is available */ #define TIF_NOTIFY_RESUME 1 /* callback before returning to user */
#define TIF_SIGPENDING 2 /* signal pending */ #define TIF_SIGPENDING 2 /* signal pending */
#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
#define TIF_PERFCTR 4 /* performance counters active */ #define TIF_PERFCTR 4 /* performance counters active */
...@@ -239,6 +239,7 @@ register struct thread_info *current_thread_info_reg asm("g6"); ...@@ -239,6 +239,7 @@ register struct thread_info *current_thread_info_reg asm("g6");
#define TIF_POLLING_NRFLAG 14 #define TIF_POLLING_NRFLAG 14
#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
#define _TIF_SIGPENDING (1<<TIF_SIGPENDING) #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
#define _TIF_PERFCTR (1<<TIF_PERFCTR) #define _TIF_PERFCTR (1<<TIF_PERFCTR)
...@@ -250,8 +251,9 @@ register struct thread_info *current_thread_info_reg asm("g6"); ...@@ -250,8 +251,9 @@ register struct thread_info *current_thread_info_reg asm("g6");
#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
#define _TIF_USER_WORK_MASK ((0xff << TI_FLAG_WSAVED_SHIFT) | \ #define _TIF_USER_WORK_MASK ((0xff << TI_FLAG_WSAVED_SHIFT) | \
(_TIF_SIGPENDING | \ _TIF_DO_NOTIFY_RESUME_MASK | \
_TIF_NEED_RESCHED | _TIF_PERFCTR)) _TIF_NEED_RESCHED | _TIF_PERFCTR)
#define _TIF_DO_NOTIFY_RESUME_MASK (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING)
/* /*
* Thread-synchronous status. * Thread-synchronous status.
......
...@@ -46,7 +46,7 @@ __handle_user_windows: ...@@ -46,7 +46,7 @@ __handle_user_windows:
wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate
ldx [%g6 + TI_FLAGS], %l0 ldx [%g6 + TI_FLAGS], %l0
1: andcc %l0, _TIF_SIGPENDING, %g0 1: andcc %l0, _TIF_DO_NOTIFY_RESUME_MASK, %g0
be,pt %xcc, __handle_user_windows_continue be,pt %xcc, __handle_user_windows_continue
nop nop
mov %l5, %o1 mov %l5, %o1
...@@ -86,7 +86,7 @@ __handle_perfctrs: ...@@ -86,7 +86,7 @@ __handle_perfctrs:
wrpr %g0, RTRAP_PSTATE, %pstate wrpr %g0, RTRAP_PSTATE, %pstate
wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate
ldx [%g6 + TI_FLAGS], %l0 ldx [%g6 + TI_FLAGS], %l0
1: andcc %l0, _TIF_SIGPENDING, %g0 1: andcc %l0, _TIF_DO_NOTIFY_RESUME_MASK, %g0
be,pt %xcc, __handle_perfctrs_continue be,pt %xcc, __handle_perfctrs_continue
sethi %hi(TSTATE_PEF), %o0 sethi %hi(TSTATE_PEF), %o0
...@@ -195,7 +195,7 @@ __handle_preemption_continue: ...@@ -195,7 +195,7 @@ __handle_preemption_continue:
andcc %l1, %o0, %g0 andcc %l1, %o0, %g0
andcc %l0, _TIF_NEED_RESCHED, %g0 andcc %l0, _TIF_NEED_RESCHED, %g0
bne,pn %xcc, __handle_preemption bne,pn %xcc, __handle_preemption
andcc %l0, _TIF_SIGPENDING, %g0 andcc %l0, _TIF_DO_NOTIFY_RESUME_MASK, %g0
bne,pn %xcc, __handle_signal bne,pn %xcc, __handle_signal
__handle_signal_continue: __handle_signal_continue:
ldub [%g6 + TI_WSAVED], %o2 ldub [%g6 + TI_WSAVED], %o2
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/wait.h> #include <linux/wait.h>
#include <linux/ptrace.h> #include <linux/ptrace.h>
#include <linux/tracehook.h>
#include <linux/unistd.h> #include <linux/unistd.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/tty.h> #include <linux/tty.h>
...@@ -605,4 +606,8 @@ void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0, unsigned long ...@@ -605,4 +606,8 @@ void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0, unsigned long
{ {
if (thread_info_flags & _TIF_SIGPENDING) if (thread_info_flags & _TIF_SIGPENDING)
do_signal(regs, orig_i0); do_signal(regs, orig_i0);
if (thread_info_flags & _TIF_NOTIFY_RESUME) {
clear_thread_flag(TIF_NOTIFY_RESUME);
tracehook_notify_resume(regs);
}
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment