[RFC PATCH 4/9] riscv: Define is_compat_thread()
Samuel Holland
samuel.holland at sifive.com
Tue Mar 19 14:58:30 PDT 2024
This allows checking if some thread other than current is 32-bit.
Signed-off-by: Samuel Holland <samuel.holland at sifive.com>
---
arch/riscv/include/asm/compat.h | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/arch/riscv/include/asm/compat.h b/arch/riscv/include/asm/compat.h
index 2ac955b51148..233c439c12d7 100644
--- a/arch/riscv/include/asm/compat.h
+++ b/arch/riscv/include/asm/compat.h
@@ -12,11 +12,18 @@
#include <linux/sched/task_stack.h>
#include <asm-generic/compat.h>
+#ifdef CONFIG_COMPAT
+
static inline int is_compat_task(void)
{
return test_thread_flag(TIF_32BIT);
}
+static inline int is_compat_thread(struct thread_info *thread)
+{
+ return test_ti_thread_flag(thread, TIF_32BIT);
+}
+
struct compat_user_regs_struct {
compat_ulong_t pc;
compat_ulong_t ra;
@@ -126,4 +133,13 @@ static inline void cregs_to_regs(struct compat_user_regs_struct *cregs,
regs->t6 = (unsigned long) cregs->t6;
};
+#else
+
+static inline int is_compat_thread(struct thread_info *thread)
+{
+ return 0;
+}
+
+#endif
+
#endif /* __ASM_COMPAT_H */
--
2.43.1
More information about the linux-riscv
mailing list