riscv: compat: Add UXL_32 support in start_thread
Subsystems (4)
[email protected]
maintainerPATCH v3 15/17 riscv: compat: Add UXL_32 support in start_thread
From: Guo Ren <[email protected]>
If the current task is in COMPAT mode, set SR_UXL_32 in status for returning userspace.
--- arch/riscv/kernel/process.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/riscv/kernel/process.c +5 -0
@@ -97,6 +97,11 @@ void start_thread(struct pt_regs *regs, unsigned long pc, } regs->epc = pc; regs->sp = sp; + +#ifdef CONFIG_COMPAT +if (is_compat_task ()) + regs->status |=SR_UXL_32 ; +#endif }void flush_thread (void )
Signature · 1 line
2.25.1
arch/riscv/kernel/process.c void start_thread(struct pt_regs *regs, unsigned long pc, · line 104
Quoted 5 lines · On Thu, Jan 20, 2022 at 8:39 AM <[email protected]> wrote:
arch/riscv/kernel/process.c +5
-0+ +#ifdef CONFIG_COMPAT +if (is_compat_task ()) + regs->status |=SR_UXL_32 ; +#endif
You should not need that #ifdef, as the is_compat_task() definition is meant to drop the code at compile time, unless the SR_UXL_32 definition is not visible here.
Arnd
Guo Ren
maintainerQuoted 12 lines · Arnd Bergmann
arch/riscv/kernel/process.c void start_thread(struct pt_regs *regs, unsigned long pc, · line 104
Quoted 5 lines · On Thu, Jan 20, 2022 at 8:39 AM <[email protected]> wrote:
arch/riscv/kernel/process.c +5
-0+ +#ifdef CONFIG_COMPAT +if (is_compat_task ()) + regs->status |=SR_UXL_32 ; +#endif You should not need that #ifdef, as the
is_compat_task()definition is meant to drop the code at compile time, unless theSR_UXL_32definition is not visible here.
I almost put CONFIG_COMPAT in every compat related code, because I hope the next arch that wants to support COMPAT could easily find where to be modified.
Quoted 2 lines
Arnd
Signature · 4 lines
Best Regards Guo Ren ML: https://lore.kernel.org/linux-csky/