[PATCH v2 3/4] loongarch: entry: Migrate ret_from_fork() to C
Charlie Jenkins
charlie at rivosinc.com
Fri Jan 24 14:23:42 PST 2025
On Fri, Jan 24, 2025 at 10:28:50AM -0800, Charlie Jenkins wrote:
> On Fri, Jan 24, 2025 at 05:05:21PM +0800, Huacai Chen wrote:
> > Hi, Charlie,
> >
> > On Fri, Jan 24, 2025 at 3:15 AM Charlie Jenkins <charlie at rivosinc.com> wrote:
> > >
> > > Loongarch is the only architecture that calls
> > We usually use "LoongArch" instead of "loongarch" or "Loongarch".
> >
> > > syscall_exit_to_user_mode() from asm. Move the call into C so that this
> > > function can be inlined across all architectures.
> > >
> > > Signed-off-by: Charlie Jenkins <charlie at rivosinc.com>
> > > ---
> > > arch/loongarch/include/asm/asm-prototypes.h | 5 +++++
> > > arch/loongarch/include/asm/switch_to.h | 8 +++++++
> > > arch/loongarch/kernel/entry.S | 22 +++++++++----------
> > > arch/loongarch/kernel/process.c | 34 ++++++++++++++++++++++++-----
> > > 4 files changed, 51 insertions(+), 18 deletions(-)
> > >
> > > diff --git a/arch/loongarch/include/asm/asm-prototypes.h b/arch/loongarch/include/asm/asm-prototypes.h
> > > index 51f224bcfc654228ae423e9a066b25b35102a5b9..0195d4309fd29f94664d5f34247198c769033b1b 100644
> > > --- a/arch/loongarch/include/asm/asm-prototypes.h
> > > +++ b/arch/loongarch/include/asm/asm-prototypes.h
> > > @@ -12,3 +12,8 @@ __int128_t __ashlti3(__int128_t a, int b);
> > > __int128_t __ashrti3(__int128_t a, int b);
> > > __int128_t __lshrti3(__int128_t a, int b);
> > > #endif
> > > +
> > > +asmlinkage void noinstr __no_stack_protector ret_from_kernel_thread(struct task_struct *prev,
> > > + struct pt_regs *regs,
> > > + int (*fn)(void *),
> > > + void *fn_arg);
> > It is a little strange that we only need to declare
> > ret_from_kernel_thread() but not ret_from_fork().
>
> Just an oversight by me, thank you for pointing that out.
Oh I see what I did, I meant to put these functions in asm-prototypes
and not in switch_to but I ended up putting them in both.
- Charlie
More information about the linux-riscv
mailing list