Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 0/2] riscv: add c.jal instruction simulation for kprobes
@ 2026-07-01  8:10 Xiaofeng Yuan
  2026-07-01  8:10 ` [PATCH v6 1/2] riscv: probes: simulate c.jal instruction Xiaofeng Yuan
  2026-07-01  8:10 ` [PATCH v6 2/2] riscv: kprobes: add test case for c.jal instruction simulation Xiaofeng Yuan
  0 siblings, 2 replies; 4+ messages in thread
From: Xiaofeng Yuan @ 2026-07-01  8:10 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou
  Cc: Charlie Jenkins, Nam Cao, linux-riscv, linux-kernel, xiaofengmian

The c.jal instruction is part of the RISC-V compressed instruction set
and is defined only on RV32.  Currently kprobes rejects it, causing
probes placed on c.jal to fail.

This series adds simulation support for c.jal and includes a test
case by Nam Cao.

Changes since v5:
  - Removed the #if __riscv_xlen == 32 guards around simulate_c_jal()
    as both Charlie Jenkins and Nam Cao agreed they are unnecessary.
    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.
  - Included Nam Cao's test case for c.jal instruction simulation.

Changes since v4:
  - Reuse simulate_c_j() for the jump logic (Nam Cao)
  - Use direct register assignment instead of rv_insn_reg_set_val()
  - Move RISCV_INSN_SET_SIMULATE(c_jal) to group with other compressed
    jump instructions

Nam Cao (1):
  riscv: kprobes: add test case for c.jal instruction simulation

Xiaofeng Yuan (1):
  riscv: probes: simulate c.jal instruction

Nam Cao (1):
  riscv: kprobes: add test case for c.jal instruction simulation

Xiaofeng Yuan (1):
  riscv: probes: simulate c.jal instruction

 arch/riscv/kernel/probes/decode-insn.c        |  2 +-
 arch/riscv/kernel/probes/simulate-insn.c      |  7 ++++++
 arch/riscv/kernel/probes/simulate-insn.h      |  1 +
 .../kernel/tests/kprobes/test-kprobes-asm.S   | 24 +++++++++++++++++++
 4 files changed, 33 insertions(+), 1 deletion(-)

-- 
2.43.0


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-07-02  9:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-01  8:10 [PATCH v6 0/2] riscv: add c.jal instruction simulation for kprobes Xiaofeng Yuan
2026-07-01  8:10 ` [PATCH v6 1/2] riscv: probes: simulate c.jal instruction Xiaofeng Yuan
2026-07-02  9:49   ` Nam Cao
2026-07-01  8:10 ` [PATCH v6 2/2] riscv: kprobes: add test case for c.jal instruction simulation Xiaofeng Yuan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox