[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a13a5f0b-49ca-4116-8654-5bc57c0ca6a0@xen0n.name>
Date: Thu, 20 Nov 2025 18:40:28 +0800
From: WANG Xuerui <kernel@...0n.name>
To: Huacai Chen <chenhuacai@...ngson.cn>, Arnd Bergmann <arnd@...db.de>,
Huacai Chen <chenhuacai@...nel.org>
Cc: loongarch@...ts.linux.dev, linux-arch@...r.kernel.org,
Xuefeng Li <lixuefeng@...ngson.cn>, Guo Ren <guoren@...nel.org>,
Jiaxun Yang <jiaxun.yang@...goat.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH V2 09/14] LoongArch: Adjust system call for 32BIT/64BIT
On 11/18/25 19:27, Huacai Chen wrote:
> Adjust system call for both 32BIT and 64BIT, including: add the uapi
> unistd_{32,64}.h and syscall_table_{32,64}.h inclusion, add sys_mmap2()
> definition, change the system call entry routines, etc.
>
> Signed-off-by: Jiaxun Yang <jiaxun.yang@...goat.com>
> Signed-off-by: Huacai Chen <chenhuacai@...ngson.cn>
> ---
> arch/loongarch/include/asm/Kbuild | 1 +
> arch/loongarch/include/uapi/asm/Kbuild | 1 +
> arch/loongarch/include/uapi/asm/unistd.h | 6 ++++++
> arch/loongarch/kernel/Makefile.syscalls | 1 +
> arch/loongarch/kernel/entry.S | 22 +++++++++++-----------
> arch/loongarch/kernel/syscall.c | 13 +++++++++++++
> 6 files changed, 33 insertions(+), 11 deletions(-)
>
> [snip]
> diff --git a/arch/loongarch/kernel/syscall.c b/arch/loongarch/kernel/syscall.c
> index ab94eb5ce039..1249d82c1cd0 100644
> --- a/arch/loongarch/kernel/syscall.c
> +++ b/arch/loongarch/kernel/syscall.c
> @@ -34,9 +34,22 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len, unsigned long,
> return ksys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
> }
>
> +SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len, unsigned long,
> + prot, unsigned long, flags, unsigned long, fd, unsigned long, offset)
> +{
> + if (offset & (~PAGE_MASK >> 12))
> + return -EINVAL;
> +
> + return ksys_mmap_pgoff(addr, len, prot, flags, fd, offset >> (PAGE_SHIFT - 12));
> +}
> +
Why not guard this with #ifdef CONFIG_32BIT?
> void *sys_call_table[__NR_syscalls] = {
> [0 ... __NR_syscalls - 1] = sys_ni_syscall,
> +#ifdef CONFIG_32BIT
> +#include <asm/syscall_table_32.h>
> +#else
> #include <asm/syscall_table_64.h>
> +#endif
> };
>
> typedef long (*sys_call_fn)(unsigned long, unsigned long,
--
WANG "xen0n" Xuerui
Linux/LoongArch mailing list: https://lore.kernel.org/loongarch/
Powered by blists - more mailing lists