Skip to content

Commit 8a07ac3

Browse files
xhackerustcpalmer-dabbelt
authored andcommitted
samples/kprobes: Add riscv support
Add riscv specific info dump in both handler_pre() and handler_post(). Signed-off-by: Jisheng Zhang <[email protected]> Acked-by: Masami Hiramatsu <[email protected]> Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent adebc88 commit 8a07ac3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

samples/kprobes/kprobe_example.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ static int __kprobes handler_pre(struct kprobe *p, struct pt_regs *regs)
4747
pr_info("<%s> pre_handler: p->addr = 0x%p, pc = 0x%lx, cpsr = 0x%lx\n",
4848
p->symbol_name, p->addr, (long)regs->ARM_pc, (long)regs->ARM_cpsr);
4949
#endif
50+
#ifdef CONFIG_RISCV
51+
pr_info("<%s> pre_handler: p->addr = 0x%p, pc = 0x%lx, status = 0x%lx\n",
52+
p->symbol_name, p->addr, regs->epc, regs->status);
53+
#endif
5054
#ifdef CONFIG_S390
5155
pr_info("<%s> pre_handler: p->addr, 0x%p, ip = 0x%lx, flags = 0x%lx\n",
5256
p->symbol_name, p->addr, regs->psw.addr, regs->flags);
@@ -80,6 +84,10 @@ static void __kprobes handler_post(struct kprobe *p, struct pt_regs *regs,
8084
pr_info("<%s> post_handler: p->addr = 0x%p, cpsr = 0x%lx\n",
8185
p->symbol_name, p->addr, (long)regs->ARM_cpsr);
8286
#endif
87+
#ifdef CONFIG_RISCV
88+
pr_info("<%s> post_handler: p->addr = 0x%p, status = 0x%lx\n",
89+
p->symbol_name, p->addr, regs->status);
90+
#endif
8391
#ifdef CONFIG_S390
8492
pr_info("<%s> pre_handler: p->addr, 0x%p, flags = 0x%lx\n",
8593
p->symbol_name, p->addr, regs->flags);

0 commit comments

Comments
 (0)