blob: d0aba7b32417a021bff332992d02d8b587f3fa41 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001/* 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#include <asm/traps.h>
9#include <linux/types.h>
10
11#ifndef __ASSEMBLY__
12
13#define PS_S 0x80000000 /* Supervisor Mode */
14
15#define arch_has_single_step() (1)
16#define current_pt_regs() \
17({ (struct pt_regs *)((char *)current_thread_info() + THREAD_SIZE) - 1; })
18
19#define user_stack_pointer(regs) ((regs)->usp)
20
21#define user_mode(regs) (!((regs)->sr & PS_S))
22#define instruction_pointer(regs) ((regs)->pc)
23#define profile_pc(regs) instruction_pointer(regs)
24
25static inline bool in_syscall(struct pt_regs const *regs)
26{
27 return ((regs->sr >> 16) & 0xff) == VEC_TRAP0;
28}
29
30static inline void forget_syscall(struct pt_regs *regs)
31{
32 regs->sr &= ~(0xff << 16);
33}
34
35static inline unsigned long regs_return_value(struct pt_regs *regs)
36{
37 return regs->a0;
38}
39
40#endif /* __ASSEMBLY__ */
41#endif /* __ASM_CSKY_PTRACE_H */