[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240319215915.832127-5-samuel.holland@sifive.com>
Date: Tue, 19 Mar 2024 14:58:30 -0700
From: Samuel Holland <samuel.holland@...ive.com>
To: Palmer Dabbelt <palmer@...belt.com>,
linux-riscv@...ts.infradead.org
Cc: devicetree@...r.kernel.org,
Catalin Marinas <catalin.marinas@....com>,
linux-kernel@...r.kernel.org,
tech-j-ext@...ts.risc-v.org,
Conor Dooley <conor@...nel.org>,
kasan-dev@...glegroups.com,
Evgenii Stepanov <eugenis@...gle.com>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Rob Herring <robh+dt@...nel.org>,
Samuel Holland <samuel.holland@...ive.com>,
Albert Ou <aou@...s.berkeley.edu>,
Paul Walmsley <paul.walmsley@...ive.com>
Subject: [RFC PATCH 4/9] riscv: Define is_compat_thread()
This allows checking if some thread other than current is 32-bit.
Signed-off-by: Samuel Holland <samuel.holland@...ive.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
Powered by blists - more mailing lists