diff options
author | Zong Li <zong.li@sifive.com> | 2020-03-09 17:55:42 +0100 |
---|---|---|
committer | Palmer Dabbelt <palmerdabbelt@google.com> | 2020-03-26 17:24:49 +0100 |
commit | b42d763a2d412d6ef7c29cb2f1b3e9985e2b1e38 (patch) | |
tree | ec1aaa9c051806f02bf08ae62e66a93302b3c64a /arch/riscv/kernel/traps.c | |
parent | riscv: add STRICT_KERNEL_RWX support (diff) | |
download | linux-b42d763a2d412d6ef7c29cb2f1b3e9985e2b1e38.tar.xz linux-b42d763a2d412d6ef7c29cb2f1b3e9985e2b1e38.zip |
riscv: add macro to get instruction length
Extract the calculation of instruction length for common use.
Signed-off-by: Zong Li <zong.li@sifive.com>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
Diffstat (limited to 'arch/riscv/kernel/traps.c')
-rw-r--r-- | arch/riscv/kernel/traps.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/riscv/kernel/traps.c b/arch/riscv/kernel/traps.c index ffb3d94bf0cc..a4d136355f78 100644 --- a/arch/riscv/kernel/traps.c +++ b/arch/riscv/kernel/traps.c @@ -118,7 +118,8 @@ static inline unsigned long get_break_insn_length(unsigned long pc) if (probe_kernel_address((bug_insn_t *)pc, insn)) return 0; - return (((insn & __INSN_LENGTH_MASK) == __INSN_LENGTH_32) ? 4UL : 2UL); + + return GET_INSN_LENGTH(insn); } asmlinkage __visible void do_trap_break(struct pt_regs *regs) |