1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 2b8b572e1SStephen Rothwell #ifndef _ASM_POWERPC_COMPAT_H 3b8b572e1SStephen Rothwell #define _ASM_POWERPC_COMPAT_H 4b8b572e1SStephen Rothwell #ifdef __KERNEL__ 5b8b572e1SStephen Rothwell /* 6b8b572e1SStephen Rothwell * Architecture specific compatibility types 7b8b572e1SStephen Rothwell */ 8b8b572e1SStephen Rothwell #include <linux/types.h> 9b8b572e1SStephen Rothwell #include <linux/sched.h> 10b8b572e1SStephen Rothwell 11*84a0c977SGuo Ren #define compat_ipc_pid_t compat_ipc_pid_t 12*84a0c977SGuo Ren typedef u16 compat_ipc_pid_t; 13*84a0c977SGuo Ren 14*84a0c977SGuo Ren #define compat_ipc64_perm compat_ipc64_perm 15*84a0c977SGuo Ren 16fb373975SArnd Bergmann #include <asm-generic/compat.h> 17fb373975SArnd Bergmann 18422b9b96SAnton Blanchard #ifdef __BIG_ENDIAN__ 19e28cbf22SChristoph Hellwig #define COMPAT_UTS_MACHINE "ppc\0\0" 20422b9b96SAnton Blanchard #else 21422b9b96SAnton Blanchard #define COMPAT_UTS_MACHINE "ppcle\0\0" 22422b9b96SAnton Blanchard #endif 23b8b572e1SStephen Rothwell 24b8b572e1SStephen Rothwell typedef s16 compat_nlink_t; 25b8b572e1SStephen Rothwell 26b8b572e1SStephen Rothwell struct compat_stat { 27b8b572e1SStephen Rothwell compat_dev_t st_dev; 28b8b572e1SStephen Rothwell compat_ino_t st_ino; 29b8b572e1SStephen Rothwell compat_mode_t st_mode; 30b8b572e1SStephen Rothwell compat_nlink_t st_nlink; 31b8b572e1SStephen Rothwell __compat_uid32_t st_uid; 32b8b572e1SStephen Rothwell __compat_gid32_t st_gid; 33b8b572e1SStephen Rothwell compat_dev_t st_rdev; 34b8b572e1SStephen Rothwell compat_off_t st_size; 35b8b572e1SStephen Rothwell compat_off_t st_blksize; 36b8b572e1SStephen Rothwell compat_off_t st_blocks; 379afc5eeeSArnd Bergmann old_time32_t st_atime; 38b8b572e1SStephen Rothwell u32 st_atime_nsec; 399afc5eeeSArnd Bergmann old_time32_t st_mtime; 40b8b572e1SStephen Rothwell u32 st_mtime_nsec; 419afc5eeeSArnd Bergmann old_time32_t st_ctime; 42b8b572e1SStephen Rothwell u32 st_ctime_nsec; 43b8b572e1SStephen Rothwell u32 __unused4[2]; 44b8b572e1SStephen Rothwell }; 45b8b572e1SStephen Rothwell 46b8b572e1SStephen Rothwell /* 47b8b572e1SStephen Rothwell * ipc64_perm is actually 32/64bit clean but since the compat layer refers to 48b8b572e1SStephen Rothwell * it we may as well define it. 49b8b572e1SStephen Rothwell */ 50b8b572e1SStephen Rothwell struct compat_ipc64_perm { 51b8b572e1SStephen Rothwell compat_key_t key; 52b8b572e1SStephen Rothwell __compat_uid_t uid; 53b8b572e1SStephen Rothwell __compat_gid_t gid; 54b8b572e1SStephen Rothwell __compat_uid_t cuid; 55b8b572e1SStephen Rothwell __compat_gid_t cgid; 56b8b572e1SStephen Rothwell compat_mode_t mode; 57b8b572e1SStephen Rothwell unsigned int seq; 58b8b572e1SStephen Rothwell unsigned int __pad2; 59b8b572e1SStephen Rothwell unsigned long __unused1; /* yes they really are 64bit pads */ 60b8b572e1SStephen Rothwell unsigned long __unused2; 61b8b572e1SStephen Rothwell }; 62b8b572e1SStephen Rothwell 63b8b572e1SStephen Rothwell struct compat_semid64_ds { 64b8b572e1SStephen Rothwell struct compat_ipc64_perm sem_perm; 65d0b67de9SArnd Bergmann unsigned int sem_otime_high; 66d0b67de9SArnd Bergmann unsigned int sem_otime; 67d0b67de9SArnd Bergmann unsigned int sem_ctime_high; 68d0b67de9SArnd Bergmann unsigned int sem_ctime; 69b8b572e1SStephen Rothwell compat_ulong_t sem_nsems; 70b8b572e1SStephen Rothwell compat_ulong_t __unused3; 71b8b572e1SStephen Rothwell compat_ulong_t __unused4; 72b8b572e1SStephen Rothwell }; 73b8b572e1SStephen Rothwell 74b8b572e1SStephen Rothwell struct compat_msqid64_ds { 75b8b572e1SStephen Rothwell struct compat_ipc64_perm msg_perm; 76d0b67de9SArnd Bergmann unsigned int msg_stime_high; 77d0b67de9SArnd Bergmann unsigned int msg_stime; 78d0b67de9SArnd Bergmann unsigned int msg_rtime_high; 79d0b67de9SArnd Bergmann unsigned int msg_rtime; 80d0b67de9SArnd Bergmann unsigned int msg_ctime_high; 81d0b67de9SArnd Bergmann unsigned int msg_ctime; 82b8b572e1SStephen Rothwell compat_ulong_t msg_cbytes; 83b8b572e1SStephen Rothwell compat_ulong_t msg_qnum; 84b8b572e1SStephen Rothwell compat_ulong_t msg_qbytes; 85b8b572e1SStephen Rothwell compat_pid_t msg_lspid; 86b8b572e1SStephen Rothwell compat_pid_t msg_lrpid; 87b8b572e1SStephen Rothwell compat_ulong_t __unused4; 88b8b572e1SStephen Rothwell compat_ulong_t __unused5; 89b8b572e1SStephen Rothwell }; 90b8b572e1SStephen Rothwell 91b8b572e1SStephen Rothwell struct compat_shmid64_ds { 92b8b572e1SStephen Rothwell struct compat_ipc64_perm shm_perm; 93d0b67de9SArnd Bergmann unsigned int shm_atime_high; 94d0b67de9SArnd Bergmann unsigned int shm_atime; 95d0b67de9SArnd Bergmann unsigned int shm_dtime_high; 96d0b67de9SArnd Bergmann unsigned int shm_dtime; 97d0b67de9SArnd Bergmann unsigned int shm_ctime_high; 98d0b67de9SArnd Bergmann unsigned int shm_ctime; 99b8b572e1SStephen Rothwell unsigned int __unused4; 100b8b572e1SStephen Rothwell compat_size_t shm_segsz; 101b8b572e1SStephen Rothwell compat_pid_t shm_cpid; 102b8b572e1SStephen Rothwell compat_pid_t shm_lpid; 103b8b572e1SStephen Rothwell compat_ulong_t shm_nattch; 104b8b572e1SStephen Rothwell compat_ulong_t __unused5; 105b8b572e1SStephen Rothwell compat_ulong_t __unused6; 106b8b572e1SStephen Rothwell }; 107b8b572e1SStephen Rothwell is_compat_task(void)1085b101740SRoland McGrathstatic inline int is_compat_task(void) 1095b101740SRoland McGrath { 110cab175f9SDenis Kirjanov return is_32bit_task(); 1115b101740SRoland McGrath } 1125b101740SRoland McGrath 113b8b572e1SStephen Rothwell #endif /* __KERNEL__ */ 114b8b572e1SStephen Rothwell #endif /* _ASM_POWERPC_COMPAT_H */ 115