Message ID | 20220120073911.99857-16-guoren@kernel.org |
---|---|
State | New |
Headers | show |
Series | riscv: compat: Add COMPAT mode support for rv64 | expand |
On Thu, Jan 20, 2022 at 8:39 AM <guoren@kernel.org> wrote: > + > +#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
On Thu, Jan 20, 2022 at 9:39 PM Arnd Bergmann <arnd@arndb.de> wrote: > > On Thu, Jan 20, 2022 at 8:39 AM <guoren@kernel.org> wrote: > > + > > +#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. 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. > > Arnd
diff --git a/arch/riscv/kernel/process.c b/arch/riscv/kernel/process.c index 03ac3aa611f5..1a666ad299b4 100644 --- a/arch/riscv/kernel/process.c +++ b/arch/riscv/kernel/process.c @@ -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)