Skip to content

riscv: kgdb: Fix break size, insn patch and masking

Clément Léger linux-riscv lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3riscv: kgdb: use patch_insn_write() to set breakpointsarch/riscv/kernel/kgdb.c+29 -50 replies
2/3riscv: kgdb: use BREAK_INSTR_SIZE instead of hardcoded valuearch/riscv/kernel/kgdb.c+1 -10 replies
3/3riscv: kgdb: clear bit 0 of single-step jump targetsarch/riscv/kernel/kgdb.c+2 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] riscv: kgdb: Fix break size, insn patch and masking

This small series fixes a few problems that were spotted with kgdb.

First patch is the use of patch_insn_write() to set breakpoints instead of copy_to_kernel_nofault(). This fixes the use of kgdb with CONFIG_STRICT_KERNEL_RWX which maps text as RX.

Second patch removes the hardcoded epc += 4 with BREAK_INSTR_SIZE so that it works with CONFIG_RISCV_ISA_C.

Last one is more of a correctness fix with respect to jalr instructions. ISA specifies that the target address is computed by masking the LSB to 0.

Clément Léger (3):
riscv: kgdb: use patch_insn_write() to set breakpoints
riscv: kgdb: use BREAK_INSTR_SIZE instead of hardcoded value
riscv: kgdb: clear bit 0 of single-step jump targets

 arch/riscv/kernel/kgdb.c | 39 ++++++++++++++++++++++++++++++++-------
 1 file changed, 32 insertions(+), 7 deletions(-)
Signature · 1 line
Clément Léger