2 * Copyright (C) 2012 Regents of the University of California
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation, version 2.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
14 #ifndef _ASM_RISCV_PTRACE_H
15 #define _ASM_RISCV_PTRACE_H
17 #include <uapi/asm/ptrace.h>
56 unsigned long sstatus
;
57 unsigned long sbadaddr
;
59 /* a0 value before the syscall */
60 unsigned long orig_a0
;
64 #define REG_FMT "%016lx"
66 #define REG_FMT "%08lx"
69 #define user_mode(regs) (((regs)->sstatus & SR_SPP) == 0)
72 /* Helpers for working with the instruction pointer */
73 #define GET_IP(regs) ((regs)->sepc)
74 #define SET_IP(regs, val) (GET_IP(regs) = (val))
76 static inline unsigned long instruction_pointer(struct pt_regs
*regs
)
80 static inline void instruction_pointer_set(struct pt_regs
*regs
,
86 #define profile_pc(regs) instruction_pointer(regs)
88 /* Helpers for working with the user stack pointer */
89 #define GET_USP(regs) ((regs)->sp)
90 #define SET_USP(regs, val) (GET_USP(regs) = (val))
92 static inline unsigned long user_stack_pointer(struct pt_regs
*regs
)
96 static inline void user_stack_pointer_set(struct pt_regs
*regs
,
102 /* Helpers for working with the frame pointer */
103 #define GET_FP(regs) ((regs)->s0)
104 #define SET_FP(regs, val) (GET_FP(regs) = (val))
106 static inline unsigned long frame_pointer(struct pt_regs
*regs
)
110 static inline void frame_pointer_set(struct pt_regs
*regs
,
116 #endif /* __ASSEMBLY__ */
118 #endif /* _ASM_RISCV_PTRACE_H */