sparc: We need to implement arch_ptrace_stop().

In order to always provide fully synchronized state to the debugger,
we might need to do a synchronize_user_stack().

A pair of hooks, arch_ptrace_stop_needed() and arch_ptrace_stop(),
exist to handle this kind of situation. It was created for
the sake of IA64.

Use them, to flush the kernel side cached register windows
to the user stack, when necessary.

Signed-off-by: David S. Miller <davem@davemloft.net>

+19
+10
arch/sparc/include/asm/ptrace_32.h
··· 62 62 63 63 #ifdef __KERNEL__ 64 64 65 + #include <asm/system.h> 66 + 65 67 static inline bool pt_regs_is_syscall(struct pt_regs *regs) 66 68 { 67 69 return (regs->psr & PSR_SYSCALL); ··· 73 71 { 74 72 return (regs->psr &= ~PSR_SYSCALL); 75 73 } 74 + 75 + #define arch_ptrace_stop_needed(exit_code, info) \ 76 + ({ flush_user_windows(); \ 77 + current_thread_info()->w_saved != 0; \ 78 + }) 79 + 80 + #define arch_ptrace_stop(exit_code, info) \ 81 + synchronize_user_stack() 76 82 77 83 #define user_mode(regs) (!((regs)->psr & PSR_PS)) 78 84 #define instruction_pointer(regs) ((regs)->pc)
+9
arch/sparc/include/asm/ptrace_64.h
··· 114 114 #ifdef __KERNEL__ 115 115 116 116 #include <linux/threads.h> 117 + #include <asm/system.h> 117 118 118 119 static inline int pt_regs_trap_type(struct pt_regs *regs) 119 120 { ··· 130 129 { 131 130 return (regs->tstate &= ~TSTATE_SYSCALL); 132 131 } 132 + 133 + #define arch_ptrace_stop_needed(exit_code, info) \ 134 + ({ flush_user_windows(); \ 135 + get_thread_wsaved() != 0; \ 136 + }) 137 + 138 + #define arch_ptrace_stop(exit_code, info) \ 139 + synchronize_user_stack() 133 140 134 141 struct global_reg_snapshot { 135 142 unsigned long tstate;