Re: [PATCH v6 1/2] riscv: probes: simulate c.jal instruction
From: Nam Cao
Date: Thu Jul 02 2026 - 06:11:02 EST
Xiaofeng Yuan <xiaofengmian@xxxxxxx> writes:
> The c.jal instruction is currently marked REJECTED in kprobes
> instruction decoding, but it should be SIMULATED like other
> compressed jump instructions.
>
> Add simulate_c_jal() which saves the return address to RA and
> sets the program counter to the target offset, reusing
> simulate_c_j for the common jump logic.
>
> Although c.jal is RV32-only, the function compiles unconditionally.
> On RV64, riscv_insn_is_c_jal() always returns 0, so the simulation
> code is never invoked and the small overhead in kernel size is
> acceptable.
>
> Signed-off-by: Xiaofeng Yuan <xiaofengmian@xxxxxxx>
Reviewed-by: Nam Cao <namcao@xxxxxxxxxxxxx>
Tested-by: Nam Cao <namcao@xxxxxxxxxxxxx>