All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tiezhu Yang <yangtiezhu@loongson.cn>
To: Huacai Chen <chenhuacai@kernel.org>,
	WANG Xuerui <kernel@xen0n.name>,
	Masami Hiramatsu <mhiramat@kernel.org>
Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: [PATCH v10 4/4] samples/kprobes: Add LoongArch support
Date: Fri,  9 Dec 2022 16:53:01 +0800	[thread overview]
Message-ID: <1670575981-14389-5-git-send-email-yangtiezhu@loongson.cn> (raw)
In-Reply-To: <1670575981-14389-1-git-send-email-yangtiezhu@loongson.cn>

Add LoongArch specific info in handler_pre() and handler_post().

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 samples/kprobes/kprobe_example.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/samples/kprobes/kprobe_example.c b/samples/kprobes/kprobe_example.c
index fd346f5..ef44c61 100644
--- a/samples/kprobes/kprobe_example.c
+++ b/samples/kprobes/kprobe_example.c
@@ -55,6 +55,10 @@ static int __kprobes handler_pre(struct kprobe *p, struct pt_regs *regs)
 	pr_info("<%s> p->addr, 0x%p, ip = 0x%lx, flags = 0x%lx\n",
 		p->symbol_name, p->addr, regs->psw.addr, regs->flags);
 #endif
+#ifdef CONFIG_LOONGARCH
+	pr_info("<%s> p->addr = 0x%p, era = 0x%lx, estat = 0x%lx\n",
+		p->symbol_name, p->addr, regs->csr_era, regs->csr_estat);
+#endif
 
 	/* A dump_stack() here will give a stack backtrace */
 	return 0;
@@ -92,6 +96,10 @@ static void __kprobes handler_post(struct kprobe *p, struct pt_regs *regs,
 	pr_info("<%s> p->addr, 0x%p, flags = 0x%lx\n",
 		p->symbol_name, p->addr, regs->flags);
 #endif
+#ifdef CONFIG_LOONGARCH
+	pr_info("<%s> p->addr = 0x%p, estat = 0x%lx\n",
+		p->symbol_name, p->addr, regs->csr_estat);
+#endif
 }
 
 static int __init kprobe_init(void)
-- 
2.1.0


  parent reply	other threads:[~2022-12-09  8:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-09  8:52 [PATCH v10 0/4] Add kprobe and kretprobe support for LoongArch Tiezhu Yang
2022-12-09  8:52 ` [PATCH v10 1/4] LoongArch: Simulate branch and PC instructions Tiezhu Yang
2022-12-21  7:42   ` Jinyang He
2022-12-09  8:52 ` [PATCH v10 2/4] LoongArch: Add kprobe support Tiezhu Yang
2022-12-14  7:28   ` Masami Hiramatsu
2022-12-16  9:33     ` Tiezhu Yang
2022-12-17  2:08       ` Huacai Chen
2022-12-09  8:53 ` [PATCH v10 3/4] LoongArch: Add kretprobe support Tiezhu Yang
2022-12-09  8:53 ` Tiezhu Yang [this message]
2022-12-09 10:01 ` [PATCH v10 0/4] Add kprobe and kretprobe support for LoongArch Huacai Chen
2022-12-09 10:34   ` WANG Xuerui
2022-12-10 13:54   ` Jeff Xie
2022-12-13  3:10   ` Masami Hiramatsu
2022-12-17  2:28     ` Huacai Chen
2022-12-12  8:41 ` Hengqi Chen
2022-12-12  9:35   ` Qing Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1670575981-14389-5-git-send-email-yangtiezhu@loongson.cn \
    --to=yangtiezhu@loongson.cn \
    --cc=chenhuacai@kernel.org \
    --cc=kernel@xen0n.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=mhiramat@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.