2 * Copyright (c) 2017 Microsemi Corporation.
3 * Copyright (c) 2017 Padmarao Begari <Padmarao.Begari@microsemi.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 #ifndef __ASM_RISCV_PTRACE_H
10 #define __ASM_RISCV_PTRACE_H
46 unsigned long sstatus;
47 unsigned long sbadaddr;
52 #define REG_FMT "%016lx"
54 #define REG_FMT "%08lx"
57 #define user_mode(regs) (((regs)->sstatus & SR_PS) == 0)
59 /* Helpers for working with the instruction pointer */
60 #define GET_IP(regs) ((regs)->sepc)
61 #define SET_IP(regs, val) (GET_IP(regs) = (val))
63 static inline unsigned long instruction_pointer(struct pt_regs *regs)
68 static inline void instruction_pointer_set(struct pt_regs *regs, ulong val)
73 #define profile_pc(regs) instruction_pointer(regs)
75 /* Helpers for working with the user stack pointer */
76 #define GET_USP(regs) ((regs)->sp)
77 #define SET_USP(regs, val) (GET_USP(regs) = (val))
79 static inline unsigned long user_stack_pointer(struct pt_regs *regs)
84 static inline void user_stack_pointer_set(struct pt_regs *regs, ulong val)
89 /* Helpers for working with the frame pointer */
90 #define GET_FP(regs) ((regs)->s0)
91 #define SET_FP(regs, val) (GET_FP(regs) = (val))
93 static inline unsigned long frame_pointer(struct pt_regs *regs)
98 static inline void frame_pointer_set(struct pt_regs *regs, ulong val)
103 #endif /* __ASM_RISCV_PTRACE_H */