Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp611820rwb; Thu, 8 Dec 2022 00:09:49 -0800 (PST) X-Google-Smtp-Source: AA0mqf6iMSjw4RAxmHGW9P6NtqzLT6hV6zq1xbhPYo3vRm8yR2WXG1XhyfBGyC0M4hbF5/ddQ6FF X-Received: by 2002:a17:906:a148:b0:7ad:b286:8ee2 with SMTP id bu8-20020a170906a14800b007adb2868ee2mr35239689ejb.511.1670486988885; Thu, 08 Dec 2022 00:09:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670486988; cv=none; d=google.com; s=arc-20160816; b=JGytpy50dKYjZxOKCXfv6kCtwuiZetTPfeg4s53+CxSVTt/Gz1bJpgh+3/TDGlyxQY /s0aw4SoTh0/yAUHHe5PbSei6m1dMJq9Qu8MELSkGkF5vdu/hIeRhdfhZfqBLbeMVeTe VlXcsqR6KG6Ikcye7+vpe1A/OezB8bLk2ry8Sce489ogVrsZ5LzmTvXge7iZvSSsplAr ewIvKMZUdH5FYo3cPV1Snxv4vd7kVYqvNcVhMj3FrRlrcVLvyRD4J9oqzoLzrOrBxQ5p Vmd48Soxz1fUIIzaXFz6LLIL22C4ZBxUHmgEk98jA9w5jERhf9L+TkvnZL1DEkb1COjL s4Xg== 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=GGnUKIr0eXUGPSbqhFy6l3c/1As8+QzSSu1dmQe5K0TtkdU+P4E3ia8c9/UHEouDMl PSG1FOSwXN/+jGWTfHIwy4NISFwbxc2NG53eQM27tUMQ6xj1I6djSPCAG1+RE7RCumZ2 stY6a67Lr8s3X87eFV8DSOmgybyjEBo8FSEEV4s++z/fMOPonSKrWh61ZSdee1a8KdGk 9M6r97B60Vbu/Vev3DLF9dp6Imb92uOYydUmblwzcfeawVyScJbSyMANmw/kf/Ogs5a0 RS/zX+0+pGlw0CNQza/GjIC9fs2rC/25ZXgLz49u4oGbJBeQRW3RkGhZIBbyFA5Kg+QK tCbw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ho9-20020a1709070e8900b007c106ff40ddsi7158885ejc.631.2022.12.08.00.09.29; Thu, 08 Dec 2022 00:09:48 -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 S229755AbiLHHli (ORCPT + 73 others); Thu, 8 Dec 2022 02:41:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229737AbiLHHl3 (ORCPT ); Thu, 8 Dec 2022 02:41:29 -0500 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EABF94730A for ; Wed, 7 Dec 2022 23:41:27 -0800 (PST) Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8Dx9vAnlZFjng0EAA--.9363S3; Thu, 08 Dec 2022 15:41:27 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8AxPuAjlZFjn8gnAA--.32821S6; Thu, 08 Dec 2022 15:41:26 +0800 (CST) From: Tiezhu Yang To: Huacai Chen , WANG Xuerui , Masami Hiramatsu Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v8 4/4] samples/kprobes: Add LoongArch support Date: Thu, 8 Dec 2022 15:41:13 +0800 Message-Id: <1670485273-15717-5-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1670485273-15717-1-git-send-email-yangtiezhu@loongson.cn> References: <1670485273-15717-1-git-send-email-yangtiezhu@loongson.cn> X-CM-TRANSID: AQAAf8AxPuAjlZFjn8gnAA--.32821S6 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBjvJXoWrZw4rWrW5CF1fJw1xZFWDJwb_yoW8JF1fpF n0y3W5t3yFyw13WFW3Jayvgry0yryjkay8u3ykC34Yya429ry5AF1rKayjyw4kur90qF43 tr1FvryUGF1xZrJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU b28YFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVW5JVW7JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwA2z4 x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v26r4UJVWxJr1l e2I262IYc4CY6c8Ij28IcVAaY2xG8wAqjxCEc2xF0cIa020Ex4CE44I27wAqx4xG64xvF2 IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jw0_WrylYx0Ex4A2jsIE14v26r4j6F4U McvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCF04k20xvY0x0EwIxGrwCFx2 IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v2 6r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67 AKxVW8JVW5JwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IY s7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r4j6F4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr 0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x07j8CztUUUUU= X-Spam-Status: No, score=1.4 required=5.0 tests=BAYES_00,RCVD_IN_SBL_CSS, SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * 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 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) -- 2.1.0