xref: /openbmc/linux/arch/powerpc/include/asm/syscalls.h (revision 8cd1def4b8e4a592949509fac443e850da8428d0)
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*8cd1def4SRohan McLure #ifdef CONFIG_PPC64
12*8cd1def4SRohan McLure #include <asm/syscalls_32.h>
13*8cd1def4SRohan McLure #endif
14*8cd1def4SRohan McLure #include <asm/unistd.h>
15*8cd1def4SRohan McLure #include <asm/ucontext.h>
16*8cd1def4SRohan McLure 
17*8cd1def4SRohan McLure struct rtas_args;
18*8cd1def4SRohan McLure 
19016ff72bSRohan McLure /*
20016ff72bSRohan McLure  * long long munging:
21016ff72bSRohan McLure  * The 32 bit ABI passes long longs in an odd even register pair.
22016ff72bSRohan McLure  * High and low parts are swapped depending on endian mode,
23016ff72bSRohan McLure  * so define a macro (similar to mips linux32) to handle that.
24016ff72bSRohan McLure  */
25016ff72bSRohan McLure #ifdef __LITTLE_ENDIAN__
26016ff72bSRohan McLure #define merge_64(low, high) (((u64)high << 32) | low)
27016ff72bSRohan McLure #else
28016ff72bSRohan McLure #define merge_64(high, low) (((u64)high << 32) | low)
29016ff72bSRohan McLure #endif
30016ff72bSRohan McLure 
31*8cd1def4SRohan McLure long sys_ni_syscall(void);
32b8b572e1SStephen Rothwell 
33*8cd1def4SRohan McLure /*
34*8cd1def4SRohan McLure  * PowerPC architecture-specific syscalls
35*8cd1def4SRohan McLure  */
36*8cd1def4SRohan McLure 
37*8cd1def4SRohan McLure long sys_rtas(struct rtas_args __user *uargs);
38*8cd1def4SRohan McLure 
39*8cd1def4SRohan McLure #ifdef CONFIG_PPC64
40*8cd1def4SRohan McLure long sys_ppc64_personality(unsigned long personality);
41*8cd1def4SRohan McLure #ifdef CONFIG_COMPAT
42*8cd1def4SRohan McLure long compat_sys_ppc64_personality(unsigned long personality);
43*8cd1def4SRohan McLure #endif /* CONFIG_COMPAT */
44*8cd1def4SRohan McLure #endif /* CONFIG_PPC64 */
45*8cd1def4SRohan McLure 
46*8cd1def4SRohan McLure long sys_swapcontext(struct ucontext __user *old_ctx,
47*8cd1def4SRohan McLure 		     struct ucontext __user *new_ctx, long ctx_size);
485ba6c9a9SRohan McLure long sys_mmap(unsigned long addr, size_t len,
49b8b572e1SStephen Rothwell 	      unsigned long prot, unsigned long flags,
50b8b572e1SStephen Rothwell 	      unsigned long fd, off_t offset);
515ba6c9a9SRohan McLure long sys_mmap2(unsigned long addr, size_t len,
52b8b572e1SStephen Rothwell 	       unsigned long prot, unsigned long flags,
53b8b572e1SStephen Rothwell 	       unsigned long fd, unsigned long pgoff);
54*8cd1def4SRohan McLure long sys_switch_endian(void);
55*8cd1def4SRohan McLure 
56*8cd1def4SRohan McLure #ifdef CONFIG_PPC32
57*8cd1def4SRohan McLure long sys_sigreturn(void);
58*8cd1def4SRohan McLure long sys_debug_setcontext(struct ucontext __user *ctx, int ndbg,
59*8cd1def4SRohan McLure 			  struct sig_dbg_op __user *dbg);
60*8cd1def4SRohan McLure #endif
61*8cd1def4SRohan McLure 
62*8cd1def4SRohan McLure long sys_rt_sigreturn(void);
63*8cd1def4SRohan McLure 
64*8cd1def4SRohan McLure long sys_subpage_prot(unsigned long addr,
65*8cd1def4SRohan McLure 		      unsigned long len, u32 __user *map);
66*8cd1def4SRohan McLure 
67*8cd1def4SRohan McLure #ifdef CONFIG_COMPAT
68*8cd1def4SRohan McLure long compat_sys_swapcontext(struct ucontext32 __user *old_ctx,
69*8cd1def4SRohan McLure 			    struct ucontext32 __user *new_ctx,
70*8cd1def4SRohan McLure 			    int ctx_size);
71*8cd1def4SRohan McLure long compat_sys_old_getrlimit(unsigned int resource,
72*8cd1def4SRohan McLure 			      struct compat_rlimit __user *rlim);
73*8cd1def4SRohan McLure long compat_sys_sigreturn(void);
74*8cd1def4SRohan McLure long compat_sys_rt_sigreturn(void);
75*8cd1def4SRohan McLure #endif /* CONFIG_COMPAT */
76*8cd1def4SRohan McLure 
77*8cd1def4SRohan McLure /*
78*8cd1def4SRohan McLure  * Architecture specific signatures required by long long munging:
79*8cd1def4SRohan McLure  * The 32 bit ABI passes long longs in an odd even register pair.
80*8cd1def4SRohan McLure  * The following signatures provide a machine long parameter for
81*8cd1def4SRohan McLure  * each register that will be supplied. The implementation is
82*8cd1def4SRohan McLure  * responsible for combining parameter pairs.
83*8cd1def4SRohan McLure  */
84b8b572e1SStephen Rothwell 
85cc47ad40SCédric Le Goater #ifdef CONFIG_COMPAT
86b7fa9ce8SRohan McLure long compat_sys_mmap2(unsigned long addr, size_t len,
87cc47ad40SCédric Le Goater 		      unsigned long prot, unsigned long flags,
88cc47ad40SCédric Le Goater 		      unsigned long fd, unsigned long pgoff);
89*8cd1def4SRohan McLure long compat_sys_ppc_pread64(unsigned int fd,
90*8cd1def4SRohan McLure 			    char __user *ubuf, compat_size_t count,
91cc47ad40SCédric Le Goater 			    u32 reg6, u32 pos1, u32 pos2);
92*8cd1def4SRohan McLure long compat_sys_ppc_pwrite64(unsigned int fd,
93*8cd1def4SRohan McLure 			     const char __user *ubuf, compat_size_t count,
94cc47ad40SCédric Le Goater 			     u32 reg6, u32 pos1, u32 pos2);
95*8cd1def4SRohan McLure long compat_sys_ppc_readahead(int fd, u32 r4,
96*8cd1def4SRohan McLure 			      u32 offset1, u32 offset2, u32 count);
97*8cd1def4SRohan McLure long compat_sys_ppc_truncate64(const char __user *path, u32 reg4,
98cc47ad40SCédric Le Goater 			       unsigned long len1, unsigned long len2);
99*8cd1def4SRohan McLure long compat_sys_ppc_ftruncate64(unsigned int fd, u32 reg4,
100*8cd1def4SRohan McLure 				unsigned long len1, unsigned long len2);
101dec20c50SRohan McLure long compat_sys_ppc32_fadvise64(int fd, u32 unused, u32 offset1, u32 offset2,
102cc47ad40SCédric Le Goater 				size_t len, int advice);
103*8cd1def4SRohan McLure long compat_sys_ppc_sync_file_range2(int fd, unsigned int flags,
104*8cd1def4SRohan McLure 				     unsigned int offset1,
105*8cd1def4SRohan McLure 				     unsigned int offset2,
106*8cd1def4SRohan McLure 				     unsigned int nbytes1,
107*8cd1def4SRohan McLure 				     unsigned int nbytes2);
108*8cd1def4SRohan McLure #endif /* CONFIG_COMPAT */
109cc47ad40SCédric Le Goater 
110*8cd1def4SRohan McLure #if defined(CONFIG_PPC32) || defined(CONFIG_COMPAT)
111*8cd1def4SRohan McLure long sys_ppc_fadvise64_64(int fd, int advice,
112*8cd1def4SRohan McLure 			  u32 offset_high, u32 offset_low,
113*8cd1def4SRohan McLure 			  u32 len_high, u32 len_low);
114cc47ad40SCédric Le Goater #endif
115cc47ad40SCédric Le Goater 
116b8b572e1SStephen Rothwell #endif /* __KERNEL__ */
117b8b572e1SStephen Rothwell #endif /* __ASM_POWERPC_SYSCALLS_H */
118