Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1090615rwb; Thu, 8 Dec 2022 06:41:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf79hGw2UPfEIT9gSOfw5KxOdqj5+3JgA0Xam6AL0tJS28kjfS4d04SFHV/YnBUUmS7UyylS X-Received: by 2002:a17:906:b142:b0:7c1:b65:8d0f with SMTP id bt2-20020a170906b14200b007c10b658d0fmr8505525ejb.445.1670510497765; Thu, 08 Dec 2022 06:41:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670510497; cv=none; d=google.com; s=arc-20160816; b=g+v6ObFgdEs1RR/zolEjVoX68dyXhnOSeUaTYGhfUTuMFWBE6F6FnM56atKQTYR6Pn 0TYmv1BhPOkyu1TEQgig+hT33gOkx3gIBTgET6Yo0b/DvQ4Yxih3XzuxbOYgn/iqCT8B msbWH1g67d2p8NkthoGNmZIOUwoe1VznAJCr68TptjBjhtWCAQxjXJfIPmRD6OKj6h7+ EpO3/USLRpnf6JW0A2wWGZBH7YGXJTrUv/uwSBn4EkY9J4+AaIOE//u95kbTR0YC7ExX Gga3BJ2SZ3EKWBMKZZt5NLdjm3A2MJ3oCmnGZi8WY3slSO6xcSwW322QpPQlYYL51LH/ RMdQ== 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=RJAbKZcGlVyl7e8zWg4NWM0qOUJcpYg8aOnJIBO8V0PJM62RDlFRE25fnK94WIkRSk sIGALyHhEKB+YAEU+gWzUemqvE3rNGxSAgeHoRwxapkaFSh4P/L3/xfGMQ4unef6TrJ/ nKmRHMEMUpth0sW350fpOI0xGrqDe6tBPio+BZW/Ar2RxgmVGHc7rgg9JaDjEm3cAgD2 k1K/BwEiD+NXR/XFKeDiz+LAEzLpkGI9k0Yi5gsrUACfWVRfswTEts/qNFoJU4PYjO3V NnWweNiBquMrnWhw0SAffFSWIwcPkPB3dFE6e8yy88PfE07qtVWuDkLWakN9U63cZBw7 tTlg== 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 qo14-20020a170907874e00b007b790c183e0si16088828ejc.290.2022.12.08.06.41.19; Thu, 08 Dec 2022 06:41:37 -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 S229894AbiLHNla (ORCPT + 72 others); Thu, 8 Dec 2022 08:41:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229849AbiLHNlP (ORCPT ); Thu, 8 Dec 2022 08:41:15 -0500 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1848463BB5 for ; Thu, 8 Dec 2022 05:41:13 -0800 (PST) Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8Axy+p56ZFjJR8EAA--.9578S3; Thu, 08 Dec 2022 21:41:13 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxTuB06ZFj8BwoAA--.33104S6; Thu, 08 Dec 2022 21:41:12 +0800 (CST) From: Tiezhu Yang To: Huacai Chen , WANG Xuerui , Masami Hiramatsu Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v9 4/4] samples/kprobes: Add LoongArch support Date: Thu, 8 Dec 2022 21:41:08 +0800 Message-Id: <1670506868-15771-5-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1670506868-15771-1-git-send-email-yangtiezhu@loongson.cn> References: <1670506868-15771-1-git-send-email-yangtiezhu@loongson.cn> X-CM-TRANSID: AQAAf8BxTuB06ZFj8BwoAA--.33104S6 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBjvJXoWrZw4rWrW5CF1fJw1xZFWDJwb_yoW8JF1fpF n0y3W5t3yFyw13WFW3Jayvgry0yryjkay8u3ykC34Yya429ry5AF1rKayjyw4kur90qF43 tr1FvryUGF1xZrJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU b7kYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_Jrv_JF1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVW5JVW7JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwA2z4 x0Y4vEx4A2jsIE14v26F4UJVW0owA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Cr1j6rxdM2AI xVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx1l5I8CrVACY4xI64 kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1q6rW5McIj6I8E87Iv67AKxVW8JVWxJwAm 72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2Ij64vIr41l4I8I3I 0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWU GVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI 0_Gr0_Xr1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0 rVWUJVWUCwCI42IY6I8E87Iv67AKxVW8JVWxJwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r 4UJbIYCTnIWIevJa73UjIFyTuYvjxUcCD7UUUUU 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 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