Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp162337rwb; Mon, 28 Nov 2022 18:36:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf7wNYbo7MSeUtfY3DIQj7HLaDVoZOROokG/Xsxjd/zgxr+ImCRgfZKaFYDPhiErx6KvKWfc X-Received: by 2002:a17:907:d006:b0:7bc:ad2d:879d with SMTP id va6-20020a170907d00600b007bcad2d879dmr15735314ejc.603.1669689411417; Mon, 28 Nov 2022 18:36:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669689411; cv=none; d=google.com; s=arc-20160816; b=AWQs3GjbNzToNYixgr34Yqc2H5uO9NfNUrZ0BfrbLU5Lxylw6kviqqTrUFJyswHPed WfBxFun64WaVVwHSdNvw7/OYW5Jfe/lOrdusir5swmfoJl94tw2rh/j3zOGsrp1LLfrJ pdmjTeYvu6tCXn3Yhkvq+9BtT6bFGebpVXqwtVsTWji9QuEvKj7eXd73fmy+X0B964x4 vZMxhYtDk8WpOmgnJe7tuxoRjIzLZNCjNi0yl27oM7fIsSKIhWFtjTCS0VSvDYa13Uaq SnOXTZg5YzdX1oFyk/X+DEi+IuG7liE2XhJC02CLuHvlrRGpekIjn6h1KBZFIx2Av4re +b3Q== 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=fKQB9Ncj99JVtg+rHAv9NxZWiiX8+vuSw1ERklHavSx/+6cwe9u9TnFmaZMO12XZ/S lrf+OHmEbkuxtFSgaCfmVz1d6GsanAdxpUG8uTkqF/rt7JCqQdDJafx21v9eiaICDEZv uxryEhCgsy9B2Wziyigm1jDpjnqqxO8VX1zx6iA75ZXdrczoUu7d7p/haCHX3dvx+/Q0 AeJYgpUkEjOlCQLPbVgQBughfIcxNxn8r8Mzn4TwrNwp7UQM32FbM3TLckNtxEaF9udg 2Zr5pKUSV2dCxYv9H4oB3SDyU+S/+1BQ2HJH6i6QRMDpkQfw2QhSXqJ4c1r4gBH7hTX1 CG/g== 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 hq13-20020a1709073f0d00b007ad8218ad7fsi8683324ejc.379.2022.11.28.18.35.55; Mon, 28 Nov 2022 18:36:51 -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 S235181AbiK2CDb (ORCPT + 82 others); Mon, 28 Nov 2022 21:03:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235123AbiK2CDM (ORCPT ); Mon, 28 Nov 2022 21:03:12 -0500 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 524F0BE04 for ; Mon, 28 Nov 2022 18:03:09 -0800 (PST) Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8Bx3+tdaIVjSuIBAA--.4566S3; Tue, 29 Nov 2022 10:03:09 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8AxPuBUaIVjPdsdAA--.10463S6; Tue, 29 Nov 2022 10:03:07 +0800 (CST) From: Tiezhu Yang To: Huacai Chen , WANG Xuerui , Masami Hiramatsu Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v5 4/4] samples/kprobes: Add LoongArch support Date: Tue, 29 Nov 2022 10:02:54 +0800 Message-Id: <1669687374-16432-5-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1669687374-16432-1-git-send-email-yangtiezhu@loongson.cn> References: <1669687374-16432-1-git-send-email-yangtiezhu@loongson.cn> X-CM-TRANSID: AQAAf8AxPuBUaIVjPdsdAA--.10463S6 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBjvJXoWrZw4rWrW5CF1fJw1xZFWDJwb_yoW8JF1fpF n0y3W5t3yFyw13WFW3Jayvgry0yryjkay8u3ykC34Yya429ry5AF1rKayjyw4kur90qF43 tr1FvryUGF1xZrJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU b2xYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_JrI_Jryl8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVW7JVWDJwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVWxJVW8Jr1l84 ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AKxVW8Jr0_Cr1U M2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx1l5I8CrVACY4 xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1q6rW5McIj6I8E87Iv67AKxVW8JVWx JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2Ij64vIr41l4I 8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AK xVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcV AFwI0_Gr0_Xr1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8I cIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVW8JVWxJwCI42IY6I8E87Iv6xkF7I0E14v26r 4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxUcHUqUUUUU 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