]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
riscv: kprobes: Remove duplication of RV_EXTRACT_ITYPE_IMM
authorNam Cao <namcao@linutronix.de>
Sun, 11 May 2025 21:18:03 +0000 (23:18 +0200)
committerPaul Walmsley <pjw@kernel.org>
Wed, 17 Sep 2025 00:46:44 +0000 (18:46 -0600)
Use RV_EXTRACT_ITYPE_IMM, instead of re-implementing it in simulate_jalr().

Signed-off-by: Nam Cao <namcao@linutronix.de>
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Link: https://lore.kernel.org/linux-riscv/8ae34e966c312ae5cf6c09a35ddc290cce942208.1747215274.git.namcao@linutronix.de/
Signed-off-by: Paul Walmsley <pjw@kernel.org>
arch/riscv/kernel/probes/simulate-insn.c

index 2b3cd69d6f8e15c00aef9dbbef49c72d418c20bb..fa581590c1f8b233e04cc50131f5f37fc52990c5 100644 (file)
@@ -64,7 +64,7 @@ bool __kprobes simulate_jalr(u32 opcode, unsigned long addr, struct pt_regs *reg
         */
        bool ret;
        unsigned long base_addr;
-       u32 imm = (opcode >> 20) & 0xfff;
+       u32 imm = RV_EXTRACT_ITYPE_IMM(opcode);
        u32 rd_index = RV_EXTRACT_RD_REG(opcode);
        u32 rs1_index = RV_EXTRACT_RS1_REG(opcode);