compat_linux.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. #ifndef _ASM_S390X_S390_H
  2. #define _ASM_S390X_S390_H
  3. #include <linux/compat.h>
  4. #include <linux/socket.h>
  5. #include <linux/syscalls.h>
  6. /* Macro that masks the high order bit of an 32 bit pointer and converts it*/
  7. /* to a 64 bit pointer */
  8. #define A(__x) ((unsigned long)((__x) & 0x7FFFFFFFUL))
  9. #define AA(__x) \
  10. ((unsigned long)(__x))
  11. /* Now 32bit compatibility types */
  12. struct ipc_kludge_32 {
  13. __u32 msgp; /* pointer */
  14. __s32 msgtyp;
  15. };
  16. struct old_sigaction32 {
  17. __u32 sa_handler; /* Really a pointer, but need to deal with 32 bits */
  18. compat_old_sigset_t sa_mask; /* A 32 bit mask */
  19. __u32 sa_flags;
  20. __u32 sa_restorer; /* Another 32 bit pointer */
  21. };
  22. typedef struct compat_siginfo {
  23. int si_signo;
  24. int si_errno;
  25. int si_code;
  26. union {
  27. int _pad[((128/sizeof(int)) - 3)];
  28. /* kill() */
  29. struct {
  30. pid_t _pid; /* sender's pid */
  31. uid_t _uid; /* sender's uid */
  32. } _kill;
  33. /* POSIX.1b timers */
  34. struct {
  35. compat_timer_t _tid; /* timer id */
  36. int _overrun; /* overrun count */
  37. compat_sigval_t _sigval; /* same as below */
  38. int _sys_private; /* not to be passed to user */
  39. } _timer;
  40. /* POSIX.1b signals */
  41. struct {
  42. pid_t _pid; /* sender's pid */
  43. uid_t _uid; /* sender's uid */
  44. compat_sigval_t _sigval;
  45. } _rt;
  46. /* SIGCHLD */
  47. struct {
  48. pid_t _pid; /* which child */
  49. uid_t _uid; /* sender's uid */
  50. int _status;/* exit code */
  51. compat_clock_t _utime;
  52. compat_clock_t _stime;
  53. } _sigchld;
  54. /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
  55. struct {
  56. __u32 _addr; /* faulting insn/memory ref. - pointer */
  57. } _sigfault;
  58. /* SIGPOLL */
  59. struct {
  60. int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
  61. int _fd;
  62. } _sigpoll;
  63. } _sifields;
  64. } compat_siginfo_t;
  65. /*
  66. * How these fields are to be accessed.
  67. */
  68. #define si_pid _sifields._kill._pid
  69. #define si_uid _sifields._kill._uid
  70. #define si_status _sifields._sigchld._status
  71. #define si_utime _sifields._sigchld._utime
  72. #define si_stime _sifields._sigchld._stime
  73. #define si_value _sifields._rt._sigval
  74. #define si_int _sifields._rt._sigval.sival_int
  75. #define si_ptr _sifields._rt._sigval.sival_ptr
  76. #define si_addr _sifields._sigfault._addr
  77. #define si_band _sifields._sigpoll._band
  78. #define si_fd _sifields._sigpoll._fd
  79. #define si_tid _sifields._timer._tid
  80. #define si_overrun _sifields._timer._overrun
  81. /* asm/sigcontext.h */
  82. typedef union
  83. {
  84. __u64 d;
  85. __u32 f;
  86. } freg_t32;
  87. typedef struct
  88. {
  89. unsigned int fpc;
  90. freg_t32 fprs[__NUM_FPRS];
  91. } _s390_fp_regs32;
  92. typedef struct
  93. {
  94. __u32 mask;
  95. __u32 addr;
  96. } _psw_t32 __attribute__ ((aligned(8)));
  97. typedef struct
  98. {
  99. _psw_t32 psw;
  100. __u32 gprs[__NUM_GPRS];
  101. __u32 acrs[__NUM_ACRS];
  102. } _s390_regs_common32;
  103. typedef struct
  104. {
  105. _s390_regs_common32 regs;
  106. _s390_fp_regs32 fpregs;
  107. } _sigregs32;
  108. #define _SIGCONTEXT_NSIG32 64
  109. #define _SIGCONTEXT_NSIG_BPW32 32
  110. #define __SIGNAL_FRAMESIZE32 96
  111. #define _SIGMASK_COPY_SIZE32 (sizeof(u32)*2)
  112. struct sigcontext32
  113. {
  114. __u32 oldmask[_COMPAT_NSIG_WORDS];
  115. __u32 sregs; /* pointer */
  116. };
  117. /* asm/signal.h */
  118. struct sigaction32 {
  119. __u32 sa_handler; /* pointer */
  120. __u32 sa_flags;
  121. __u32 sa_restorer; /* pointer */
  122. compat_sigset_t sa_mask; /* mask last for extensibility */
  123. };
  124. typedef struct {
  125. __u32 ss_sp; /* pointer */
  126. int ss_flags;
  127. compat_size_t ss_size;
  128. } stack_t32;
  129. /* asm/ucontext.h */
  130. struct ucontext32 {
  131. __u32 uc_flags;
  132. __u32 uc_link; /* pointer */
  133. stack_t32 uc_stack;
  134. _sigregs32 uc_mcontext;
  135. compat_sigset_t uc_sigmask; /* mask last for extensibility */
  136. };
  137. struct stat64_emu31;
  138. struct mmap_arg_struct_emu31;
  139. struct fadvise64_64_args;
  140. struct old_sigaction32;
  141. struct old_sigaction32;
  142. long sys32_chown16(const char __user * filename, u16 user, u16 group);
  143. long sys32_lchown16(const char __user * filename, u16 user, u16 group);
  144. long sys32_fchown16(unsigned int fd, u16 user, u16 group);
  145. long sys32_setregid16(u16 rgid, u16 egid);
  146. long sys32_setgid16(u16 gid);
  147. long sys32_setreuid16(u16 ruid, u16 euid);
  148. long sys32_setuid16(u16 uid);
  149. long sys32_setresuid16(u16 ruid, u16 euid, u16 suid);
  150. long sys32_getresuid16(u16 __user *ruid, u16 __user *euid, u16 __user *suid);
  151. long sys32_setresgid16(u16 rgid, u16 egid, u16 sgid);
  152. long sys32_getresgid16(u16 __user *rgid, u16 __user *egid, u16 __user *sgid);
  153. long sys32_setfsuid16(u16 uid);
  154. long sys32_setfsgid16(u16 gid);
  155. long sys32_getgroups16(int gidsetsize, u16 __user *grouplist);
  156. long sys32_setgroups16(int gidsetsize, u16 __user *grouplist);
  157. long sys32_getuid16(void);
  158. long sys32_geteuid16(void);
  159. long sys32_getgid16(void);
  160. long sys32_getegid16(void);
  161. long sys32_ipc(u32 call, int first, int second, int third, u32 ptr);
  162. long sys32_truncate64(const char __user * path, unsigned long high,
  163. unsigned long low);
  164. long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned long low);
  165. long sys32_sched_rr_get_interval(compat_pid_t pid,
  166. struct compat_timespec __user *interval);
  167. long sys32_rt_sigprocmask(int how, compat_sigset_t __user *set,
  168. compat_sigset_t __user *oset, size_t sigsetsize);
  169. long sys32_rt_sigpending(compat_sigset_t __user *set, size_t sigsetsize);
  170. long sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo);
  171. long sys32_execve(const char __user *name, compat_uptr_t __user *argv,
  172. compat_uptr_t __user *envp);
  173. long sys32_init_module(void __user *umod, unsigned long len,
  174. const char __user *uargs);
  175. long sys32_delete_module(const char __user *name_user, unsigned int flags);
  176. long sys32_pread64(unsigned int fd, char __user *ubuf, size_t count,
  177. u32 poshi, u32 poslo);
  178. long sys32_pwrite64(unsigned int fd, const char __user *ubuf,
  179. size_t count, u32 poshi, u32 poslo);
  180. compat_ssize_t sys32_readahead(int fd, u32 offhi, u32 offlo, s32 count);
  181. long sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset,
  182. size_t count);
  183. long sys32_sendfile64(int out_fd, int in_fd, compat_loff_t __user *offset,
  184. s32 count);
  185. long sys32_stat64(const char __user * filename, struct stat64_emu31 __user * statbuf);
  186. long sys32_lstat64(const char __user * filename,
  187. struct stat64_emu31 __user * statbuf);
  188. long sys32_fstat64(unsigned long fd, struct stat64_emu31 __user * statbuf);
  189. long sys32_fstatat64(unsigned int dfd, const char __user *filename,
  190. struct stat64_emu31 __user* statbuf, int flag);
  191. unsigned long old32_mmap(struct mmap_arg_struct_emu31 __user *arg);
  192. long sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg);
  193. long sys32_read(unsigned int fd, char __user * buf, size_t count);
  194. long sys32_write(unsigned int fd, const char __user * buf, size_t count);
  195. long sys32_fadvise64(int fd, loff_t offset, size_t len, int advise);
  196. long sys32_fadvise64_64(struct fadvise64_64_args __user *args);
  197. long sys32_sigaction(int sig, const struct old_sigaction32 __user *act,
  198. struct old_sigaction32 __user *oact);
  199. long sys32_rt_sigaction(int sig, const struct sigaction32 __user *act,
  200. struct sigaction32 __user *oact, size_t sigsetsize);
  201. long sys32_sigaltstack(const stack_t32 __user *uss, stack_t32 __user *uoss);
  202. #endif /* _ASM_S390X_S390_H */