Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3383415rwb; Mon, 19 Sep 2022 21:15:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7f/dpELgygC8WGc62wwXNR0ECQHJMhCkn/99E+6A+6Z/bWUrARdXeY+quZ8uBEmRKaXb0Y X-Received: by 2002:a17:907:94d4:b0:77f:d0c9:573f with SMTP id dn20-20020a17090794d400b0077fd0c9573fmr15073401ejc.98.1663647355465; Mon, 19 Sep 2022 21:15:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663647355; cv=none; d=google.com; s=arc-20160816; b=vFvzltRclWUYfux9AC1vXAXOVq89TsWywM8DWRcIGfLGxTWxciFv3WokiVycpkDUBm 7HbzrownNiOTVZP6vAzMa3z8vYiexrWLE5euBKloZjhlkQWoEd17oBh436m9pvqVou/Q KjMSJ2wNWcRamAVn1gg6Xy8DLOfAPDQ1ccEkrzsuRr4bJ0cC85gh7xy5YuDivxu2/a+U 2kTwvFwNPmPn7ZRjOCl6EMo2CpEKlvotOGeca4oYNfLo/FOqFXyaBXU5XUwyU/xkRiDH TkL71cFUU452VsqFJk+FFqZAvBguIy3BkZXMqTJ/0U/WqFha+01qP2WiJFzBwS7OIoni oJrw== 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=guIiTYlV40UvQ9xHH9xBSdLiEtB3izxnT227fEOxgcwbkZj3HAlrtRxuDmUKbY6rmz dmgjE2bV2PK0WCW1iexDF31trNfpH3mNRVvG72VZwRBOv/dYo1BkKNcuMENhY2FFvJ25 d4/qzbQt3RRh1fvEdNZNVT2vVVZXdBZhHym7eQggAaGdI1VHQlLZ2GWs8U67mlOhQWff CGFRB7n6yCdnZdgz+valwJwbsAls8WkguE6m/aM9NsTFerJFHSDCzXhmRD2dJrRyc7xW 4cD+QJz/ugSIh8gU0y7dv0aPD21/NmfZ/JQp9lM8+9NTcqUHzQDudqhYv/a6AVuNRHpL l1WQ== 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 ka26-20020a170907991a00b00780805b99ccsi195084ejc.648.2022.09.19.21.15.30; Mon, 19 Sep 2022 21:15:55 -0700 (PDT) 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 S229985AbiITDhh (ORCPT + 99 others); Mon, 19 Sep 2022 23:37:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229816AbiITDhT (ORCPT ); Mon, 19 Sep 2022 23:37:19 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 408255A14C for ; Mon, 19 Sep 2022 20:37:17 -0700 (PDT) Received: from linux.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxReJqNSlj7FseAA--.48978S5; Tue, 20 Sep 2022 11:37:16 +0800 (CST) From: Tiezhu Yang To: Huacai Chen , Masami Hiramatsu Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] samples/kprobes: Add LoongArch support Date: Tue, 20 Sep 2022 11:37:13 +0800 Message-Id: <1663645034-967-4-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1663645034-967-1-git-send-email-yangtiezhu@loongson.cn> References: <1663645034-967-1-git-send-email-yangtiezhu@loongson.cn> X-CM-TRANSID: AQAAf8DxReJqNSlj7FseAA--.48978S5 X-Coremail-Antispam: 1UD129KBjvJXoWrZw4rWrW5CF1fJw1xZFWDJwb_yoW8JF1fpF n0y3W5t3yFyw13WFW3Jayvgry0yryjkay8u3ykC34Yya429ry5AF1rKayjyw4kur90qF43 tr1FvryUGF1xZrJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUB2b7Iv0xC_Cr1lb4IE77IF4wAFF20E14v26ryj6rWUM7CY07I2 0VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI 8067AKxVWUWwA2048vs2IY020Ec7CjxVAFwI0_Gr0_Xr1l8cAvFVAK0II2c7xJM28CjxkF 64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVW5JVW7JwA2z4x0Y4vE2Ix0cI8IcV CY1x0267AKxVWxJVW8Jr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280 aVCY1x0267AKxVWxJr0_GcWle2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4 CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_JrI_JrylYx0Ex4A2jsIE14v26r1j6r4UMcvj eVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCY02Avz4vE14v_Gr4l42xK82IYc2 Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s02 6x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0x vE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE 42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6x kF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxUI5fHUUUUU X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ 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