Skip to content

Commit 69d0bf4

Browse files
guoren83palmer-dabbelt
authored andcommitted
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 <guoren@linux.alibaba.com> Signed-off-by: Guo Ren <guoren@kernel.org> Tested-by: Heiko Stuebner <heiko@sntech.de> Link: https://lore.kernel.org/r/20220405071314.3225832-14-guoren@kernel.org Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1 parent dfb0bfa commit 69d0bf4

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

arch/riscv/kernel/process.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,15 @@ void start_thread(struct pt_regs *regs, unsigned long pc,
9898
}
9999
regs->epc = pc;
100100
regs->sp = sp;
101+
102+
#ifdef CONFIG_64BIT
103+
regs->status &= ~SR_UXL;
104+
105+
if (is_compat_task())
106+
regs->status |= SR_UXL_32;
107+
else
108+
regs->status |= SR_UXL_64;
109+
#endif
101110
}
102111

103112
void flush_thread(void)

0 commit comments

Comments
 (0)