diff options
author | Christoph Hellwig <hch@lst.de> | 2019-04-15 05:14:40 -0400 |
---|---|---|
committer | Palmer Dabbelt <palmer@sifive.com> | 2019-04-25 17:51:11 -0400 |
commit | 6ab77af4b0ee09b58ace90aeb9b1b84f4605b859 (patch) | |
tree | 0965302ff07917cfc8ba31698dc4c4488e901e6b | |
parent | 877425424d6c853b804e6b6a6045a5b4ea97c510 (diff) |
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>
-rw-r--r-- | arch/riscv/include/asm/ptrace.h | 21 | ||||
-rw-r--r-- | arch/riscv/kernel/stacktrace.c | 10 | ||||
-rw-r--r-- | arch/riscv/kernel/traps.c | 2 |
3 files changed, 12 insertions, 21 deletions
diff --git a/arch/riscv/include/asm/ptrace.h b/arch/riscv/include/asm/ptrace.h index d35ec2f41381..9c867a4bac83 100644 --- a/arch/riscv/include/asm/ptrace.h +++ b/arch/riscv/include/asm/ptrace.h | |||
@@ -70,47 +70,38 @@ struct pt_regs { | |||
70 | 70 | ||
71 | 71 | ||
72 | /* Helpers for working with the instruction pointer */ | 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)) | ||
75 | |||
76 | static inline unsigned long instruction_pointer(struct pt_regs *regs) | 73 | static inline unsigned long instruction_pointer(struct pt_regs *regs) |
77 | { | 74 | { |
78 | return GET_IP(regs); | 75 | return regs->sepc; |
79 | } | 76 | } |
80 | static inline void instruction_pointer_set(struct pt_regs *regs, | 77 | static inline void instruction_pointer_set(struct pt_regs *regs, |
81 | unsigned long val) | 78 | unsigned long val) |
82 | { | 79 | { |
83 | SET_IP(regs, val); | 80 | regs->sepc = val; |
84 | } | 81 | } |
85 | 82 | ||
86 | #define profile_pc(regs) instruction_pointer(regs) | 83 | #define profile_pc(regs) instruction_pointer(regs) |
87 | 84 | ||
88 | /* Helpers for working with the user stack pointer */ | 85 | /* 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)) | ||
91 | |||
92 | static inline unsigned long user_stack_pointer(struct pt_regs *regs) | 86 | static inline unsigned long user_stack_pointer(struct pt_regs *regs) |
93 | { | 87 | { |
94 | return GET_USP(regs); | 88 | return regs->sp; |
95 | } | 89 | } |
96 | static inline void user_stack_pointer_set(struct pt_regs *regs, | 90 | static inline void user_stack_pointer_set(struct pt_regs *regs, |
97 | unsigned long val) | 91 | unsigned long val) |
98 | { | 92 | { |
99 | SET_USP(regs, val); | 93 | regs->sp = val; |
100 | } | 94 | } |
101 | 95 | ||
102 | /* Helpers for working with the frame pointer */ | 96 | /* Helpers for working with the frame pointer */ |
103 | #define GET_FP(regs) ((regs)->s0) | ||
104 | #define SET_FP(regs, val) (GET_FP(regs) = (val)) | ||
105 | |||
106 | static inline unsigned long frame_pointer(struct pt_regs *regs) | 97 | static inline unsigned long frame_pointer(struct pt_regs *regs) |
107 | { | 98 | { |
108 | return GET_FP(regs); | 99 | return regs->s0; |
109 | } | 100 | } |
110 | static inline void frame_pointer_set(struct pt_regs *regs, | 101 | static inline void frame_pointer_set(struct pt_regs *regs, |
111 | unsigned long val) | 102 | unsigned long val) |
112 | { | 103 | { |
113 | SET_FP(regs, val); | 104 | regs->s0 = val; |
114 | } | 105 | } |
115 | 106 | ||
116 | static inline unsigned long regs_return_value(struct pt_regs *regs) | 107 | static inline unsigned long regs_return_value(struct pt_regs *regs) |
diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrace.c index 855036c440c1..a4386a0c8f67 100644 --- a/arch/riscv/kernel/stacktrace.c +++ b/arch/riscv/kernel/stacktrace.c | |||
@@ -33,9 +33,9 @@ static void notrace walk_stackframe(struct task_struct *task, | |||
33 | unsigned long fp, sp, pc; | 33 | unsigned long fp, sp, pc; |
34 | 34 | ||
35 | if (regs) { | 35 | if (regs) { |
36 | fp = GET_FP(regs); | 36 | fp = frame_pointer(regs); |
37 | sp = GET_USP(regs); | 37 | sp = user_stack_pointer(regs); |
38 | pc = GET_IP(regs); | 38 | pc = instruction_pointer(regs); |
39 | } else if (task == NULL || task == current) { | 39 | } else if (task == NULL || task == current) { |
40 | const register unsigned long current_sp __asm__ ("sp"); | 40 | const register unsigned long current_sp __asm__ ("sp"); |
41 | fp = (unsigned long)__builtin_frame_address(0); | 41 | fp = (unsigned long)__builtin_frame_address(0); |
@@ -78,8 +78,8 @@ static void notrace walk_stackframe(struct task_struct *task, | |||
78 | unsigned long *ksp; | 78 | unsigned long *ksp; |
79 | 79 | ||
80 | if (regs) { | 80 | if (regs) { |
81 | sp = GET_USP(regs); | 81 | sp = user_stack_pointer(regs); |
82 | pc = GET_IP(regs); | 82 | pc = instruction_pointer(regs); |
83 | } else if (task == NULL || task == current) { | 83 | } else if (task == NULL || task == current) { |
84 | const register unsigned long current_sp __asm__ ("sp"); | 84 | const register unsigned long current_sp __asm__ ("sp"); |
85 | sp = current_sp; | 85 | sp = current_sp; |
diff --git a/arch/riscv/kernel/traps.c b/arch/riscv/kernel/traps.c index 24a9333dda2c..86731a2fa218 100644 --- a/arch/riscv/kernel/traps.c +++ b/arch/riscv/kernel/traps.c | |||
@@ -70,7 +70,7 @@ void do_trap(struct pt_regs *regs, int signo, int code, | |||
70 | && printk_ratelimit()) { | 70 | && printk_ratelimit()) { |
71 | pr_info("%s[%d]: unhandled signal %d code 0x%x at 0x" REG_FMT, | 71 | pr_info("%s[%d]: unhandled signal %d code 0x%x at 0x" REG_FMT, |
72 | tsk->comm, task_pid_nr(tsk), signo, code, addr); | 72 | tsk->comm, task_pid_nr(tsk), signo, code, addr); |
73 | print_vma_addr(KERN_CONT " in ", GET_IP(regs)); | 73 | print_vma_addr(KERN_CONT " in ", instruction_pointer(regs)); |
74 | pr_cont("\n"); | 74 | pr_cont("\n"); |
75 | show_regs(regs); | 75 | show_regs(regs); |
76 | } | 76 | } |