1 /* SPDX-License-Identifier: GPL-2.0 */
2 // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
4 #ifndef __ASM_CSKY_PTRACE_H
5 #define __ASM_CSKY_PTRACE_H
7 #include <uapi/asm/ptrace.h>
9 #include <linux/types.h>
13 #define PS_S 0x80000000 /* Supervisor Mode */
15 #define arch_has_single_step() (1)
16 #define current_pt_regs() \
17 ({ (struct pt_regs *)((char *)current_thread_info() + THREAD_SIZE) - 1; })
19 #define user_stack_pointer(regs) ((regs)->usp)
21 #define user_mode(regs) (!((regs)->sr & PS_S))
22 #define instruction_pointer(regs) ((regs)->pc)
23 #define profile_pc(regs) instruction_pointer(regs)
25 static inline bool in_syscall(struct pt_regs
const *regs
)
27 return ((regs
->sr
>> 16) & 0xff) == VEC_TRAP0
;
30 static inline void forget_syscall(struct pt_regs
*regs
)
32 regs
->sr
&= ~(0xff << 16);
35 static inline unsigned long regs_return_value(struct pt_regs
*regs
)
40 #endif /* __ASSEMBLY__ */
41 #endif /* __ASM_CSKY_PTRACE_H */