1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 2b8b572e1SStephen Rothwell #ifndef __ASM_POWERPC_SYSCALLS_H 3b8b572e1SStephen Rothwell #define __ASM_POWERPC_SYSCALLS_H 4b8b572e1SStephen Rothwell #ifdef __KERNEL__ 5b8b572e1SStephen Rothwell 6b8b572e1SStephen Rothwell #include <linux/compiler.h> 7b8b572e1SStephen Rothwell #include <linux/linkage.h> 8b8b572e1SStephen Rothwell #include <linux/types.h> 9cc47ad40SCédric Le Goater #include <linux/compat.h> 10b8b572e1SStephen Rothwell 118640de0dSRohan McLure #include <asm/syscall.h> 128cd1def4SRohan McLure #ifdef CONFIG_PPC64 138cd1def4SRohan McLure #include <asm/syscalls_32.h> 148cd1def4SRohan McLure #endif 158cd1def4SRohan McLure #include <asm/unistd.h> 168cd1def4SRohan McLure #include <asm/ucontext.h> 178cd1def4SRohan McLure 187e92e01bSRohan McLure #ifndef CONFIG_ARCH_HAS_SYSCALL_WRAPPER 197e92e01bSRohan McLure long sys_ni_syscall(void); 207e92e01bSRohan McLure #else 217e92e01bSRohan McLure long sys_ni_syscall(const struct pt_regs *regs); 227e92e01bSRohan McLure #endif 237e92e01bSRohan McLure 248cd1def4SRohan McLure struct rtas_args; 258cd1def4SRohan McLure 26016ff72bSRohan McLure /* 27016ff72bSRohan McLure * long long munging: 28016ff72bSRohan McLure * The 32 bit ABI passes long longs in an odd even register pair. 29016ff72bSRohan McLure * High and low parts are swapped depending on endian mode, 30016ff72bSRohan McLure * so define a macro (similar to mips linux32) to handle that. 31016ff72bSRohan McLure */ 32016ff72bSRohan McLure #ifdef __LITTLE_ENDIAN__ 33016ff72bSRohan McLure #define merge_64(low, high) (((u64)high << 32) | low) 34016ff72bSRohan McLure #else 35016ff72bSRohan McLure #define merge_64(high, low) (((u64)high << 32) | low) 36016ff72bSRohan McLure #endif 37016ff72bSRohan McLure 388cd1def4SRohan McLure /* 398cd1def4SRohan McLure * PowerPC architecture-specific syscalls 408cd1def4SRohan McLure */ 418cd1def4SRohan McLure 427e92e01bSRohan McLure #ifndef CONFIG_ARCH_HAS_SYSCALL_WRAPPER 437e92e01bSRohan McLure 448cd1def4SRohan McLure long sys_rtas(struct rtas_args __user *uargs); 458cd1def4SRohan McLure 468cd1def4SRohan McLure #ifdef CONFIG_PPC64 478cd1def4SRohan McLure long sys_ppc64_personality(unsigned long personality); 488cd1def4SRohan McLure #ifdef CONFIG_COMPAT 498cd1def4SRohan McLure long compat_sys_ppc64_personality(unsigned long personality); 508cd1def4SRohan McLure #endif /* CONFIG_COMPAT */ 518cd1def4SRohan McLure #endif /* CONFIG_PPC64 */ 528cd1def4SRohan McLure 538cd1def4SRohan McLure long sys_swapcontext(struct ucontext __user *old_ctx, 548cd1def4SRohan McLure struct ucontext __user *new_ctx, long ctx_size); 555ba6c9a9SRohan McLure long sys_mmap(unsigned long addr, size_t len, 56b8b572e1SStephen Rothwell unsigned long prot, unsigned long flags, 57b8b572e1SStephen Rothwell unsigned long fd, off_t offset); 585ba6c9a9SRohan McLure long sys_mmap2(unsigned long addr, size_t len, 59b8b572e1SStephen Rothwell unsigned long prot, unsigned long flags, 60b8b572e1SStephen Rothwell unsigned long fd, unsigned long pgoff); 618cd1def4SRohan McLure long sys_switch_endian(void); 628cd1def4SRohan McLure 638cd1def4SRohan McLure #ifdef CONFIG_PPC32 648cd1def4SRohan McLure long sys_sigreturn(void); 658cd1def4SRohan McLure long sys_debug_setcontext(struct ucontext __user *ctx, int ndbg, 668cd1def4SRohan McLure struct sig_dbg_op __user *dbg); 678cd1def4SRohan McLure #endif 688cd1def4SRohan McLure 698cd1def4SRohan McLure long sys_rt_sigreturn(void); 708cd1def4SRohan McLure 718cd1def4SRohan McLure long sys_subpage_prot(unsigned long addr, 728cd1def4SRohan McLure unsigned long len, u32 __user *map); 738cd1def4SRohan McLure 748cd1def4SRohan McLure #ifdef CONFIG_COMPAT 758cd1def4SRohan McLure long compat_sys_swapcontext(struct ucontext32 __user *old_ctx, 768cd1def4SRohan McLure struct ucontext32 __user *new_ctx, 778cd1def4SRohan McLure int ctx_size); 788cd1def4SRohan McLure long compat_sys_old_getrlimit(unsigned int resource, 798cd1def4SRohan McLure struct compat_rlimit __user *rlim); 808cd1def4SRohan McLure long compat_sys_sigreturn(void); 818cd1def4SRohan McLure long compat_sys_rt_sigreturn(void); 828cd1def4SRohan McLure #endif /* CONFIG_COMPAT */ 838cd1def4SRohan McLure 848cd1def4SRohan McLure /* 858cd1def4SRohan McLure * Architecture specific signatures required by long long munging: 868cd1def4SRohan McLure * The 32 bit ABI passes long longs in an odd even register pair. 878cd1def4SRohan McLure * The following signatures provide a machine long parameter for 888cd1def4SRohan McLure * each register that will be supplied. The implementation is 898cd1def4SRohan McLure * responsible for combining parameter pairs. 908cd1def4SRohan McLure */ 91b8b572e1SStephen Rothwell 92cc47ad40SCédric Le Goater #ifdef CONFIG_COMPAT 93b7fa9ce8SRohan McLure long compat_sys_mmap2(unsigned long addr, size_t len, 94cc47ad40SCédric Le Goater unsigned long prot, unsigned long flags, 95cc47ad40SCédric Le Goater unsigned long fd, unsigned long pgoff); 968cd1def4SRohan McLure long compat_sys_ppc_pread64(unsigned int fd, 978cd1def4SRohan McLure char __user *ubuf, compat_size_t count, 98cc47ad40SCédric Le Goater u32 reg6, u32 pos1, u32 pos2); 998cd1def4SRohan McLure long compat_sys_ppc_pwrite64(unsigned int fd, 1008cd1def4SRohan McLure const char __user *ubuf, compat_size_t count, 101cc47ad40SCédric Le Goater u32 reg6, u32 pos1, u32 pos2); 1028cd1def4SRohan McLure long compat_sys_ppc_readahead(int fd, u32 r4, 1038cd1def4SRohan McLure u32 offset1, u32 offset2, u32 count); 1048cd1def4SRohan McLure long compat_sys_ppc_truncate64(const char __user *path, u32 reg4, 105cc47ad40SCédric Le Goater unsigned long len1, unsigned long len2); 1068cd1def4SRohan McLure long compat_sys_ppc_ftruncate64(unsigned int fd, u32 reg4, 1078cd1def4SRohan McLure unsigned long len1, unsigned long len2); 108dec20c50SRohan McLure long compat_sys_ppc32_fadvise64(int fd, u32 unused, u32 offset1, u32 offset2, 109cc47ad40SCédric Le Goater size_t len, int advice); 1108cd1def4SRohan McLure long compat_sys_ppc_sync_file_range2(int fd, unsigned int flags, 1118cd1def4SRohan McLure unsigned int offset1, 1128cd1def4SRohan McLure unsigned int offset2, 1138cd1def4SRohan McLure unsigned int nbytes1, 1148cd1def4SRohan McLure unsigned int nbytes2); 1158cd1def4SRohan McLure #endif /* CONFIG_COMPAT */ 116cc47ad40SCédric Le Goater 1178cd1def4SRohan McLure #if defined(CONFIG_PPC32) || defined(CONFIG_COMPAT) 1188cd1def4SRohan McLure long sys_ppc_fadvise64_64(int fd, int advice, 1198cd1def4SRohan McLure u32 offset_high, u32 offset_low, 1208cd1def4SRohan McLure u32 len_high, u32 len_low); 121cc47ad40SCédric Le Goater #endif 122cc47ad40SCédric Le Goater 1237e92e01bSRohan McLure #else 1247e92e01bSRohan McLure 1257e92e01bSRohan McLure #define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, native) 1267e92e01bSRohan McLure #define __SYSCALL(nr, entry) \ 127*94746890SMichael Ellerman long entry(const struct pt_regs *regs); 1287e92e01bSRohan McLure 1297e92e01bSRohan McLure #ifdef CONFIG_PPC64 1307e92e01bSRohan McLure #include <asm/syscall_table_64.h> 1317e92e01bSRohan McLure #else 1327e92e01bSRohan McLure #include <asm/syscall_table_32.h> 1337e92e01bSRohan McLure #endif /* CONFIG_PPC64 */ 1347e92e01bSRohan McLure 1357e92e01bSRohan McLure #endif /* CONFIG_ARCH_HAS_SYSCALL_WRAPPER */ 1367e92e01bSRohan McLure 137b8b572e1SStephen Rothwell #endif /* __KERNEL__ */ 138b8b572e1SStephen Rothwell #endif /* __ASM_POWERPC_SYSCALLS_H */ 139