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 [thread overview] Message-ID: <20230222092806.1824615-1-suagrfillet@gmail.com> (raw) 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") -- 2.20.1
WARNING: multiple messages have this Message-ID (diff)
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 [thread overview] Message-ID: <20230222092806.1824615-1-suagrfillet@gmail.com> (raw) 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") -- 2.20.1 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
next reply other threads:[~2023-02-22 9:33 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-02-22 9:28 Song Shuai [this message] 2023-02-22 9:28 ` [PATCH] scripts/gdb: add lx_current support for riscv Song Shuai
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230222092806.1824615-1-suagrfillet@gmail.com \ --to=suagrfillet@gmail.com \ --cc=aou@eecs.berkeley.edu \ --cc=jan.kiszka@siemens.com \ --cc=kbingham@kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-riscv@lists.infradead.org \ --cc=palmer@dabbelt.com \ --cc=paul.walmsley@sifive.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.