# Re: \[PATCH 09/19\] LoongArch: Add system call support

- From: Huacai Chen \<hidden\>
- Date: 2021-07-07 04:27:31 
- List: linux-arch
- Page: https://ratatoskr.run/linux-arch/2021/07/13337073
- Thread: https://ratatoskr.run/linux-arch/2021/07/13337006/t.md

```text
Hi, Thomas,

On Tue, Jul 6, 2021 at 9:51 PM Thomas Gleixner [ref] wrote:
>
> Chen!
>
> On Tue, Jul 06 2021 at 12:18, Huacai Chen wrote:
> > +     li.d    t1, _TIF_WORK_SYSCALL_ENTRY
> > +     LONG_L  t0, tp, TI_FLAGS        # syscall tracing enabled?
> > +     and     t0, t1, t0
> > +     bnez    t0, syscall_trace_entry
> > +
> > +syscall_common:
> > +     /* Check to make sure we don't jump to a bogus syscall number. */
> > +     li.w    t0, __NR_syscalls
> > +     sub.d   t2, a7, t0
> > +     bgez    t2, illegal_syscall
> > +
> > +     /* Syscall number held in a7 */
> > +     slli.d  t0, a7, 3               # offset into table
> > +     la      t2, sys_call_table
> > +     add.d   t0, t2, t0
> > +     ld.d    t2, t0, 0               #syscall routine
> > +     beqz    t2, illegal_syscall
> > +
> > +     jalr    t2                      # Do The Real Thing (TM)
> > +
> > +     ld.d    t1, sp, PT_R11          # syscall number
> > +     addi.d  t1, t1, 1               # +1 for handle_signal
> > +     st.d    t1, sp, PT_R0           # save it for syscall restarting
> > +     st.d    v0, sp, PT_R4           # result
>
> Please do not add _again_ TIF handling in ASM. Please use the generic
> entry code infrastructure for this. It handles the complete set of TIF
> bits (if enabled in config) out of the box and it does so correctly.
OK, thanks, I will improve.

Huacai
>
> Thanks,
>
>         tglx
>
>
```
