xref: /linux/arch/csky/include/asm/ptrace.h (revision f335b10f3b6ca2d11adef95092fff65152c31b48)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
3 
4 #ifndef __ASM_CSKY_PTRACE_H
5 #define __ASM_CSKY_PTRACE_H
6 
7 #include <uapi/asm/ptrace.h>
8 
9 #ifndef __ASSEMBLY__
10 
11 #define PS_S	0x80000000 /* Supervisor Mode */
12 
13 #define arch_has_single_step() (1)
14 #define current_pt_regs() \
15 ({ (struct pt_regs *)((char *)current_thread_info() + THREAD_SIZE) - 1; })
16 
17 #define user_stack_pointer(regs) ((regs)->usp)
18 
19 #define user_mode(regs) (!((regs)->sr & PS_S))
20 #define instruction_pointer(regs) ((regs)->pc)
21 #define profile_pc(regs) instruction_pointer(regs)
22 
23 static inline unsigned long regs_return_value(struct pt_regs *regs)
24 {
25 	return regs->a0;
26 }
27 
28 #endif /* __ASSEMBLY__ */
29 #endif /* __ASM_CSKY_PTRACE_H */
30