compat.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. #ifndef _ASM_PARISC_COMPAT_H
  2. #define _ASM_PARISC_COMPAT_H
  3. /*
  4. * Architecture specific compatibility types
  5. */
  6. #include <linux/types.h>
  7. #include <linux/sched.h>
  8. #include <linux/thread_info.h>
  9. #define COMPAT_USER_HZ 100
  10. #define COMPAT_UTS_MACHINE "parisc\0\0"
  11. typedef u32 compat_size_t;
  12. typedef s32 compat_ssize_t;
  13. typedef s32 compat_time_t;
  14. typedef s32 compat_clock_t;
  15. typedef s32 compat_pid_t;
  16. typedef u32 __compat_uid_t;
  17. typedef u32 __compat_gid_t;
  18. typedef u32 __compat_uid32_t;
  19. typedef u32 __compat_gid32_t;
  20. typedef u16 compat_mode_t;
  21. typedef u32 compat_ino_t;
  22. typedef u32 compat_dev_t;
  23. typedef s32 compat_off_t;
  24. typedef s64 compat_loff_t;
  25. typedef u16 compat_nlink_t;
  26. typedef u16 compat_ipc_pid_t;
  27. typedef s32 compat_daddr_t;
  28. typedef u32 compat_caddr_t;
  29. typedef s32 compat_key_t;
  30. typedef s32 compat_timer_t;
  31. typedef s32 compat_int_t;
  32. typedef s32 compat_long_t;
  33. typedef s64 compat_s64;
  34. typedef u32 compat_uint_t;
  35. typedef u32 compat_ulong_t;
  36. typedef u64 compat_u64;
  37. typedef u32 compat_uptr_t;
  38. struct compat_timespec {
  39. compat_time_t tv_sec;
  40. s32 tv_nsec;
  41. };
  42. struct compat_timeval {
  43. compat_time_t tv_sec;
  44. s32 tv_usec;
  45. };
  46. struct compat_stat {
  47. compat_dev_t st_dev; /* dev_t is 32 bits on parisc */
  48. compat_ino_t st_ino; /* 32 bits */
  49. compat_mode_t st_mode; /* 16 bits */
  50. compat_nlink_t st_nlink; /* 16 bits */
  51. u16 st_reserved1; /* old st_uid */
  52. u16 st_reserved2; /* old st_gid */
  53. compat_dev_t st_rdev;
  54. compat_off_t st_size;
  55. compat_time_t st_atime;
  56. u32 st_atime_nsec;
  57. compat_time_t st_mtime;
  58. u32 st_mtime_nsec;
  59. compat_time_t st_ctime;
  60. u32 st_ctime_nsec;
  61. s32 st_blksize;
  62. s32 st_blocks;
  63. u32 __unused1; /* ACL stuff */
  64. compat_dev_t __unused2; /* network */
  65. compat_ino_t __unused3; /* network */
  66. u32 __unused4; /* cnodes */
  67. u16 __unused5; /* netsite */
  68. short st_fstype;
  69. compat_dev_t st_realdev;
  70. u16 st_basemode;
  71. u16 st_spareshort;
  72. __compat_uid32_t st_uid;
  73. __compat_gid32_t st_gid;
  74. u32 st_spare4[3];
  75. };
  76. struct compat_flock {
  77. short l_type;
  78. short l_whence;
  79. compat_off_t l_start;
  80. compat_off_t l_len;
  81. compat_pid_t l_pid;
  82. };
  83. struct compat_flock64 {
  84. short l_type;
  85. short l_whence;
  86. compat_loff_t l_start;
  87. compat_loff_t l_len;
  88. compat_pid_t l_pid;
  89. };
  90. struct compat_statfs {
  91. s32 f_type;
  92. s32 f_bsize;
  93. s32 f_blocks;
  94. s32 f_bfree;
  95. s32 f_bavail;
  96. s32 f_files;
  97. s32 f_ffree;
  98. __kernel_fsid_t f_fsid;
  99. s32 f_namelen;
  100. s32 f_frsize;
  101. s32 f_flags;
  102. s32 f_spare[4];
  103. };
  104. struct compat_sigcontext {
  105. compat_int_t sc_flags;
  106. compat_int_t sc_gr[32]; /* PSW in sc_gr[0] */
  107. u64 sc_fr[32];
  108. compat_int_t sc_iasq[2];
  109. compat_int_t sc_iaoq[2];
  110. compat_int_t sc_sar; /* cr11 */
  111. };
  112. #define COMPAT_RLIM_INFINITY 0xffffffff
  113. typedef u32 compat_old_sigset_t; /* at least 32 bits */
  114. #define _COMPAT_NSIG 64
  115. #define _COMPAT_NSIG_BPW 32
  116. typedef u32 compat_sigset_word;
  117. typedef union compat_sigval {
  118. compat_int_t sival_int;
  119. compat_uptr_t sival_ptr;
  120. } compat_sigval_t;
  121. typedef struct compat_siginfo {
  122. int si_signo;
  123. int si_errno;
  124. int si_code;
  125. union {
  126. int _pad[128/sizeof(int) - 3];
  127. /* kill() */
  128. struct {
  129. unsigned int _pid; /* sender's pid */
  130. unsigned int _uid; /* sender's uid */
  131. } _kill;
  132. /* POSIX.1b timers */
  133. struct {
  134. compat_timer_t _tid; /* timer id */
  135. int _overrun; /* overrun count */
  136. char _pad[sizeof(unsigned int) - sizeof(int)];
  137. compat_sigval_t _sigval; /* same as below */
  138. int _sys_private; /* not to be passed to user */
  139. } _timer;
  140. /* POSIX.1b signals */
  141. struct {
  142. unsigned int _pid; /* sender's pid */
  143. unsigned int _uid; /* sender's uid */
  144. compat_sigval_t _sigval;
  145. } _rt;
  146. /* SIGCHLD */
  147. struct {
  148. unsigned int _pid; /* which child */
  149. unsigned int _uid; /* sender's uid */
  150. int _status; /* exit code */
  151. compat_clock_t _utime;
  152. compat_clock_t _stime;
  153. } _sigchld;
  154. /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
  155. struct {
  156. unsigned int _addr; /* faulting insn/memory ref. */
  157. } _sigfault;
  158. /* SIGPOLL */
  159. struct {
  160. int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
  161. int _fd;
  162. } _sigpoll;
  163. } _sifields;
  164. } compat_siginfo_t;
  165. #define COMPAT_OFF_T_MAX 0x7fffffff
  166. #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
  167. struct compat_ipc64_perm {
  168. compat_key_t key;
  169. __compat_uid_t uid;
  170. __compat_gid_t gid;
  171. __compat_uid_t cuid;
  172. __compat_gid_t cgid;
  173. unsigned short int __pad1;
  174. compat_mode_t mode;
  175. unsigned short int __pad2;
  176. unsigned short int seq;
  177. unsigned int __pad3;
  178. unsigned long __unused1; /* yes they really are 64bit pads */
  179. unsigned long __unused2;
  180. };
  181. struct compat_semid64_ds {
  182. struct compat_ipc64_perm sem_perm;
  183. compat_time_t sem_otime;
  184. unsigned int __unused1;
  185. compat_time_t sem_ctime;
  186. unsigned int __unused2;
  187. compat_ulong_t sem_nsems;
  188. compat_ulong_t __unused3;
  189. compat_ulong_t __unused4;
  190. };
  191. struct compat_msqid64_ds {
  192. struct compat_ipc64_perm msg_perm;
  193. unsigned int __unused1;
  194. compat_time_t msg_stime;
  195. unsigned int __unused2;
  196. compat_time_t msg_rtime;
  197. unsigned int __unused3;
  198. compat_time_t msg_ctime;
  199. compat_ulong_t msg_cbytes;
  200. compat_ulong_t msg_qnum;
  201. compat_ulong_t msg_qbytes;
  202. compat_pid_t msg_lspid;
  203. compat_pid_t msg_lrpid;
  204. compat_ulong_t __unused4;
  205. compat_ulong_t __unused5;
  206. };
  207. struct compat_shmid64_ds {
  208. struct compat_ipc64_perm shm_perm;
  209. unsigned int __unused1;
  210. compat_time_t shm_atime;
  211. unsigned int __unused2;
  212. compat_time_t shm_dtime;
  213. unsigned int __unused3;
  214. compat_time_t shm_ctime;
  215. unsigned int __unused4;
  216. compat_size_t shm_segsz;
  217. compat_pid_t shm_cpid;
  218. compat_pid_t shm_lpid;
  219. compat_ulong_t shm_nattch;
  220. compat_ulong_t __unused5;
  221. compat_ulong_t __unused6;
  222. };
  223. /*
  224. * A pointer passed in from user mode. This should not
  225. * be used for syscall parameters, just declare them
  226. * as pointers because the syscall entry code will have
  227. * appropriately converted them already.
  228. */
  229. static inline void __user *compat_ptr(compat_uptr_t uptr)
  230. {
  231. return (void __user *)(unsigned long)uptr;
  232. }
  233. static inline compat_uptr_t ptr_to_compat(void __user *uptr)
  234. {
  235. return (u32)(unsigned long)uptr;
  236. }
  237. static __inline__ void __user *arch_compat_alloc_user_space(long len)
  238. {
  239. struct pt_regs *regs = &current->thread.regs;
  240. return (void __user *)regs->gr[30];
  241. }
  242. static inline int __is_compat_task(struct task_struct *t)
  243. {
  244. return test_ti_thread_flag(task_thread_info(t), TIF_32BIT);
  245. }
  246. static inline int is_compat_task(void)
  247. {
  248. return __is_compat_task(current);
  249. }
  250. #endif /* _ASM_PARISC_COMPAT_H */