Re: [PATCH RFC v3 8/8] mips: Use the common syscall table

From: Arnd Bergmann

Date: Fri Aug 07 2026 - 17:03:00 EST


On Fri, Aug 7, 2026, at 21:34, André Almeida wrote:
> Syscall numbers from 403 are shared with all architectures, so move the
> toolchain to use the common syscall table and remove duplicated code.
>
> The generated files are not exactly the same as before, but they have no
> functional changes:
>
> - for O32 ABI, the syscall table would have entries like
> __SYSCALL_WITH_COMPAT(403, sys_clock_gettime, sys_clock_gettime)
> which is equivalent to the new entry __SYSCALL(403, sys_clock_gettime)
>
> - for N32 ABI, the syscall table would have entries like
> __SYSCALL(413, compat_sys_pselect6_time64), which is equivalent to
> __SYSCALL_WITH_COMPAT(413, sys_pselect6, compat_sys_pselect6_time64)
> given the new __SYSCALL_WITH_COMPAT() definition for N32.
>
> The generated syscall table for N64 is exactly the same.
>
> Signed-off-by: André Almeida <andrealmeid@xxxxxxxxxx>
> ---
> arch/mips/kernel/scall64-n32.S | 1 +
> arch/mips/kernel/syscalls/Makefile | 22 +++++++---
> arch/mips/kernel/syscalls/syscall_n32.tbl | 68 -------------------------------
> arch/mips/kernel/syscalls/syscall_n64.tbl | 48 ----------------------
> arch/mips/kernel/syscalls/syscall_o32.tbl | 68 -------------------------------
> 5 files changed, 18 insertions(+), 189 deletions(-)

I still wonder whether we should combine the n32 and n64 tables
here. Since the script can now deal with multiple input files,
the first 211 syscall numbers can be in a shared file, while
numbers 212 through 332 are always going to be different.

Alternatively, two the files could just be merged into one file
like

0 common read sys_read
1 common write sys_write
...
13 common rt_sigaction sys_rt_sigaction compat_sys_rt_sigaction
...
210 common remap_file_pages sys_remap_file_pages
211 common rt_sigreturn sys_rt_sigreturn
...
212 32 fcntl64 compat_sys_fcntl64
213 32 set_tid_address sys_set_tid_address
...
212 64 set_tid_address sys_set_tid_address
213 64 restart_syscall sys_restart_syscall


> -$(kapi)/unistd_nr_%.h: $(src)/syscall_%.tbl $(sysnr) FORCE
> +abis := common,__cln3
> +
> +abis_n32 := $(abis),32,n32
> +abis_o32 := $(abis),32,o32
> +abis_n64 := $(abis),64,n64

We should probably drop the custom ABI names here and just use
common/32/64 in the .tbl file. There was never a real need for
the special case here, and now it causes extra complexity.

Arnd