Skip to content

Commit a6484ba

Browse files
seehearfeelchenhuacai
authored andcommitted
samples/kprobes: Add LoongArch support
Add LoongArch specific info in handler_pre() and handler_post(). Tested-by: Jeff Xie <[email protected]> Signed-off-by: Tiezhu Yang <[email protected]> Signed-off-by: Huacai Chen <[email protected]>
1 parent fcf77d0 commit a6484ba

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
@@ -55,6 +55,10 @@ static int __kprobes handler_pre(struct kprobe *p, struct pt_regs *regs)
5555
pr_info("<%s> p->addr, 0x%p, ip = 0x%lx, flags = 0x%lx\n",
5656
p->symbol_name, p->addr, regs->psw.addr, regs->flags);
5757
#endif
58+
#ifdef CONFIG_LOONGARCH
59+
pr_info("<%s> p->addr = 0x%p, era = 0x%lx, estat = 0x%lx\n",
60+
p->symbol_name, p->addr, regs->csr_era, regs->csr_estat);
61+
#endif
5862

5963
/* A dump_stack() here will give a stack backtrace */
6064
return 0;
@@ -92,6 +96,10 @@ static void __kprobes handler_post(struct kprobe *p, struct pt_regs *regs,
9296
pr_info("<%s> p->addr, 0x%p, flags = 0x%lx\n",
9397
p->symbol_name, p->addr, regs->flags);
9498
#endif
99+
#ifdef CONFIG_LOONGARCH
100+
pr_info("<%s> p->addr = 0x%p, estat = 0x%lx\n",
101+
p->symbol_name, p->addr, regs->csr_estat);
102+
#endif
95103
}
96104

97105
static int __init kprobe_init(void)

0 commit comments

Comments
 (0)