1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2012 Regents of the University of California
6 #ifndef _ASM_RISCV_PTRACE_H
7 #define _ASM_RISCV_PTRACE_H
9 #include <uapi/asm/ptrace.h>
47 /* Supervisor/Machine CSRs */
49 unsigned long badaddr
;
51 /* a0 value before the syscall */
52 unsigned long orig_a0
;
56 #define REG_FMT "%016lx"
58 #define REG_FMT "%08lx"
61 #define user_mode(regs) (((regs)->status & SR_PP) == 0)
64 /* Helpers for working with the instruction pointer */
65 static inline unsigned long instruction_pointer(struct pt_regs
*regs
)
69 static inline void instruction_pointer_set(struct pt_regs
*regs
,
75 #define profile_pc(regs) instruction_pointer(regs)
77 /* Helpers for working with the user stack pointer */
78 static inline unsigned long user_stack_pointer(struct pt_regs
*regs
)
82 static inline void user_stack_pointer_set(struct pt_regs
*regs
,
88 /* Helpers for working with the frame pointer */
89 static inline unsigned long frame_pointer(struct pt_regs
*regs
)
93 static inline void frame_pointer_set(struct pt_regs
*regs
,
99 static inline unsigned long regs_return_value(struct pt_regs
*regs
)
104 #endif /* __ASSEMBLY__ */
106 #endif /* _ASM_RISCV_PTRACE_H */