From: Guo Ren Date: Tue, 5 Apr 2022 07:13:07 +0000 (+0800) Subject: riscv: compat: process: Add UXL_32 support in start_thread X-Git-Tag: v6.1-rc5~1204^2~9^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=69d0bf4cc668387f8b8bf89c2b77568c7bbe722e;p=platform%2Fkernel%2Flinux-starfive.git riscv: compat: process: Add UXL_32 support in start_thread If the current task is in COMPAT mode, set SR_UXL_32 in status for returning userspace. We need CONFIG _COMPAT to prevent compiling errors with rv32 defconfig. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Tested-by: Heiko Stuebner Link: https://lore.kernel.org/r/20220405071314.3225832-14-guoren@kernel.org Signed-off-by: Palmer Dabbelt --- diff --git a/arch/riscv/kernel/process.c b/arch/riscv/kernel/process.c index 504b496..b4421c1 100644 --- a/arch/riscv/kernel/process.c +++ b/arch/riscv/kernel/process.c @@ -98,6 +98,15 @@ void start_thread(struct pt_regs *regs, unsigned long pc, } regs->epc = pc; regs->sp = sp; + +#ifdef CONFIG_64BIT + regs->status &= ~SR_UXL; + + if (is_compat_task()) + regs->status |= SR_UXL_32; + else + regs->status |= SR_UXL_64; +#endif } void flush_thread(void)