riscv: remove duplicate macros from ptrace.h
No need to have two names for the same thing. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
This commit is contained in:
Родитель
877425424d
Коммит
6ab77af4b0
|
@ -70,47 +70,38 @@ struct pt_regs {
|
||||||
|
|
||||||
|
|
||||||
/* Helpers for working with the instruction pointer */
|
/* Helpers for working with the instruction pointer */
|
||||||
#define GET_IP(regs) ((regs)->sepc)
|
|
||||||
#define SET_IP(regs, val) (GET_IP(regs) = (val))
|
|
||||||
|
|
||||||
static inline unsigned long instruction_pointer(struct pt_regs *regs)
|
static inline unsigned long instruction_pointer(struct pt_regs *regs)
|
||||||
{
|
{
|
||||||
return GET_IP(regs);
|
return regs->sepc;
|
||||||
}
|
}
|
||||||
static inline void instruction_pointer_set(struct pt_regs *regs,
|
static inline void instruction_pointer_set(struct pt_regs *regs,
|
||||||
unsigned long val)
|
unsigned long val)
|
||||||
{
|
{
|
||||||
SET_IP(regs, val);
|
regs->sepc = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define profile_pc(regs) instruction_pointer(regs)
|
#define profile_pc(regs) instruction_pointer(regs)
|
||||||
|
|
||||||
/* Helpers for working with the user stack pointer */
|
/* Helpers for working with the user stack pointer */
|
||||||
#define GET_USP(regs) ((regs)->sp)
|
|
||||||
#define SET_USP(regs, val) (GET_USP(regs) = (val))
|
|
||||||
|
|
||||||
static inline unsigned long user_stack_pointer(struct pt_regs *regs)
|
static inline unsigned long user_stack_pointer(struct pt_regs *regs)
|
||||||
{
|
{
|
||||||
return GET_USP(regs);
|
return regs->sp;
|
||||||
}
|
}
|
||||||
static inline void user_stack_pointer_set(struct pt_regs *regs,
|
static inline void user_stack_pointer_set(struct pt_regs *regs,
|
||||||
unsigned long val)
|
unsigned long val)
|
||||||
{
|
{
|
||||||
SET_USP(regs, val);
|
regs->sp = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Helpers for working with the frame pointer */
|
/* Helpers for working with the frame pointer */
|
||||||
#define GET_FP(regs) ((regs)->s0)
|
|
||||||
#define SET_FP(regs, val) (GET_FP(regs) = (val))
|
|
||||||
|
|
||||||
static inline unsigned long frame_pointer(struct pt_regs *regs)
|
static inline unsigned long frame_pointer(struct pt_regs *regs)
|
||||||
{
|
{
|
||||||
return GET_FP(regs);
|
return regs->s0;
|
||||||
}
|
}
|
||||||
static inline void frame_pointer_set(struct pt_regs *regs,
|
static inline void frame_pointer_set(struct pt_regs *regs,
|
||||||
unsigned long val)
|
unsigned long val)
|
||||||
{
|
{
|
||||||
SET_FP(regs, val);
|
regs->s0 = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned long regs_return_value(struct pt_regs *regs)
|
static inline unsigned long regs_return_value(struct pt_regs *regs)
|
||||||
|
|
|
@ -33,9 +33,9 @@ static void notrace walk_stackframe(struct task_struct *task,
|
||||||
unsigned long fp, sp, pc;
|
unsigned long fp, sp, pc;
|
||||||
|
|
||||||
if (regs) {
|
if (regs) {
|
||||||
fp = GET_FP(regs);
|
fp = frame_pointer(regs);
|
||||||
sp = GET_USP(regs);
|
sp = user_stack_pointer(regs);
|
||||||
pc = GET_IP(regs);
|
pc = instruction_pointer(regs);
|
||||||
} else if (task == NULL || task == current) {
|
} else if (task == NULL || task == current) {
|
||||||
const register unsigned long current_sp __asm__ ("sp");
|
const register unsigned long current_sp __asm__ ("sp");
|
||||||
fp = (unsigned long)__builtin_frame_address(0);
|
fp = (unsigned long)__builtin_frame_address(0);
|
||||||
|
@ -78,8 +78,8 @@ static void notrace walk_stackframe(struct task_struct *task,
|
||||||
unsigned long *ksp;
|
unsigned long *ksp;
|
||||||
|
|
||||||
if (regs) {
|
if (regs) {
|
||||||
sp = GET_USP(regs);
|
sp = user_stack_pointer(regs);
|
||||||
pc = GET_IP(regs);
|
pc = instruction_pointer(regs);
|
||||||
} else if (task == NULL || task == current) {
|
} else if (task == NULL || task == current) {
|
||||||
const register unsigned long current_sp __asm__ ("sp");
|
const register unsigned long current_sp __asm__ ("sp");
|
||||||
sp = current_sp;
|
sp = current_sp;
|
||||||
|
|
|
@ -70,7 +70,7 @@ void do_trap(struct pt_regs *regs, int signo, int code,
|
||||||
&& printk_ratelimit()) {
|
&& printk_ratelimit()) {
|
||||||
pr_info("%s[%d]: unhandled signal %d code 0x%x at 0x" REG_FMT,
|
pr_info("%s[%d]: unhandled signal %d code 0x%x at 0x" REG_FMT,
|
||||||
tsk->comm, task_pid_nr(tsk), signo, code, addr);
|
tsk->comm, task_pid_nr(tsk), signo, code, addr);
|
||||||
print_vma_addr(KERN_CONT " in ", GET_IP(regs));
|
print_vma_addr(KERN_CONT " in ", instruction_pointer(regs));
|
||||||
pr_cont("\n");
|
pr_cont("\n");
|
||||||
show_regs(regs);
|
show_regs(regs);
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче