From patchwork Fri Nov 18 06:05:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tiezhu Yang X-Patchwork-Id: 22111 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp18310wrr; Thu, 17 Nov 2022 22:08:02 -0800 (PST) X-Google-Smtp-Source: AA0mqf5eyn5ctQ1n2lcJnCaF9Axzim5QVy/cswTmL7HaJhIGuFWafdNVpchV81xhotHdF7it9QeG X-Received: by 2002:a65:6447:0:b0:45a:f9e5:fcc1 with SMTP id s7-20020a656447000000b0045af9e5fcc1mr5447465pgv.616.1668751682260; Thu, 17 Nov 2022 22:08:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668751682; cv=none; d=google.com; s=arc-20160816; b=zOwgEWKJcVW/Nd7ekBZjpjWwTIPKsJGPGdE4tPwbFdP19nIjQaqQBGmsgAJlONftYa +bYKGZaz7cNHeDME2TGJ3SBKCiTCddubIV2DSeUJgUIpVvRhiMLzCHYbhnSndeVarKha I9wdIHC+1ib0rBgCXGM0nUvkCwVP8V1Z4Q5if+vbXjn5wyJOg5LVqRHb3DJbfAaScszV 9w0/ZcZ0IbNLTtXw4lXg7gWc1uM2M0JqlcIxM0Tjv11kgsrA4y/sTQQG41VwNQW/lupJ JTzg1sfh9ApuC8jdgUzKP0BSls40jApTbMnidV+Xv7EN/zkWFb6/MdAQ/N2leWDhvbGp EFew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=EVPchg/wTR4MT36MGjPfqIOAHKDOrrbi0SlWv6/H66g=; b=aYx59neVUbD/zx+KB0h1nDoqQS0QgfXO0dsnPsoj45nRPQkHtJtDYau+pWBEUbjkfy L+Vq4eJhY3cI9DVy0Z4UcPoIaG2uZl383GhOMRs2Nr+X6ROMcUe6rHt+E3RAZvNmOAOw rCH119YFIcx5TdSdU+rAdSZc85jG6mI0B2Qqq+Dk8TIIlRjVRXMAW5CZzbrVNhnJ2oDc lHjXJgIUz6jHLc8HRFdBZOM2kpiXy/5HS5X9bKnf20Zqmm2WtZGWS/fzSDGJgIJ5yOU4 9XY+os68Fzm6nfEi5n0LjNAv2nbjozstfr+5x1AQlsw/y7zbVzRL5F8Cmo6Mv2H7lF5j bA1w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z4-20020a63e544000000b0047730522d4esi593353pgj.95.2022.11.17.22.07.50; Thu, 17 Nov 2022 22:08:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241072AbiKRGFe (ORCPT + 99 others); Fri, 18 Nov 2022 01:05:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241039AbiKRGFZ (ORCPT ); Fri, 18 Nov 2022 01:05:25 -0500 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7AC3D9825A for ; Thu, 17 Nov 2022 22:05:24 -0800 (PST) Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8CxfbajIHdjtYcIAA--.12595S3; Fri, 18 Nov 2022 14:05:23 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Dx9VagIHdjT1sWAA--.40305S6; Fri, 18 Nov 2022 14:05:22 +0800 (CST) From: Tiezhu Yang To: Huacai Chen , WANG Xuerui , Masami Hiramatsu Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v4 4/4] samples/kprobes: Add LoongArch support Date: Fri, 18 Nov 2022 14:05:14 +0800 Message-Id: <1668751514-2998-5-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1668751514-2998-1-git-send-email-yangtiezhu@loongson.cn> References: <1668751514-2998-1-git-send-email-yangtiezhu@loongson.cn> X-CM-TRANSID: AQAAf8Dx9VagIHdjT1sWAA--.40305S6 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBjvJXoWrZw4rWrW5CF1fJw1xZFWDJwb_yoW8JF1fpF n0y3W5t3yFyw13WFW3Jayvgry0yryjkay8u3ykC34Yya429ry5AF1rKayjyw4kur90qF43 tr1FvryUGF1xZrJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU b28YFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_JrI_Jryl8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVW5JVW7JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwA2z4 x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v26r4UJVWxJr1l e2I262IYc4CY6c8Ij28IcVAaY2xG8wAqjxCEc2xF0cIa020Ex4CE44I27wAqx4xG64xvF2 IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jw0_WrylYx0Ex4A2jsIE14v26r4j6F4U McvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCF04k20xvY0x0EwIxGrwCFx2 IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v2 6r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67 AKxVW8JVW5JwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IY s7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r4j6F4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr 0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x07jOdb8UUUUU= X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749812963766123769?= X-GMAIL-MSGID: =?utf-8?q?1749812963766123769?= Add LoongArch specific info in handler_pre() and handler_post(). Signed-off-by: Tiezhu Yang --- 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)