x86/efi: Enforce CONFIG_RELOCATABLE for EFI boot stub
[linux/fpc-iii.git] / arch / sparc / include / asm / ptrace.h
blobbdfafd7af46fb48eeb04e25787733b0500f66d07
1 #ifndef __SPARC_PTRACE_H
2 #define __SPARC_PTRACE_H
4 #include <uapi/asm/ptrace.h>
6 #if defined(__sparc__) && defined(__arch64__)
7 #ifndef __ASSEMBLY__
9 #include <linux/threads.h>
10 #include <asm/switch_to.h>
12 static inline int pt_regs_trap_type(struct pt_regs *regs)
14 return regs->magic & 0x1ff;
17 static inline bool pt_regs_is_syscall(struct pt_regs *regs)
19 return (regs->tstate & TSTATE_SYSCALL);
22 static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
24 return (regs->tstate &= ~TSTATE_SYSCALL);
27 #define arch_ptrace_stop_needed(exit_code, info) \
28 ({ flush_user_windows(); \
29 get_thread_wsaved() != 0; \
32 #define arch_ptrace_stop(exit_code, info) \
33 synchronize_user_stack()
35 #define current_pt_regs() \
36 ((struct pt_regs *)((unsigned long)current_thread_info() + THREAD_SIZE) - 1)
38 struct global_reg_snapshot {
39 unsigned long tstate;
40 unsigned long tpc;
41 unsigned long tnpc;
42 unsigned long o7;
43 unsigned long i7;
44 unsigned long rpc;
45 struct thread_info *thread;
46 unsigned long pad1;
49 struct global_pmu_snapshot {
50 unsigned long pcr[4];
51 unsigned long pic[4];
54 union global_cpu_snapshot {
55 struct global_reg_snapshot reg;
56 struct global_pmu_snapshot pmu;
59 extern union global_cpu_snapshot global_cpu_snapshot[NR_CPUS];
61 #define force_successful_syscall_return() set_thread_noerror(1)
62 #define user_mode(regs) (!((regs)->tstate & TSTATE_PRIV))
63 #define instruction_pointer(regs) ((regs)->tpc)
64 #define instruction_pointer_set(regs, val) ((regs)->tpc = (val))
65 #define user_stack_pointer(regs) ((regs)->u_regs[UREG_FP])
66 static inline int is_syscall_success(struct pt_regs *regs)
68 return !(regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY));
71 static inline long regs_return_value(struct pt_regs *regs)
73 return regs->u_regs[UREG_I0];
75 #ifdef CONFIG_SMP
76 extern unsigned long profile_pc(struct pt_regs *);
77 #else
78 #define profile_pc(regs) instruction_pointer(regs)
79 #endif
80 #else /* __ASSEMBLY__ */
81 #endif /* __ASSEMBLY__ */
82 #else /* (defined(__sparc__) && defined(__arch64__)) */
83 #ifndef __ASSEMBLY__
84 #include <asm/switch_to.h>
86 static inline bool pt_regs_is_syscall(struct pt_regs *regs)
88 return (regs->psr & PSR_SYSCALL);
91 static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
93 return (regs->psr &= ~PSR_SYSCALL);
96 #define arch_ptrace_stop_needed(exit_code, info) \
97 ({ flush_user_windows(); \
98 current_thread_info()->w_saved != 0; \
101 #define arch_ptrace_stop(exit_code, info) \
102 synchronize_user_stack()
104 #define current_pt_regs() \
105 ((struct pt_regs *)((unsigned long)current_thread_info() + THREAD_SIZE) - 1)
107 #define user_mode(regs) (!((regs)->psr & PSR_PS))
108 #define instruction_pointer(regs) ((regs)->pc)
109 #define user_stack_pointer(regs) ((regs)->u_regs[UREG_FP])
110 unsigned long profile_pc(struct pt_regs *);
111 #else /* (!__ASSEMBLY__) */
112 #endif /* (!__ASSEMBLY__) */
113 #endif /* (defined(__sparc__) && defined(__arch64__)) */
114 #define STACK_BIAS 2047
116 /* global_reg_snapshot offsets */
117 #define GR_SNAP_TSTATE 0x00
118 #define GR_SNAP_TPC 0x08
119 #define GR_SNAP_TNPC 0x10
120 #define GR_SNAP_O7 0x18
121 #define GR_SNAP_I7 0x20
122 #define GR_SNAP_RPC 0x28
123 #define GR_SNAP_THREAD 0x30
124 #define GR_SNAP_PAD1 0x38
126 #endif /* !(__SPARC_PTRACE_H) */