xref: /openbmc/linux/arch/powerpc/include/asm/syscalls.h (revision 8640de0dee49cec50040d9845a2bc96fd15adc9e)
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 
11*8640de0dSRohan 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 
188cd1def4SRohan McLure struct rtas_args;
198cd1def4SRohan McLure 
20016ff72bSRohan McLure /*
21016ff72bSRohan McLure  * long long munging:
22016ff72bSRohan McLure  * The 32 bit ABI passes long longs in an odd even register pair.
23016ff72bSRohan McLure  * High and low parts are swapped depending on endian mode,
24016ff72bSRohan McLure  * so define a macro (similar to mips linux32) to handle that.
25016ff72bSRohan McLure  */
26016ff72bSRohan McLure #ifdef __LITTLE_ENDIAN__
27016ff72bSRohan McLure #define merge_64(low, high) (((u64)high << 32) | low)
28016ff72bSRohan McLure #else
29016ff72bSRohan McLure #define merge_64(high, low) (((u64)high << 32) | low)
30016ff72bSRohan McLure #endif
31016ff72bSRohan McLure 
328cd1def4SRohan McLure long sys_ni_syscall(void);
33b8b572e1SStephen Rothwell 
348cd1def4SRohan McLure /*
358cd1def4SRohan McLure  * PowerPC architecture-specific syscalls
368cd1def4SRohan McLure  */
378cd1def4SRohan McLure 
388cd1def4SRohan McLure long sys_rtas(struct rtas_args __user *uargs);
398cd1def4SRohan McLure 
408cd1def4SRohan McLure #ifdef CONFIG_PPC64
418cd1def4SRohan McLure long sys_ppc64_personality(unsigned long personality);
428cd1def4SRohan McLure #ifdef CONFIG_COMPAT
438cd1def4SRohan McLure long compat_sys_ppc64_personality(unsigned long personality);
448cd1def4SRohan McLure #endif /* CONFIG_COMPAT */
458cd1def4SRohan McLure #endif /* CONFIG_PPC64 */
468cd1def4SRohan McLure 
478cd1def4SRohan McLure long sys_swapcontext(struct ucontext __user *old_ctx,
488cd1def4SRohan McLure 		     struct ucontext __user *new_ctx, long ctx_size);
495ba6c9a9SRohan McLure long sys_mmap(unsigned long addr, size_t len,
50b8b572e1SStephen Rothwell 	      unsigned long prot, unsigned long flags,
51b8b572e1SStephen Rothwell 	      unsigned long fd, off_t offset);
525ba6c9a9SRohan McLure long sys_mmap2(unsigned long addr, size_t len,
53b8b572e1SStephen Rothwell 	       unsigned long prot, unsigned long flags,
54b8b572e1SStephen Rothwell 	       unsigned long fd, unsigned long pgoff);
558cd1def4SRohan McLure long sys_switch_endian(void);
568cd1def4SRohan McLure 
578cd1def4SRohan McLure #ifdef CONFIG_PPC32
588cd1def4SRohan McLure long sys_sigreturn(void);
598cd1def4SRohan McLure long sys_debug_setcontext(struct ucontext __user *ctx, int ndbg,
608cd1def4SRohan McLure 			  struct sig_dbg_op __user *dbg);
618cd1def4SRohan McLure #endif
628cd1def4SRohan McLure 
638cd1def4SRohan McLure long sys_rt_sigreturn(void);
648cd1def4SRohan McLure 
658cd1def4SRohan McLure long sys_subpage_prot(unsigned long addr,
668cd1def4SRohan McLure 		      unsigned long len, u32 __user *map);
678cd1def4SRohan McLure 
688cd1def4SRohan McLure #ifdef CONFIG_COMPAT
698cd1def4SRohan McLure long compat_sys_swapcontext(struct ucontext32 __user *old_ctx,
708cd1def4SRohan McLure 			    struct ucontext32 __user *new_ctx,
718cd1def4SRohan McLure 			    int ctx_size);
728cd1def4SRohan McLure long compat_sys_old_getrlimit(unsigned int resource,
738cd1def4SRohan McLure 			      struct compat_rlimit __user *rlim);
748cd1def4SRohan McLure long compat_sys_sigreturn(void);
758cd1def4SRohan McLure long compat_sys_rt_sigreturn(void);
768cd1def4SRohan McLure #endif /* CONFIG_COMPAT */
778cd1def4SRohan McLure 
788cd1def4SRohan McLure /*
798cd1def4SRohan McLure  * Architecture specific signatures required by long long munging:
808cd1def4SRohan McLure  * The 32 bit ABI passes long longs in an odd even register pair.
818cd1def4SRohan McLure  * The following signatures provide a machine long parameter for
828cd1def4SRohan McLure  * each register that will be supplied. The implementation is
838cd1def4SRohan McLure  * responsible for combining parameter pairs.
848cd1def4SRohan McLure  */
85b8b572e1SStephen Rothwell 
86cc47ad40SCédric Le Goater #ifdef CONFIG_COMPAT
87b7fa9ce8SRohan McLure long compat_sys_mmap2(unsigned long addr, size_t len,
88cc47ad40SCédric Le Goater 		      unsigned long prot, unsigned long flags,
89cc47ad40SCédric Le Goater 		      unsigned long fd, unsigned long pgoff);
908cd1def4SRohan McLure long compat_sys_ppc_pread64(unsigned int fd,
918cd1def4SRohan McLure 			    char __user *ubuf, compat_size_t count,
92cc47ad40SCédric Le Goater 			    u32 reg6, u32 pos1, u32 pos2);
938cd1def4SRohan McLure long compat_sys_ppc_pwrite64(unsigned int fd,
948cd1def4SRohan McLure 			     const char __user *ubuf, compat_size_t count,
95cc47ad40SCédric Le Goater 			     u32 reg6, u32 pos1, u32 pos2);
968cd1def4SRohan McLure long compat_sys_ppc_readahead(int fd, u32 r4,
978cd1def4SRohan McLure 			      u32 offset1, u32 offset2, u32 count);
988cd1def4SRohan McLure long compat_sys_ppc_truncate64(const char __user *path, u32 reg4,
99cc47ad40SCédric Le Goater 			       unsigned long len1, unsigned long len2);
1008cd1def4SRohan McLure long compat_sys_ppc_ftruncate64(unsigned int fd, u32 reg4,
1018cd1def4SRohan McLure 				unsigned long len1, unsigned long len2);
102dec20c50SRohan McLure long compat_sys_ppc32_fadvise64(int fd, u32 unused, u32 offset1, u32 offset2,
103cc47ad40SCédric Le Goater 				size_t len, int advice);
1048cd1def4SRohan McLure long compat_sys_ppc_sync_file_range2(int fd, unsigned int flags,
1058cd1def4SRohan McLure 				     unsigned int offset1,
1068cd1def4SRohan McLure 				     unsigned int offset2,
1078cd1def4SRohan McLure 				     unsigned int nbytes1,
1088cd1def4SRohan McLure 				     unsigned int nbytes2);
1098cd1def4SRohan McLure #endif /* CONFIG_COMPAT */
110cc47ad40SCédric Le Goater 
1118cd1def4SRohan McLure #if defined(CONFIG_PPC32) || defined(CONFIG_COMPAT)
1128cd1def4SRohan McLure long sys_ppc_fadvise64_64(int fd, int advice,
1138cd1def4SRohan McLure 			  u32 offset_high, u32 offset_low,
1148cd1def4SRohan McLure 			  u32 len_high, u32 len_low);
115cc47ad40SCédric Le Goater #endif
116cc47ad40SCédric Le Goater 
117b8b572e1SStephen Rothwell #endif /* __KERNEL__ */
118b8b572e1SStephen Rothwell #endif /* __ASM_POWERPC_SYSCALLS_H */
119