xref: /linux/arch/alpha/include/asm/ptrace.h (revision 570f7e331f5febb30f1384817463c7e42b65ca7d)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASMAXP_PTRACE_H
3 #define _ASMAXP_PTRACE_H
4 
5 #include <uapi/asm/ptrace.h>
6 
7 
8 #define arch_has_single_step()		(1)
9 #define user_mode(regs) (((regs)->ps & 8) != 0)
10 #define instruction_pointer(regs) ((regs)->pc)
11 #define profile_pc(regs) instruction_pointer(regs)
12 #define current_user_stack_pointer() rdusp()
13 
14 #define task_pt_regs(task) \
15   ((struct pt_regs *) (task_stack_page(task) + 2*PAGE_SIZE) - 1)
16 
17 #define current_pt_regs() \
18   ((struct pt_regs *) ((char *)current_thread_info() + 2*PAGE_SIZE) - 1)
19 
20 #define force_successful_syscall_return() (current_pt_regs()->r0 = 0)
21 
22 static inline unsigned long regs_return_value(struct pt_regs *regs)
23 {
24 	return regs->r0;
25 }
26 
27 /* Helpers for working with the user stack pointer */
28 static inline unsigned long user_stack_pointer(struct pt_regs *regs)
29 {
30 	/* Valid for user-mode regs */
31 	return regs->usp;
32 }
33 
34 #endif
35