[PATCH v2 06/14] powerpc: Include all arch-specific syscall prototypes
Andrew Donnellan
ajd at linux.ibm.com
Mon Aug 8 15:24:10 AEST 2022
On Mon, 2022-07-25 at 16:27 +1000, Rohan McLure wrote:
> Forward declare all syscall handler prototypes where a generic
> prototype
> is not provided in either linux/syscalls.h or linux/compat.h in
> asm/syscalls.h. This is required for compile-time type-checking for
> syscall handlers, which is implemented later in this series.
>
> 32-bit compatibility syscall handlers are expressed in terms of types
> in
> ppc32.h. Expose this header globally.
>
> Signed-off-by: Rohan McLure <rmclure at linux.ibm.com>
> ---
> V1 -> V2: Explicitly include prototypes.
> ---
> arch/powerpc/{kernel => include/asm}/ppc32.h | 0
> arch/powerpc/include/asm/syscalls.h | 104 ++++++++++++-----
> arch/powerpc/kernel/signal_32.c | 2 +-
> arch/powerpc/perf/callchain_32.c | 2 +-
> 4 files changed, 76 insertions(+), 32 deletions(-)
>
> diff --git a/arch/powerpc/kernel/ppc32.h
> b/arch/powerpc/include/asm/ppc32.h
> similarity index 100%
> rename from arch/powerpc/kernel/ppc32.h
> rename to arch/powerpc/include/asm/ppc32.h
> diff --git a/arch/powerpc/include/asm/syscalls.h
> b/arch/powerpc/include/asm/syscalls.h
> index 025d4b877161..8b2757d7f423 100644
> --- a/arch/powerpc/include/asm/syscalls.h
> +++ b/arch/powerpc/include/asm/syscalls.h
> @@ -8,49 +8,93 @@
> #include <linux/types.h>
> #include <linux/compat.h>
>
> +#ifdef CONFIG_PPC64
> +#include <asm/ppc32.h>
> +#endif
> +#include <asm/unistd.h>
> +#include <asm/ucontext.h>
> +
> struct rtas_args;
>
> -asmlinkage long sys_mmap(unsigned long addr, size_t len,
> - unsigned long prot, unsigned long flags,
> - unsigned long fd, off_t offset);
> -asmlinkage long sys_mmap2(unsigned long addr, size_t len,
> - unsigned long prot, unsigned long flags,
> - unsigned long fd, unsigned long pgoff);
> -asmlinkage long sys_ppc64_personality(unsigned long personality);
> +#ifndef CONFIG_ARCH_HAS_SYSCALL_WRAPPER
> +
> +/*
> + * PowerPC architecture-specific syscalls
> + */
> +
> asmlinkage long sys_rtas(struct rtas_args __user *uargs);
> -int sys_ppc_select(int n, fd_set __user *inp, fd_set __user *outp,
> - fd_set __user *exp, struct __kernel_old_timeval
> __user *tvp);
Move to patch 4?
> -long sys_ppc_fadvise64_64(int fd, int advice, u32 offset_high, u32
> offset_low,
> - u32 len_high, u32 len_low);
> +asmlinkage long sys_ni_syscall(void);
>
> +#ifdef CONFIG_PPC64
> +asmlinkage long sys_ppc64_personality(unsigned long personality);
> #ifdef CONFIG_COMPAT
> -unsigned long compat_sys_mmap2(unsigned long addr, size_t len,
> - unsigned long prot, unsigned long
> flags,
> - unsigned long fd, unsigned long
> pgoff);
> +asmlinkage long compat_sys_ppc64_personality(unsigned long
> personality);
> +#endif /* CONFIG_COMPAT */
> +#endif /* CONFIG_PPC64 */
>
> -compat_ssize_t compat_sys_pread64(unsigned int fd, char __user
> *ubuf, compat_size_t count,
> - u32 reg6, u32 pos1, u32 pos2);
> +/* Parameters are reordered for powerpc to avoid padding */
> +asmlinkage long sys_ppc_fadvise64_64(int fd, int advice,
> + u32 offset_high, u32 offset_low,
> + u32 len_high, u32 len_low);
> +asmlinkage long sys_swapcontext(struct ucontext __user *old_ctx,
> + struct ucontext __user *new_ctx, long
> ctx_size);
> +asmlinkage long sys_mmap(unsigned long addr, size_t len,
> + unsigned long prot, unsigned long flags,
> + unsigned long fd, off_t offset);
> +asmlinkage long sys_mmap2(unsigned long addr, size_t len,
> + unsigned long prot, unsigned long flags,
> + unsigned long fd, unsigned long pgoff);
> +asmlinkage long sys_switch_endian(void);
>
> -compat_ssize_t compat_sys_pwrite64(unsigned int fd, const char
> __user *ubuf, compat_size_t count,
> - u32 reg6, u32 pos1, u32 pos2);
> +#ifdef CONFIG_PPC32
> +asmlinkage long sys_sigreturn(void);
> +asmlinkage long sys_debug_setcontext(struct ucontext __user *ctx,
> int ndbg,
> + struct sig_dbg_op __user *dbg);
> +#endif
>
> -compat_ssize_t compat_sys_readahead(int fd, u32 r4, u32 offset1, u32
> offset2, u32 count);
> +asmlinkage long sys_rt_sigreturn(void);
>
> -int compat_sys_truncate64(const char __user *path, u32 reg4,
> - unsigned long len1, unsigned long len2);
> +asmlinkage long sys_subpage_prot(unsigned long addr,
> + unsigned long len, u32 __user *map);
>
> -long compat_sys_fallocate(int fd, int mode, u32 offset1, u32
> offset2, u32 len1, u32 len2);
Move to patch 5?
> +#ifdef CONFIG_COMPAT
> +asmlinkage long compat_sys_swapcontext(struct ucontext32 __user
> *old_ctx,
> + struct ucontext32 __user
> *new_ctx,
> + int ctx_size);
> +asmlinkage long compat_sys_old_getrlimit(unsigned int resource,
> + struct compat_rlimit __user
> *rlim);
> +asmlinkage long compat_sys_sigreturn(void);
> +asmlinkage long compat_sys_rt_sigreturn(void);
>
> -int compat_sys_ftruncate64(unsigned int fd, u32 reg4, unsigned long
> len1,
> - unsigned long len2);
> +/* Architecture-specific implementations in sys_ppc32.c */
>
> -long compat_sys_ppc32_fadvise64(int fd, u32 unused, u32 offset1, u32
> offset2,
> - size_t len, int advice);
> +asmlinkage long compat_sys_mmap2(unsigned long addr, size_t len,
> + unsigned long prot, unsigned
> long flags,
> + unsigned long fd, unsigned long
> pgoff);
> +asmlinkage long compat_sys_ppc_pread64(unsigned int fd,
> + char __user *ubuf,
> compat_size_t count,
> + u32 reg6, u32 pos1, u32 pos2);
> +asmlinkage long compat_sys_ppc_pwrite64(unsigned int fd,
> + const char __user *ubuf,
> compat_size_t count,
> + u32 reg6, u32 pos1, u32
> pos2);
> +asmlinkage long compat_sys_ppc_readahead(int fd, u32 r4,
> + u32 offset1, u32 offset2,
> u32 count);
> +asmlinkage long compat_sys_ppc_truncate64(const char __user *path,
> u32 reg4,
> + unsigned long len1,
> unsigned long len2);
> +asmlinkage long compat_sys_ppc_fallocate(int fd, int mode, u32
> offset1, u32 offset2,
> + u32 len1, u32 len2);
This should be unnecessary thanks to patch 5?
> +asmlinkage long compat_sys_ppc_ftruncate64(unsigned int fd, u32
> reg4,
> + unsigned long len1,
> unsigned long len2);
> +asmlinkage long compat_sys_ppc32_fadvise64(int fd, u32 unused, u32
> offset1, u32 offset2,
> + size_t len, int advice);
> +asmlinkage long compat_sys_ppc_sync_file_range2(int fd, unsigned int
> flags,
> + unsigned int offset1,
> + unsigned int offset2,
> + unsigned int nbytes1,
> + unsigned int
> nbytes2);
> +#endif /* CONFIG_COMPAT */
>
> -long compat_sys_sync_file_range2(int fd, unsigned int flags,
> - unsigned int offset1, unsigned int
> offset2,
> - unsigned int nbytes1, unsigned int
> nbytes2);
> -#endif
> +#endif /* CONFIG_ARCH_HAS_SYSCALL_WRAPPER */
>
> #endif /* __KERNEL__ */
> #endif /* __ASM_POWERPC_SYSCALLS_H */
>
--
Andrew Donnellan OzLabs, ADL Canberra
ajd at linux.ibm.com IBM Australia Limited
More information about the Linuxppc-dev
mailing list