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 92e2375062SNicholas Piggin #ifdef CONFIG_PPC32 93e2375062SNicholas Piggin long sys_ppc_pread64(unsigned int fd, 94e2375062SNicholas Piggin char __user *ubuf, compat_size_t count, 95e2375062SNicholas Piggin u32 reg6, u32 pos1, u32 pos2); 96e2375062SNicholas Piggin long sys_ppc_pwrite64(unsigned int fd, 97e2375062SNicholas Piggin const char __user *ubuf, compat_size_t count, 98e2375062SNicholas Piggin u32 reg6, u32 pos1, u32 pos2); 99e2375062SNicholas Piggin long sys_ppc_readahead(int fd, u32 r4, 100e2375062SNicholas Piggin u32 offset1, u32 offset2, u32 count); 101e2375062SNicholas Piggin long sys_ppc_truncate64(const char __user *path, u32 reg4, 102e2375062SNicholas Piggin unsigned long len1, unsigned long len2); 103e2375062SNicholas Piggin long sys_ppc_ftruncate64(unsigned int fd, u32 reg4, 104e2375062SNicholas Piggin unsigned long len1, unsigned long len2); 105e2375062SNicholas Piggin long sys_ppc32_fadvise64(int fd, u32 unused, u32 offset1, u32 offset2, 106e2375062SNicholas Piggin size_t len, int advice); 107*ce883a2bSAndreas Schwab long sys_ppc_sync_file_range2(int fd, unsigned int flags, 108*ce883a2bSAndreas Schwab unsigned int offset1, 109*ce883a2bSAndreas Schwab unsigned int offset2, 110*ce883a2bSAndreas Schwab unsigned int nbytes1, 111*ce883a2bSAndreas Schwab unsigned int nbytes2); 112*ce883a2bSAndreas Schwab long sys_ppc_fallocate(int fd, int mode, u32 offset1, u32 offset2, 113*ce883a2bSAndreas Schwab u32 len1, u32 len2); 114e2375062SNicholas Piggin #endif 115cc47ad40SCédric Le Goater #ifdef CONFIG_COMPAT 116b7fa9ce8SRohan McLure long compat_sys_mmap2(unsigned long addr, size_t len, 117cc47ad40SCédric Le Goater unsigned long prot, unsigned long flags, 118cc47ad40SCédric Le Goater unsigned long fd, unsigned long pgoff); 1198cd1def4SRohan McLure long compat_sys_ppc_pread64(unsigned int fd, 1208cd1def4SRohan McLure char __user *ubuf, compat_size_t count, 121cc47ad40SCédric Le Goater u32 reg6, u32 pos1, u32 pos2); 1228cd1def4SRohan McLure long compat_sys_ppc_pwrite64(unsigned int fd, 1238cd1def4SRohan McLure const char __user *ubuf, compat_size_t count, 124cc47ad40SCédric Le Goater u32 reg6, u32 pos1, u32 pos2); 1258cd1def4SRohan McLure long compat_sys_ppc_readahead(int fd, u32 r4, 1268cd1def4SRohan McLure u32 offset1, u32 offset2, u32 count); 1278cd1def4SRohan McLure long compat_sys_ppc_truncate64(const char __user *path, u32 reg4, 128cc47ad40SCédric Le Goater unsigned long len1, unsigned long len2); 1298cd1def4SRohan McLure long compat_sys_ppc_ftruncate64(unsigned int fd, u32 reg4, 1308cd1def4SRohan McLure unsigned long len1, unsigned long len2); 131dec20c50SRohan McLure long compat_sys_ppc32_fadvise64(int fd, u32 unused, u32 offset1, u32 offset2, 132cc47ad40SCédric Le Goater size_t len, int advice); 1338cd1def4SRohan McLure long compat_sys_ppc_sync_file_range2(int fd, unsigned int flags, 1348cd1def4SRohan McLure unsigned int offset1, 1358cd1def4SRohan McLure unsigned int offset2, 1368cd1def4SRohan McLure unsigned int nbytes1, 1378cd1def4SRohan McLure unsigned int nbytes2); 1388cd1def4SRohan McLure #endif /* CONFIG_COMPAT */ 139cc47ad40SCédric Le Goater 1408cd1def4SRohan McLure #if defined(CONFIG_PPC32) || defined(CONFIG_COMPAT) 1418cd1def4SRohan McLure long sys_ppc_fadvise64_64(int fd, int advice, 1428cd1def4SRohan McLure u32 offset_high, u32 offset_low, 1438cd1def4SRohan McLure u32 len_high, u32 len_low); 144cc47ad40SCédric Le Goater #endif 145cc47ad40SCédric Le Goater 1467e92e01bSRohan McLure #else 1477e92e01bSRohan McLure 1487e92e01bSRohan McLure #define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, native) 1497e92e01bSRohan McLure #define __SYSCALL(nr, entry) \ 15094746890SMichael Ellerman long entry(const struct pt_regs *regs); 1517e92e01bSRohan McLure 1527e92e01bSRohan McLure #ifdef CONFIG_PPC64 1537e92e01bSRohan McLure #include <asm/syscall_table_64.h> 1547e92e01bSRohan McLure #else 1557e92e01bSRohan McLure #include <asm/syscall_table_32.h> 1567e92e01bSRohan McLure #endif /* CONFIG_PPC64 */ 1577e92e01bSRohan McLure 1587e92e01bSRohan McLure #endif /* CONFIG_ARCH_HAS_SYSCALL_WRAPPER */ 1597e92e01bSRohan McLure 160b8b572e1SStephen Rothwell #endif /* __KERNEL__ */ 161b8b572e1SStephen Rothwell #endif /* __ASM_POWERPC_SYSCALLS_H */ 162