diff options
author | 2024-01-08 20:57:04 +0100 | |
---|---|---|
committer | 2024-01-08 20:57:04 +0100 | |
commit | 6b93f350e55f3f2ee071dd41109d936abfba8ebf (patch) | |
tree | 481336b357ef1c1ac4a3a7517dd20294fe9b1c45 /scripts/gdb/linux/cpus.py | |
parent | HID: magicmouse: fix kerneldoc for struct magicmouse_sc (diff) | |
parent | HID: amd_sfh: Add a new interface for exporting ALS data (diff) | |
download | wireguard-linux-6b93f350e55f3f2ee071dd41109d936abfba8ebf.tar.xz wireguard-linux-6b93f350e55f3f2ee071dd41109d936abfba8ebf.zip |
Merge branch 'for-6.8/amd-sfh' into for-linus
- addition of new interfaces to export User presence information and
Ambient light from amd-sfh to other drivers within the kernel (Basavaraj
Natikar)
Diffstat (limited to 'scripts/gdb/linux/cpus.py')
-rw-r--r-- | scripts/gdb/linux/cpus.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/gdb/linux/cpus.py b/scripts/gdb/linux/cpus.py index 255dc18cb9da..cba589e5b57d 100644 --- a/scripts/gdb/linux/cpus.py +++ b/scripts/gdb/linux/cpus.py @@ -179,6 +179,21 @@ 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_tp = gdb.parse_and_eval("$tp") + scratch_reg = gdb.parse_and_eval("$sscratch") + + # by default tp points to current task + current_task = current_tp.cast(task_ptr_type) + + # scratch register is set 0 in trap handler after entering kernel. + # When hart is in user mode, scratch register is pointing to task_struct. + # and tp is used by user mode. So when scratch register holds larger value + # (negative address as ulong is larger value) than tp, then use scratch register. + if (scratch_reg.cast(utils.get_ulong_type()) > current_tp.cast(utils.get_ulong_type())): + current_task = scratch_reg.cast(task_ptr_type) + + return current_task.dereference() else: raise gdb.GdbError("Sorry, obtaining the current task is not yet " "supported with this arch") |