1#ifndef _ASM_X86_64_IA32_H
2#define _ASM_X86_64_IA32_H
3
4#include <linux/config.h>
5
6#ifdef CONFIG_IA32_EMULATION
7
8/*
9 * 32 bit structures for IA32 support.
10 */
11
12/* 32bit compatibility types */
13typedef unsigned int	       __kernel_size_t32;
14typedef int		       __kernel_ssize_t32;
15typedef int		       __kernel_ptrdiff_t32;
16typedef int		       __kernel_time_t32;
17typedef int		       __kernel_clock_t32;
18typedef int		       __kernel_pid_t32;
19typedef unsigned short	       __kernel_ipc_pid_t32;
20typedef unsigned short	       __kernel_uid_t32;
21typedef unsigned 	       __kernel_uid32_t32;
22typedef unsigned short	       __kernel_gid_t32;
23typedef unsigned 	       __kernel_gid32_t32;
24typedef unsigned short	       __kernel_dev_t32;
25typedef unsigned int	       __kernel_ino_t32;
26typedef unsigned short	       __kernel_mode_t32;
27typedef unsigned short	       __kernel_umode_t32;
28typedef short		       __kernel_nlink_t32;
29typedef int		       __kernel_daddr_t32;
30typedef int		       __kernel_off_t32;
31typedef unsigned int	       __kernel_caddr_t32;
32typedef long		       __kernel_loff_t32;
33typedef __kernel_fsid_t	       __kernel_fsid_t32;
34
35
36/* fcntl.h */
37struct flock32 {
38       short l_type;
39       short l_whence;
40       __kernel_off_t32 l_start;
41       __kernel_off_t32 l_len;
42       __kernel_pid_t32 l_pid;
43};
44
45
46struct ia32_flock64 {
47	short  l_type;
48	short  l_whence;
49	loff_t l_start;  /* unnatural alignment */
50	loff_t l_len;
51	pid_t  l_pid;
52} __attribute__((packed));
53
54#define F_GETLK64	12	/*  using 'struct flock64' */
55#define F_SETLK64	13
56#define F_SETLKW64	14
57
58#include <asm/sigcontext32.h>
59
60/* signal.h */
61#define _IA32_NSIG	       64
62#define _IA32_NSIG_BPW	       32
63#define _IA32_NSIG_WORDS	       (_IA32_NSIG / _IA32_NSIG_BPW)
64
65typedef struct {
66       unsigned int sig[_IA32_NSIG_WORDS];
67} sigset32_t;
68
69struct sigaction32 {
70       unsigned int  sa_handler;	/* Really a pointer, but need to deal
71					     with 32 bits */
72       unsigned int sa_flags;
73       unsigned int sa_restorer;	/* Another 32 bit pointer */
74       sigset32_t sa_mask;		/* A 32 bit mask */
75};
76
77typedef unsigned int old_sigset32_t;	/* at least 32 bits */
78
79struct old_sigaction32 {
80       unsigned int  sa_handler;	/* Really a pointer, but need to deal
81					     with 32 bits */
82       old_sigset32_t sa_mask;		/* A 32 bit mask */
83       unsigned int sa_flags;
84       unsigned int sa_restorer;	/* Another 32 bit pointer */
85};
86
87typedef struct sigaltstack_ia32 {
88	unsigned int	ss_sp;
89	int		ss_flags;
90	unsigned int	ss_size;
91} stack_ia32_t;
92
93struct ucontext_ia32 {
94	unsigned int	  uc_flags;
95	unsigned int 	  uc_link;
96	stack_ia32_t	  uc_stack;
97	struct sigcontext_ia32 uc_mcontext;
98	sigset32_t	  uc_sigmask;	/* mask last for extensibility */
99};
100
101struct stat32 {
102       unsigned short st_dev;
103       unsigned short __pad1;
104       unsigned int st_ino;
105       unsigned short st_mode;
106       unsigned short st_nlink;
107       unsigned short st_uid;
108       unsigned short st_gid;
109       unsigned short st_rdev;
110       unsigned short __pad2;
111       unsigned int  st_size;
112       unsigned int  st_blksize;
113       unsigned int  st_blocks;
114       unsigned int  st_atime;
115       unsigned int  __unused1;
116       unsigned int  st_mtime;
117       unsigned int  __unused2;
118       unsigned int  st_ctime;
119       unsigned int  __unused3;
120       unsigned int  __unused4;
121       unsigned int  __unused5;
122};
123
124
125/* This matches struct stat64 in glibc2.2, hence the absolutely
126 * insane amounts of padding around dev_t's.
127 */
128struct stat64 {
129	unsigned long long	st_dev;
130	unsigned char		__pad0[4];
131
132#define STAT64_HAS_BROKEN_ST_INO	1
133	unsigned int		__st_ino;
134
135	unsigned int		st_mode;
136	unsigned int		st_nlink;
137
138	unsigned int		st_uid;
139	unsigned int		st_gid;
140
141	unsigned long long	st_rdev;
142	unsigned char		__pad3[4];
143
144	long long		st_size;
145	unsigned int		st_blksize;
146
147	long long		st_blocks;/* Number 512-byte blocks allocated. */
148
149	unsigned long long	st_atime;
150	unsigned long long	st_mtime;
151	unsigned long long	st_ctime;
152
153	unsigned long long	st_ino;
154} __attribute__((packed));
155
156
157struct statfs32 {
158       int f_type;
159       int f_bsize;
160       int f_blocks;
161       int f_bfree;
162       int f_bavail;
163       int f_files;
164       int f_ffree;
165       __kernel_fsid_t32 f_fsid;
166       int f_namelen;  /* SunOS ignores this field. */
167       int f_spare[6];
168};
169
170typedef union sigval32 {
171	int sival_int;
172	unsigned int sival_ptr;
173} sigval_t32;
174
175typedef struct siginfo32 {
176	int si_signo;
177	int si_errno;
178	int si_code;
179
180	union {
181		int _pad[((128/sizeof(int)) - 3)];
182
183		/* kill() */
184		struct {
185			unsigned int _pid;	/* sender's pid */
186			unsigned int _uid;	/* sender's uid */
187		} _kill;
188
189		/* POSIX.1b timers */
190		struct {
191			unsigned int _timer1;
192			unsigned int _timer2;
193		} _timer;
194
195		/* POSIX.1b signals */
196		struct {
197			unsigned int _pid;	/* sender's pid */
198			unsigned int _uid;	/* sender's uid */
199			sigval_t32 _sigval;
200		} _rt;
201
202		/* SIGCHLD */
203		struct {
204			unsigned int _pid;	/* which child */
205			unsigned int _uid;	/* sender's uid */
206			int _status;		/* exit code */
207			__kernel_clock_t32 _utime;
208			__kernel_clock_t32 _stime;
209		} _sigchld;
210
211		/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
212		struct {
213			unsigned int _addr;	/* faulting insn/memory ref. */
214		} _sigfault;
215
216		/* SIGPOLL */
217		struct {
218			int _band;	/* POLL_IN, POLL_OUT, POLL_MSG */
219			int _fd;
220		} _sigpoll;
221	} _sifields;
222} siginfo_t32;
223
224
225struct ustat32 {
226	__u32	f_tfree;
227	__kernel_ino_t32		f_tinode;
228	char			f_fname[6];
229	char			f_fpack[6];
230};
231
232struct iovec32 {
233	unsigned int iov_base;
234	int iov_len;
235};
236
237
238#ifdef __KERNEL__
239struct iovec *get_iovec32(struct iovec32 *iov32, struct iovec *iov_buf, u32 count, int type);
240#endif
241
242
243#endif /* !CONFIG_IA32_SUPPORT */
244
245#endif
246