aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-12-17 00:55:44 -0500
committerDavid S. Miller <davem@davemloft.net>2008-12-17 00:55:44 -0500
commit878a5535957b563c447d32866a9e606c55fef091 (patch)
tree7b78655a3aee14afb302b039a1a3e51e6b220b54 /arch
parent410d2c8187ed969238ba98008c1d57307a56cfd8 (diff)
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>
Diffstat (limited to 'arch')
-rw-r--r--arch/sparc/include/asm/ptrace_32.h10
-rw-r--r--arch/sparc/include/asm/ptrace_64.h9
2 files changed, 19 insertions, 0 deletions
diff --git a/arch/sparc/include/asm/ptrace_32.h b/arch/sparc/include/asm/ptrace_32.h
index d409c4f21a5c..4cef450167dd 100644
--- a/arch/sparc/include/asm/ptrace_32.h
+++ b/arch/sparc/include/asm/ptrace_32.h
@@ -62,6 +62,8 @@ struct sparc_stackf {
62 62
63#ifdef __KERNEL__ 63#ifdef __KERNEL__
64 64
65#include <asm/system.h>
66
65static inline bool pt_regs_is_syscall(struct pt_regs *regs) 67static inline bool pt_regs_is_syscall(struct pt_regs *regs)
66{ 68{
67 return (regs->psr & PSR_SYSCALL); 69 return (regs->psr & PSR_SYSCALL);
@@ -72,6 +74,14 @@ static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
72 return (regs->psr &= ~PSR_SYSCALL); 74 return (regs->psr &= ~PSR_SYSCALL);
73} 75}
74 76
77#define arch_ptrace_stop_needed(exit_code, info) \
78({ flush_user_windows(); \
79 current_thread_info()->w_saved != 0; \
80})
81
82#define arch_ptrace_stop(exit_code, info) \
83 synchronize_user_stack()
84
75#define user_mode(regs) (!((regs)->psr & PSR_PS)) 85#define user_mode(regs) (!((regs)->psr & PSR_PS))
76#define instruction_pointer(regs) ((regs)->pc) 86#define instruction_pointer(regs) ((regs)->pc)
77#define user_stack_pointer(regs) ((regs)->u_regs[UREG_FP]) 87#define user_stack_pointer(regs) ((regs)->u_regs[UREG_FP])
diff --git a/arch/sparc/include/asm/ptrace_64.h b/arch/sparc/include/asm/ptrace_64.h
index 84e969f06afe..cd6fbfc20435 100644
--- a/arch/sparc/include/asm/ptrace_64.h
+++ b/arch/sparc/include/asm/ptrace_64.h
@@ -114,6 +114,7 @@ struct sparc_trapf {
114#ifdef __KERNEL__ 114#ifdef __KERNEL__
115 115
116#include <linux/threads.h> 116#include <linux/threads.h>
117#include <asm/system.h>
117 118
118static inline int pt_regs_trap_type(struct pt_regs *regs) 119static inline int pt_regs_trap_type(struct pt_regs *regs)
119{ 120{
@@ -130,6 +131,14 @@ static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
130 return (regs->tstate &= ~TSTATE_SYSCALL); 131 return (regs->tstate &= ~TSTATE_SYSCALL);
131} 132}
132 133
134#define arch_ptrace_stop_needed(exit_code, info) \
135({ flush_user_windows(); \
136 get_thread_wsaved() != 0; \
137})
138
139#define arch_ptrace_stop(exit_code, info) \
140 synchronize_user_stack()
141
133struct global_reg_snapshot { 142struct global_reg_snapshot {
134 unsigned long tstate; 143 unsigned long tstate;
135 unsigned long tpc; 144 unsigned long tpc;