compat.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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/personality.h>
  9. #define COMPAT_USER_HZ 100
  10. typedef u32 compat_size_t;
  11. typedef s32 compat_ssize_t;
  12. typedef s32 compat_time_t;
  13. typedef s32 compat_clock_t;
  14. typedef s32 compat_pid_t;
  15. typedef u32 __compat_uid_t;
  16. typedef u32 __compat_gid_t;
  17. typedef u32 __compat_uid32_t;
  18. typedef u32 __compat_gid32_t;
  19. typedef u16 compat_mode_t;
  20. typedef u32 compat_ino_t;
  21. typedef u32 compat_dev_t;
  22. typedef s32 compat_off_t;
  23. typedef s64 compat_loff_t;
  24. typedef u16 compat_nlink_t;
  25. typedef u16 compat_ipc_pid_t;
  26. typedef s32 compat_daddr_t;
  27. typedef u32 compat_caddr_t;
  28. typedef s32 compat_timer_t;
  29. typedef s32 compat_int_t;
  30. typedef s32 compat_long_t;
  31. typedef u32 compat_uint_t;
  32. typedef u32 compat_ulong_t;
  33. struct compat_timespec {
  34. compat_time_t tv_sec;
  35. s32 tv_nsec;
  36. };
  37. struct compat_timeval {
  38. compat_time_t tv_sec;
  39. s32 tv_usec;
  40. };
  41. struct compat_stat {
  42. compat_dev_t st_dev; /* dev_t is 32 bits on parisc */
  43. compat_ino_t st_ino; /* 32 bits */
  44. compat_mode_t st_mode; /* 16 bits */
  45. compat_nlink_t st_nlink; /* 16 bits */
  46. u16 st_reserved1; /* old st_uid */
  47. u16 st_reserved2; /* old st_gid */
  48. compat_dev_t st_rdev;
  49. compat_off_t st_size;
  50. compat_time_t st_atime;
  51. u32 st_atime_nsec;
  52. compat_time_t st_mtime;
  53. u32 st_mtime_nsec;
  54. compat_time_t st_ctime;
  55. u32 st_ctime_nsec;
  56. s32 st_blksize;
  57. s32 st_blocks;
  58. u32 __unused1; /* ACL stuff */
  59. compat_dev_t __unused2; /* network */
  60. compat_ino_t __unused3; /* network */
  61. u32 __unused4; /* cnodes */
  62. u16 __unused5; /* netsite */
  63. short st_fstype;
  64. compat_dev_t st_realdev;
  65. u16 st_basemode;
  66. u16 st_spareshort;
  67. __compat_uid32_t st_uid;
  68. __compat_gid32_t st_gid;
  69. u32 st_spare4[3];
  70. };
  71. struct compat_flock {
  72. short l_type;
  73. short l_whence;
  74. compat_off_t l_start;
  75. compat_off_t l_len;
  76. compat_pid_t l_pid;
  77. };
  78. struct compat_flock64 {
  79. short l_type;
  80. short l_whence;
  81. compat_loff_t l_start;
  82. compat_loff_t l_len;
  83. compat_pid_t l_pid;
  84. };
  85. struct compat_statfs {
  86. s32 f_type;
  87. s32 f_bsize;
  88. s32 f_blocks;
  89. s32 f_bfree;
  90. s32 f_bavail;
  91. s32 f_files;
  92. s32 f_ffree;
  93. __kernel_fsid_t f_fsid;
  94. s32 f_namelen;
  95. s32 f_frsize;
  96. s32 f_spare[5];
  97. };
  98. struct compat_sigcontext {
  99. compat_int_t sc_flags;
  100. compat_int_t sc_gr[32]; /* PSW in sc_gr[0] */
  101. u64 sc_fr[32];
  102. compat_int_t sc_iasq[2];
  103. compat_int_t sc_iaoq[2];
  104. compat_int_t sc_sar; /* cr11 */
  105. };
  106. #define COMPAT_RLIM_INFINITY 0xffffffff
  107. typedef u32 compat_old_sigset_t; /* at least 32 bits */
  108. #define _COMPAT_NSIG 64
  109. #define _COMPAT_NSIG_BPW 32
  110. typedef u32 compat_sigset_word;
  111. #define COMPAT_OFF_T_MAX 0x7fffffff
  112. #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
  113. /*
  114. * A pointer passed in from user mode. This should not
  115. * be used for syscall parameters, just declare them
  116. * as pointers because the syscall entry code will have
  117. * appropriately comverted them already.
  118. */
  119. typedef u32 compat_uptr_t;
  120. static inline void __user *compat_ptr(compat_uptr_t uptr)
  121. {
  122. return (void __user *)(unsigned long)uptr;
  123. }
  124. static inline compat_uptr_t ptr_to_compat(void __user *uptr)
  125. {
  126. return (u32)(unsigned long)uptr;
  127. }
  128. static __inline__ void __user *compat_alloc_user_space(long len)
  129. {
  130. struct pt_regs *regs = &current->thread.regs;
  131. return (void __user *)regs->gr[30];
  132. }
  133. static inline int __is_compat_task(struct task_struct *t)
  134. {
  135. return personality(t->personality) == PER_LINUX32;
  136. }
  137. static inline int is_compat_task(void)
  138. {
  139. return __is_compat_task(current);
  140. }
  141. #endif /* _ASM_PARISC_COMPAT_H */