aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv/kernel
diff options
context:
space:
mode:
authorGravatar Leonardo Bras <leobras@redhat.com> 2024-01-03 13:00:22 -0300
committerGravatar Palmer Dabbelt <palmer@rivosinc.com> 2024-03-19 16:39:39 -0700
commit5917ea17ad07f35bb5be4fd5fdcd408f090e347b (patch)
tree34c9b64a528c454e6b5c8dd0e7edda5e6604b2c6 /arch/riscv/kernel
parentriscv: add compile-time test into is_compat_task() (diff)
downloadlinux-5917ea17ad07f35bb5be4fd5fdcd408f090e347b.tar.gz
linux-5917ea17ad07f35bb5be4fd5fdcd408f090e347b.tar.bz2
linux-5917ea17ad07f35bb5be4fd5fdcd408f090e347b.zip
riscv: Introduce is_compat_thread() into compat.h
task_user_regset_view() makes use of a function very similar to is_compat_task(), but pointing to a any thread. In arm64 asm/compat.h there is a function very similar to that: is_compat_thread(struct thread_info *thread) Copy this function to riscv asm/compat.h and make use of it into task_user_regset_view(). Also, introduce a compile-time test for CONFIG_COMPAT and simplify the function code by removing the #ifdef. Signed-off-by: Leonardo Bras <leobras@redhat.com> Reviewed-by: Guo Ren <guoren@kernel.org> Reviewed-by: Andy Chiu <andy.chiu@sifive.com> Link: https://lore.kernel.org/r/20240103160024.70305-6-leobras@redhat.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Diffstat (limited to 'arch/riscv/kernel')
-rw-r--r--arch/riscv/kernel/ptrace.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/riscv/kernel/ptrace.c b/arch/riscv/kernel/ptrace.c
index 2afe460de16a..f36283212361 100644
--- a/arch/riscv/kernel/ptrace.c
+++ b/arch/riscv/kernel/ptrace.c
@@ -374,14 +374,14 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
return ret;
}
+#else
+static const struct user_regset_view compat_riscv_user_native_view = {};
#endif /* CONFIG_COMPAT */
const struct user_regset_view *task_user_regset_view(struct task_struct *task)
{
-#ifdef CONFIG_COMPAT
- if (test_tsk_thread_flag(task, TIF_32BIT))
+ if (is_compat_thread(&task->thread_info))
return &compat_riscv_user_native_view;
else
-#endif
return &riscv_user_native_view;
}