| 1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
| 2 |
#ifndef _ASM_SPARC64_COMPAT_H |
| 3 |
#define _ASM_SPARC64_COMPAT_H |
| 4 |
/* |
| 5 |
* Architecture specific compatibility types |
| 6 |
*/ |
| 7 |
#include <linux/types.h> |
| 8 |
|
| 9 |
#define compat_mode_t compat_mode_t |
| 10 |
typedef u16 compat_mode_t; |
| 11 |
|
| 12 |
#define __compat_uid_t __compat_uid_t |
| 13 |
typedef u16 __compat_uid_t; |
| 14 |
typedef u16 __compat_gid_t; |
| 15 |
|
| 16 |
#define compat_dev_t compat_dev_t |
| 17 |
typedef u16 compat_dev_t; |
| 18 |
|
| 19 |
#define compat_ipc_pid_t compat_ipc_pid_t |
| 20 |
typedef u16 compat_ipc_pid_t; |
| 21 |
|
| 22 |
#define compat_ipc64_perm compat_ipc64_perm |
| 23 |
|
| 24 |
#define COMPAT_RLIM_INFINITY 0x7fffffff |
| 25 |
|
| 26 |
#include <asm-generic/compat.h> |
| 27 |
|
| 28 |
#define COMPAT_UTS_MACHINE "sparc\0\0" |
| 29 |
|
| 30 |
typedef s16 compat_nlink_t; |
| 31 |
|
| 32 |
struct compat_stat { |
| 33 |
compat_dev_t st_dev; |
| 34 |
compat_ino_t st_ino; |
| 35 |
compat_mode_t st_mode; |
| 36 |
compat_nlink_t st_nlink; |
| 37 |
__compat_uid_t st_uid; |
| 38 |
__compat_gid_t st_gid; |
| 39 |
compat_dev_t st_rdev; |
| 40 |
compat_off_t st_size; |
| 41 |
old_time32_t st_atime; |
| 42 |
compat_ulong_t st_atime_nsec; |
| 43 |
old_time32_t st_mtime; |
| 44 |
compat_ulong_t st_mtime_nsec; |
| 45 |
old_time32_t st_ctime; |
| 46 |
compat_ulong_t st_ctime_nsec; |
| 47 |
compat_off_t st_blksize; |
| 48 |
compat_off_t st_blocks; |
| 49 |
u32 __unused4[2]; |
| 50 |
}; |
| 51 |
|
| 52 |
struct compat_stat64 { |
| 53 |
unsigned long long st_dev; |
| 54 |
|
| 55 |
unsigned long long st_ino; |
| 56 |
|
| 57 |
unsigned int st_mode; |
| 58 |
unsigned int st_nlink; |
| 59 |
|
| 60 |
unsigned int st_uid; |
| 61 |
unsigned int st_gid; |
| 62 |
|
| 63 |
unsigned long long st_rdev; |
| 64 |
|
| 65 |
unsigned char __pad3[8]; |
| 66 |
|
| 67 |
long long st_size; |
| 68 |
unsigned int st_blksize; |
| 69 |
|
| 70 |
unsigned char __pad4[8]; |
| 71 |
unsigned int st_blocks; |
| 72 |
|
| 73 |
unsigned int st_atime; |
| 74 |
unsigned int st_atime_nsec; |
| 75 |
|
| 76 |
unsigned int st_mtime; |
| 77 |
unsigned int st_mtime_nsec; |
| 78 |
|
| 79 |
unsigned int st_ctime; |
| 80 |
unsigned int st_ctime_nsec; |
| 81 |
|
| 82 |
unsigned int __unused4; |
| 83 |
unsigned int __unused5; |
| 84 |
}; |
| 85 |
|
| 86 |
#define __ARCH_COMPAT_FLOCK_PAD short __unused; |
| 87 |
|
| 88 |
struct compat_ipc64_perm { |
| 89 |
compat_key_t key; |
| 90 |
__compat_uid32_t uid; |
| 91 |
__compat_gid32_t gid; |
| 92 |
__compat_uid32_t cuid; |
| 93 |
__compat_gid32_t cgid; |
| 94 |
unsigned short __pad1; |
| 95 |
compat_mode_t mode; |
| 96 |
unsigned short __pad2; |
| 97 |
unsigned short seq; |
| 98 |
unsigned long __unused1; /* yes they really are 64bit pads */ |
| 99 |
unsigned long __unused2; |
| 100 |
}; |
| 101 |
|
| 102 |
struct compat_semid64_ds { |
| 103 |
struct compat_ipc64_perm sem_perm; |
| 104 |
unsigned int sem_otime_high; |
| 105 |
unsigned int sem_otime; |
| 106 |
unsigned int sem_ctime_high; |
| 107 |
unsigned int sem_ctime; |
| 108 |
u32 sem_nsems; |
| 109 |
u32 __unused1; |
| 110 |
u32 __unused2; |
| 111 |
}; |
| 112 |
|
| 113 |
struct compat_msqid64_ds { |
| 114 |
struct compat_ipc64_perm msg_perm; |
| 115 |
unsigned int msg_stime_high; |
| 116 |
unsigned int msg_stime; |
| 117 |
unsigned int msg_rtime_high; |
| 118 |
unsigned int msg_rtime; |
| 119 |
unsigned int msg_ctime_high; |
| 120 |
unsigned int msg_ctime; |
| 121 |
unsigned int msg_cbytes; |
| 122 |
unsigned int msg_qnum; |
| 123 |
unsigned int msg_qbytes; |
| 124 |
compat_pid_t msg_lspid; |
| 125 |
compat_pid_t msg_lrpid; |
| 126 |
unsigned int __unused1; |
| 127 |
unsigned int __unused2; |
| 128 |
}; |
| 129 |
|
| 130 |
struct compat_shmid64_ds { |
| 131 |
struct compat_ipc64_perm shm_perm; |
| 132 |
unsigned int shm_atime_high; |
| 133 |
unsigned int shm_atime; |
| 134 |
unsigned int shm_dtime_high; |
| 135 |
unsigned int shm_dtime; |
| 136 |
unsigned int shm_ctime_high; |
| 137 |
unsigned int shm_ctime; |
| 138 |
compat_size_t shm_segsz; |
| 139 |
compat_pid_t shm_cpid; |
| 140 |
compat_pid_t shm_lpid; |
| 141 |
unsigned int shm_nattch; |
| 142 |
unsigned int __unused1; |
| 143 |
unsigned int __unused2; |
| 144 |
}; |
| 145 |
|
| 146 |
#ifdef CONFIG_COMPAT |
| 147 |
static inline int is_compat_task(void) |
| 148 |
{ |
| 149 |
return test_thread_flag(TIF_32BIT); |
| 150 |
} |
| 151 |
|
| 152 |
static inline bool in_compat_syscall(void) |
| 153 |
{ |
| 154 |
/* Vector 0x110 is LINUX_32BIT_SYSCALL_TRAP */ |
| 155 |
return pt_regs_trap_type(current_pt_regs()) == 0x110; |
| 156 |
} |
| 157 |
#define in_compat_syscall in_compat_syscall |
| 158 |
#endif |
| 159 |
|
| 160 |
#endif /* _ASM_SPARC64_COMPAT_H */ |