Message ID | 20230222092806.1824615-1-suagrfillet@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp479120wrd; Wed, 22 Feb 2023 01:47:29 -0800 (PST) X-Google-Smtp-Source: AK7set90mPfk3Qg9x1keTNGqES0738hUuIJpK8EeRYuVbBuJj1lAV4lFRlVfYb3C7/O3XKa55HkN X-Received: by 2002:aa7:cf87:0:b0:4ab:cb8c:932b with SMTP id z7-20020aa7cf87000000b004abcb8c932bmr6840638edx.40.1677059249618; Wed, 22 Feb 2023 01:47:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677059249; cv=none; d=google.com; s=arc-20160816; b=iG2B+0RBDTzmqxR6ew/z+4vDIAkKxNwf33vrvFjNcAyvAIRm99ovWl4t8GNr4wAMiq Ox8JsCWVpbV1L3RKOw+hi04FHOOMGPVex9fjv+xODpW1Sfoyw4C1J4gn47N6IBJbR5f2 uUx8tTAqli1ouce464Q8ij2VtzTFn8l/+Z4Rh+pvfplxet8GOZfp3w5idCuQKzzhsUrG d4VXdDRmip4nTowpkhn0rXy7lC9bsn/+3fdfYg9kbjJu5m55mSB/nrwrsa/ZZ0RCf2xQ GFcfU2XUEuZ4XMxlHtUALqJ2po2a+UCFH9uN7HggWfXT0fMYS8LF/ids14vV3WLxfFOj cDlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=iFgk/M229EQhqqhZZFLKtBybO/8gTLURLdA1DMiN/Z4=; b=I9OGy7mqyIcln6XOFHRzQYDHJmx53tarwuOxy6cqRS7Rl5y19KzSnlJ/9hzYIvFt1I MGdGo1tC23YWfJfrKgWbc4f+nxvlQNDfSj5FvpAeoo5ZUw1/m3HSesGNZ+aWQABaZ9Z3 GqpWuSCd05oKkgyMUWXicvtGTmp/UH0aUjEWIhpvrMYDdFJ/TIaK8Pds9iuOHS/uOOzX jupolJNLS0P2W1UNUwPMmKjZhJQx4l6rzWpT03YYe0VcEuLBFnDFe6WP9OrUv5TaR+3n jr9dkvKXNTylyzNd5bWDAcM7yV0365IYwNn0ezCECVW2I8qyi9ueNKGNI05F1cZ9HlC4 vcsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=SKL0epEo; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k16-20020aa7c390000000b004acd1369560si4368905edq.549.2023.02.22.01.47.06; Wed, 22 Feb 2023 01:47:29 -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=@gmail.com header.s=20210112 header.b=SKL0epEo; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231909AbjBVJdI (ORCPT <rfc822;dengxinlin2429@gmail.com> + 99 others); Wed, 22 Feb 2023 04:33:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229930AbjBVJcl (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 22 Feb 2023 04:32:41 -0500 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3F783A08A for <linux-kernel@vger.kernel.org>; Wed, 22 Feb 2023 01:30:57 -0800 (PST) Received: by mail-pl1-x62f.google.com with SMTP id e9so3056010plh.2 for <linux-kernel@vger.kernel.org>; Wed, 22 Feb 2023 01:30:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=iFgk/M229EQhqqhZZFLKtBybO/8gTLURLdA1DMiN/Z4=; b=SKL0epEoRnNDpRxCuPp05LozjCazXtjQDMYJEDXu4wLP3uxCrXoGFjIqisjU22SYe7 Q37rNJX/dP0bMhglb10pCszg4dDzqlYGcdIiLlG1fa0mZ1EAnB7OEaDRI8zl6KzvnEI5 U1c/h9SoWEaePzNd+2p7taVz7VyDo1gKTPH1DPX/LDr+jgIuHzfJphu8lOY1jONMpene YCwtC6LqlerjDStuvGfY2jE3oAeimNKGl0YNNVRUJhPYNkwOPyV9ivfF10aDqbH87LAB mPC8tnsSbWHrDP7wC4FZLFgbti5gKetmFHuAKl7iNbAIvF0tYsm9tTvjghwdusHcPMnp NxBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=iFgk/M229EQhqqhZZFLKtBybO/8gTLURLdA1DMiN/Z4=; b=a0neoPGd/sOOfxm7WkNjnTbpKsHnt98BJmLMFODPNnLenfhcX6EBDT4YUmfAUAYo74 uudZR3kowac7cTSuDL0U7czMwu9Do9uflY8Eb3UxdUOfBMXw/urFQpQyph9cNqlfwyqp rjl7R32yHgjzR7d6Pb1nJJwP/2seI0UOtK/S0YeR/76tvPVw/zp1dk7g864LcwJCBiTQ +/8jOIRaCIWskSugi8YOwaQdNyi89dLytar1hiX+/uSc2MdUTOy6LaZMPtNnWzj9+mRl CqPePb6x8bpOC06d9YkAE+aUnx2o2xMJ13Sp/q4mvqciHhwgL9eyPcAeqcuWfxuYKvPE iHFQ== X-Gm-Message-State: AO0yUKUUJPIFpiqocCS982+jve0d27oAM0sAomhV3gZ7kei82TXZoekt lyCw+niYoK4ai4wY5UPjGReEOhYlLCc= X-Received: by 2002:a17:902:cf4d:b0:19a:b302:5156 with SMTP id e13-20020a170902cf4d00b0019ab3025156mr5761702plg.24.1677058158472; Wed, 22 Feb 2023 01:29:18 -0800 (PST) Received: from localhost.localdomain ([221.226.144.218]) by smtp.gmail.com with ESMTPSA id c4-20020a170902c1c400b0019a88c1cf63sm2735670plc.180.2023.02.22.01.29.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Feb 2023 01:29:18 -0800 (PST) From: Song Shuai <suagrfillet@gmail.com> To: jan.kiszka@siemens.com, kbingham@kernel.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Song Shuai <suagrfillet@gmail.com> Subject: [PATCH] scripts/gdb: add lx_current support for riscv Date: Wed, 22 Feb 2023 17:28:06 +0800 Message-Id: <20230222092806.1824615-1-suagrfillet@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758524079293415358?= X-GMAIL-MSGID: =?utf-8?q?1758524079293415358?= |
Series |
scripts/gdb: add lx_current support for riscv
|
|
Commit Message
Song Shuai
Feb. 22, 2023, 9:28 a.m. UTC
RISC-V uses the tp register to save the current task_struct address
as its current() defines. So lx_current() of riscv just returns the
dereference of the address cast via task_ptr_type.
Signed-off-by: Song Shuai <suagrfillet@gmail.com>
---
scripts/gdb/linux/cpus.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/scripts/gdb/linux/cpus.py b/scripts/gdb/linux/cpus.py index 15fc4626d236..b382016552e5 100644 --- a/scripts/gdb/linux/cpus.py +++ b/scripts/gdb/linux/cpus.py @@ -173,6 +173,9 @@ 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") + return current_task_addr.cast(task_ptr_type).dereference(); else: raise gdb.GdbError("Sorry, obtaining the current task is not yet " "supported with this arch")