Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3940812rwb; Sat, 12 Nov 2022 17:10:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf4UlAOLu+NUglJHj2IQH0WgoJfDfBzOa5PIgFB3K6w3geSOZcNvwAUIWjX0W5/PwfeaDDGV X-Received: by 2002:a17:906:280c:b0:7ad:88f8:761f with SMTP id r12-20020a170906280c00b007ad88f8761fmr6083583ejc.417.1668301841888; Sat, 12 Nov 2022 17:10:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668301841; cv=none; d=google.com; s=arc-20160816; b=s6F3+2FYbYiQtV5tMEDud6IBTDeSjpK0xvNBcultbxlz+cDDLcfQ8xB7u9D9YcQl9m tpwM513tz54tmZtdnsWXCP3hMAapIwHLjJan3PFSCl5aJal4k1u/zKHrbvqWYeojNeXY 6q+2izy1zirm2OgTzIIv4q+6xh6vDswkQPJzsjrBRR/BEUyh6+bMmq8eJ7Rcu6cDe4zA uWJm9vCIjaPlrMzNYi3uQPGMlzghUXHh/Pwo/iRvt/RVWjXokDq2334bix4oPtTeTFdX 967xmiiXlYl2wXhlhrkhRDO4iNVnSCCZGah+BkUFBxh3VdI1k0EzdzQQdCsULIJJrAF+ LVWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=DB8Kd51LwvvYqbLS0A49NHihyIk3vCQCu49GwMkB9Tg=; b=tAuPy6La9ZPFuToPRrV9dWORLbhijIuVomPT5refios5am4hbt2msrzjGiClqvfl1p GSK4qmM2qFrZV3oylbTdO06+UvV+qABLogxY75/Qq5E9JNY7RrOcgfS/Lg31UBYYc5mc SVBnURn0IDALerLCcGdSD2+6NhvnnYKh8Y0L/fsfgaxsMc+uAWlru3rjCnJN/aN8ei5z HAVTxwsp+vh/wdOAgwK9iKzGiMgiJXZvgvrL3DjbShq3cCcO3+Lb5OM6C00UzRMn2k/N 6uCnoA+pi8DcbYITPXQMWuyBnKeXV3ZUx59VesusI8WDoy5yXRmfvZ5U24myBfM3Wnrn zejg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZvkR3HZt; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i14-20020a05640242ce00b00467ad3f4426si1151420edc.312.2022.11.12.17.10.04; Sat, 12 Nov 2022 17:10:41 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZvkR3HZt; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234317AbiKMANv (ORCPT + 91 others); Sat, 12 Nov 2022 19:13:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229584AbiKMANt (ORCPT ); Sat, 12 Nov 2022 19:13:49 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14F3A63A9 for ; Sat, 12 Nov 2022 16:13:48 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A3AA0B80B8F for ; Sun, 13 Nov 2022 00:13:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BD44C433D6; Sun, 13 Nov 2022 00:13:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668298425; bh=AYKKSk+NIzy1pXYiJWh3WgsPRSax5Zh0r58tPDd7JT4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZvkR3HZthwx5ePtGifqfxyEv01o6VqM6J4nlSVLn9hR2iQB7LNIXAMldT28UJNyPJ +ZMurj53ypsyPph0FjgnVaFEtk9verpMLJ7PesL5ZeUN4Ae71QKIo5nKN9y64qyl53 W6tGwTYYecE4+mqEpoLFp0ld/UXA7Io7nvy48fVAn6vA4j2EitBMg8O2qnw4oepoDg qp8THvwtisVsDKjdqkmortY/JbWMRgthsBdAtf9SSSsZ8ln5gWVzGAURVQxcsm5OmC eJJtRMwnvdPYwqeIf9+stzEmG/phD3uKwEA4Rw4QELpGvD0pFqhvIWakW+AusBmZmR IvDB7YanULmxg== Date: Sun, 13 Nov 2022 00:13:40 +0000 From: Conor Dooley To: debug@rivosinc.com Cc: palmer@dabbelt.com, jan.kiszka@siemens.com, kbingham@kernel.org, paul.walmsley@sifive.com, aou@eecs.berkeley.edu, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux@rivosinc.com Subject: Re: [PATCH] gdb-script: updated lx_current for riscv Message-ID: References: <20221111195938.1499148-1-debug@rivosinc.com> <20221111195938.1499148-2-debug@rivosinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221111195938.1499148-2-debug@rivosinc.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,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 On Fri, Nov 11, 2022 at 11:59:38AM -0800, debug@rivosinc.com wrote: > From: Deepak Gupta > > lx_current python gdb command defined in scripts/gdb/cpus.py updated > to support riscv architecture. The commit which added support for arm64 gave an explanation of why SP_EL0 needed to be checked. Would be nice if you could do the same here for RISC-V. See 526940e39626 ("scripts/gdb: add lx_current support for arm64") for what I mean. While you're at it, "scripts/gdb: add support for RISC-V" would appear to be a more standard $subject for this file. Thanks, Conor. > > Signed-off-by: Deepak Gupta > --- > scripts/gdb/linux/cpus.py | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/scripts/gdb/linux/cpus.py b/scripts/gdb/linux/cpus.py > index 15fc4626d236..ce6703f1e35a 100644 > --- a/scripts/gdb/linux/cpus.py > +++ b/scripts/gdb/linux/cpus.py > @@ -173,6 +173,14 @@ def get_current_task(cpu): > else: > raise gdb.GdbError("Sorry, obtaining the current task is not allowed " > "while running in userspace(EL0)") > + elif utils.is_target_arch("riscv"): > + current_task_addr = gdb.parse_and_eval("$tp") > + if((current_task_addr.cast(utils.get_long_type()) >> 63) != 0): > + current_task = current_task_addr.cast(task_ptr_type) > + return current_task.dereference() > + else: > + raise gdb.GdbError("Sorry, obtaining the current task is not allowed " > + "while running in userspace") > else: > raise gdb.GdbError("Sorry, obtaining the current task is not yet " > "supported with this arch") > -- > 2.25.1 >