compat.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_PARISC_COMPAT_H
  3. #define _ASM_PARISC_COMPAT_H
  4. /*
  5. * Architecture specific compatibility types
  6. */
  7. #include <linux/types.h>
  8. #include <linux/sched.h>
  9. #include <linux/thread_info.h>
  10. #define compat_mode_t compat_mode_t
  11. typedef u16 compat_mode_t;
  12. #define compat_ipc_pid_t compat_ipc_pid_t
  13. typedef u16 compat_ipc_pid_t;
  14. #define compat_ipc64_perm compat_ipc64_perm
  15. #include <asm-generic/compat.h>
  16. #define COMPAT_UTS_MACHINE "parisc\0\0"
  17. typedef u16 compat_nlink_t;
  18. struct compat_stat {
  19. compat_dev_t st_dev; /* dev_t is 32 bits on parisc */
  20. compat_ino_t st_ino; /* 32 bits */
  21. compat_mode_t st_mode; /* 16 bits */
  22. compat_nlink_t st_nlink; /* 16 bits */
  23. u16 st_reserved1; /* old st_uid */
  24. u16 st_reserved2; /* old st_gid */
  25. compat_dev_t st_rdev;
  26. compat_off_t st_size;
  27. old_time32_t st_atime;
  28. u32 st_atime_nsec;
  29. old_time32_t st_mtime;
  30. u32 st_mtime_nsec;
  31. old_time32_t st_ctime;
  32. u32 st_ctime_nsec;
  33. s32 st_blksize;
  34. s32 st_blocks;
  35. u32 __unused1; /* ACL stuff */
  36. compat_dev_t __unused2; /* network */
  37. compat_ino_t __unused3; /* network */
  38. u32 __unused4; /* cnodes */
  39. u16 __unused5; /* netsite */
  40. short st_fstype;
  41. compat_dev_t st_realdev;
  42. u16 st_basemode;
  43. u16 st_spareshort;
  44. __compat_uid32_t st_uid;
  45. __compat_gid32_t st_gid;
  46. u32 st_spare4[3];
  47. };
  48. struct compat_sigcontext {
  49. compat_int_t sc_flags;
  50. compat_int_t sc_gr[32]; /* PSW in sc_gr[0] */
  51. u64 sc_fr[32];
  52. compat_int_t sc_iasq[2];
  53. compat_int_t sc_iaoq[2];
  54. compat_int_t sc_sar; /* cr11 */
  55. };
  56. struct compat_ipc64_perm {
  57. compat_key_t key;
  58. __compat_uid_t uid;
  59. __compat_gid_t gid;
  60. __compat_uid_t cuid;
  61. __compat_gid_t cgid;
  62. unsigned short int __pad1;
  63. compat_mode_t mode;
  64. unsigned short int __pad2;
  65. unsigned short int seq;
  66. unsigned int __pad3;
  67. unsigned long __unused1; /* yes they really are 64bit pads */
  68. unsigned long __unused2;
  69. };
  70. struct compat_semid64_ds {
  71. struct compat_ipc64_perm sem_perm;
  72. unsigned int sem_otime_high;
  73. unsigned int sem_otime;
  74. unsigned int sem_ctime_high;
  75. unsigned int sem_ctime;
  76. compat_ulong_t sem_nsems;
  77. compat_ulong_t __unused3;
  78. compat_ulong_t __unused4;
  79. };
  80. struct compat_msqid64_ds {
  81. struct compat_ipc64_perm msg_perm;
  82. unsigned int msg_stime_high;
  83. unsigned int msg_stime;
  84. unsigned int msg_rtime_high;
  85. unsigned int msg_rtime;
  86. unsigned int msg_ctime_high;
  87. unsigned int msg_ctime;
  88. compat_ulong_t msg_cbytes;
  89. compat_ulong_t msg_qnum;
  90. compat_ulong_t msg_qbytes;
  91. compat_pid_t msg_lspid;
  92. compat_pid_t msg_lrpid;
  93. compat_ulong_t __unused4;
  94. compat_ulong_t __unused5;
  95. };
  96. struct compat_shmid64_ds {
  97. struct compat_ipc64_perm shm_perm;
  98. unsigned int shm_atime_high;
  99. unsigned int shm_atime;
  100. unsigned int shm_dtime_high;
  101. unsigned int shm_dtime;
  102. unsigned int shm_ctime_high;
  103. unsigned int shm_ctime;
  104. unsigned int __unused4;
  105. compat_size_t shm_segsz;
  106. compat_pid_t shm_cpid;
  107. compat_pid_t shm_lpid;
  108. compat_ulong_t shm_nattch;
  109. compat_ulong_t __unused5;
  110. compat_ulong_t __unused6;
  111. };
  112. /*
  113. * The type of struct elf_prstatus.pr_reg in compatible core dumps.
  114. */
  115. #define COMPAT_ELF_NGREG 80
  116. typedef compat_ulong_t compat_elf_gregset_t[COMPAT_ELF_NGREG];
  117. static inline int __is_compat_task(struct task_struct *t)
  118. {
  119. return test_tsk_thread_flag(t, TIF_32BIT);
  120. }
  121. static inline int is_compat_task(void)
  122. {
  123. return __is_compat_task(current);
  124. }
  125. #endif /* _ASM_PARISC_COMPAT_H */