Path: blob/master/arch/powerpc/include/asm/compat.h
15117 views
#ifndef _ASM_POWERPC_COMPAT_H1#define _ASM_POWERPC_COMPAT_H2#ifdef __KERNEL__3/*4* Architecture specific compatibility types5*/6#include <linux/types.h>7#include <linux/sched.h>89#define COMPAT_USER_HZ 10010#define COMPAT_UTS_MACHINE "ppc\0\0"1112typedef u32 compat_size_t;13typedef s32 compat_ssize_t;14typedef s32 compat_time_t;15typedef s32 compat_clock_t;16typedef s32 compat_pid_t;17typedef u32 __compat_uid_t;18typedef u32 __compat_gid_t;19typedef u32 __compat_uid32_t;20typedef u32 __compat_gid32_t;21typedef u32 compat_mode_t;22typedef u32 compat_ino_t;23typedef u32 compat_dev_t;24typedef s32 compat_off_t;25typedef s64 compat_loff_t;26typedef s16 compat_nlink_t;27typedef u16 compat_ipc_pid_t;28typedef s32 compat_daddr_t;29typedef u32 compat_caddr_t;30typedef __kernel_fsid_t compat_fsid_t;31typedef s32 compat_key_t;32typedef s32 compat_timer_t;3334typedef s32 compat_int_t;35typedef s32 compat_long_t;36typedef s64 compat_s64;37typedef u32 compat_uint_t;38typedef u32 compat_ulong_t;39typedef u64 compat_u64;4041struct compat_timespec {42compat_time_t tv_sec;43s32 tv_nsec;44};4546struct compat_timeval {47compat_time_t tv_sec;48s32 tv_usec;49};5051struct compat_stat {52compat_dev_t st_dev;53compat_ino_t st_ino;54compat_mode_t st_mode;55compat_nlink_t st_nlink;56__compat_uid32_t st_uid;57__compat_gid32_t st_gid;58compat_dev_t st_rdev;59compat_off_t st_size;60compat_off_t st_blksize;61compat_off_t st_blocks;62compat_time_t st_atime;63u32 st_atime_nsec;64compat_time_t st_mtime;65u32 st_mtime_nsec;66compat_time_t st_ctime;67u32 st_ctime_nsec;68u32 __unused4[2];69};7071struct compat_flock {72short l_type;73short l_whence;74compat_off_t l_start;75compat_off_t l_len;76compat_pid_t l_pid;77};7879#define F_GETLK64 12 /* using 'struct flock64' */80#define F_SETLK64 1381#define F_SETLKW64 148283struct compat_flock64 {84short l_type;85short l_whence;86compat_loff_t l_start;87compat_loff_t l_len;88compat_pid_t l_pid;89};9091struct compat_statfs {92int f_type;93int f_bsize;94int f_blocks;95int f_bfree;96int f_bavail;97int f_files;98int f_ffree;99compat_fsid_t f_fsid;100int f_namelen; /* SunOS ignores this field. */101int f_frsize;102int f_spare[5];103};104105#define COMPAT_RLIM_OLD_INFINITY 0x7fffffff106#define COMPAT_RLIM_INFINITY 0xffffffff107108typedef u32 compat_old_sigset_t;109110#define _COMPAT_NSIG 64111#define _COMPAT_NSIG_BPW 32112113typedef u32 compat_sigset_word;114115#define COMPAT_OFF_T_MAX 0x7fffffff116#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL117118/*119* A pointer passed in from user mode. This should not120* be used for syscall parameters, just declare them121* as pointers because the syscall entry code will have122* appropriately converted them already.123*/124typedef u32 compat_uptr_t;125126static inline void __user *compat_ptr(compat_uptr_t uptr)127{128return (void __user *)(unsigned long)uptr;129}130131static inline compat_uptr_t ptr_to_compat(void __user *uptr)132{133return (u32)(unsigned long)uptr;134}135136static inline void __user *arch_compat_alloc_user_space(long len)137{138struct pt_regs *regs = current->thread.regs;139unsigned long usp = regs->gpr[1];140141/*142* We can't access below the stack pointer in the 32bit ABI and143* can access 288 bytes in the 64bit ABI144*/145if (!is_32bit_task())146usp -= 288;147148return (void __user *) (usp - len);149}150151/*152* ipc64_perm is actually 32/64bit clean but since the compat layer refers to153* it we may as well define it.154*/155struct compat_ipc64_perm {156compat_key_t key;157__compat_uid_t uid;158__compat_gid_t gid;159__compat_uid_t cuid;160__compat_gid_t cgid;161compat_mode_t mode;162unsigned int seq;163unsigned int __pad2;164unsigned long __unused1; /* yes they really are 64bit pads */165unsigned long __unused2;166};167168struct compat_semid64_ds {169struct compat_ipc64_perm sem_perm;170unsigned int __unused1;171compat_time_t sem_otime;172unsigned int __unused2;173compat_time_t sem_ctime;174compat_ulong_t sem_nsems;175compat_ulong_t __unused3;176compat_ulong_t __unused4;177};178179struct compat_msqid64_ds {180struct compat_ipc64_perm msg_perm;181unsigned int __unused1;182compat_time_t msg_stime;183unsigned int __unused2;184compat_time_t msg_rtime;185unsigned int __unused3;186compat_time_t msg_ctime;187compat_ulong_t msg_cbytes;188compat_ulong_t msg_qnum;189compat_ulong_t msg_qbytes;190compat_pid_t msg_lspid;191compat_pid_t msg_lrpid;192compat_ulong_t __unused4;193compat_ulong_t __unused5;194};195196struct compat_shmid64_ds {197struct compat_ipc64_perm shm_perm;198unsigned int __unused1;199compat_time_t shm_atime;200unsigned int __unused2;201compat_time_t shm_dtime;202unsigned int __unused3;203compat_time_t shm_ctime;204unsigned int __unused4;205compat_size_t shm_segsz;206compat_pid_t shm_cpid;207compat_pid_t shm_lpid;208compat_ulong_t shm_nattch;209compat_ulong_t __unused5;210compat_ulong_t __unused6;211};212213static inline int is_compat_task(void)214{215return is_32bit_task();216}217218#endif /* __KERNEL__ */219#endif /* _ASM_POWERPC_COMPAT_H */220221222