xref: /freebsd/sys/amd64/linux32/linux.h (revision ddc0daea20280c3a06a910b72b14ffe3f624df71)
1 /*-
2  * SPDX-License-Identifier: BSD-3-Clause
3  *
4  * Copyright (c) 2004 Tim J. Robbins
5  * Copyright (c) 2001 Doug Rabson
6  * Copyright (c) 1994-1996 Søren Schmidt
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer
14  *    in this position and unchanged.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. The name of the author may not be used to endorse or promote products
19  *    derived from this software without specific prior written permission
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  * $FreeBSD$
33  */
34 
35 #ifndef _AMD64_LINUX_H_
36 #define	_AMD64_LINUX_H_
37 
38 #include <compat/linux/linux.h>
39 #include <amd64/linux32/linux32_syscall.h>
40 
41 #define	LINUX_LEGACY_SYSCALLS
42 
43 #define	LINUX_DTRACE	linuxulator32
44 
45 #define	LINUX32_MAXUSER		((1ul << 32) - PAGE_SIZE)
46 #define	LINUX32_SHAREDPAGE	(LINUX32_MAXUSER - PAGE_SIZE)
47 #define	LINUX32_USRSTACK	LINUX32_SHAREDPAGE
48 
49 /* XXX 16 = sizeof(linux32_ps_strings) */
50 #define	LINUX32_PS_STRINGS	(LINUX32_USRSTACK - 16)
51 #define	LINUX32_MAXDSIZ		(512 * 1024 * 1024)	/* 512MB */
52 #define	LINUX32_MAXSSIZ		(64 * 1024 * 1024)	/* 64MB */
53 #define	LINUX32_MAXVMEM		0			/* Unlimited */
54 
55 #define	PTRIN(v)	(void *)(uintptr_t)(v)
56 #define	PTROUT(v)	(l_uintptr_t)(uintptr_t)(v)
57 
58 #define	CP(src,dst,fld) do { (dst).fld = (src).fld; } while (0)
59 #define	CP2(src,dst,sfld,dfld) do { (dst).dfld = (src).sfld; } while (0)
60 #define	PTRIN_CP(src,dst,fld) \
61 	do { (dst).fld = PTRIN((src).fld); } while (0)
62 
63 /*
64  * Provide a separate set of types for the Linux types.
65  */
66 typedef int		l_int;
67 typedef int32_t		l_long;
68 typedef int64_t		l_longlong;
69 typedef short		l_short;
70 typedef unsigned int	l_uint;
71 typedef uint32_t	l_ulong;
72 typedef uint64_t	l_ulonglong;
73 typedef unsigned short	l_ushort;
74 
75 typedef l_ulong		l_uintptr_t;
76 typedef l_long		l_clock_t;
77 typedef l_int		l_daddr_t;
78 typedef l_ushort	l_dev_t;
79 typedef l_uint		l_gid_t;
80 typedef l_ushort	l_gid16_t;
81 typedef l_ulong		l_ino_t;
82 typedef l_int		l_key_t;
83 typedef l_longlong	l_loff_t;
84 typedef l_ushort	l_mode_t;
85 typedef l_long		l_off_t;
86 typedef l_int		l_pid_t;
87 typedef l_uint		l_size_t;
88 typedef l_long		l_suseconds_t;
89 typedef l_long		l_time_t;
90 typedef l_uint		l_uid_t;
91 typedef l_ushort	l_uid16_t;
92 typedef l_int		l_timer_t;
93 typedef l_int		l_mqd_t;
94 typedef	l_ulong		l_fd_mask;
95 
96 typedef struct {
97 	l_int		val[2];
98 } __packed l_fsid_t;
99 
100 typedef struct {
101 	l_time_t	tv_sec;
102 	l_suseconds_t	tv_usec;
103 } l_timeval;
104 
105 #define	l_fd_set	fd_set
106 
107 /*
108  * Miscellaneous
109  */
110 #define	LINUX_AT_COUNT		20	/* Count of used aux entry types.
111 					 * Keep this synchronized with
112 					 * linux_fixup_elf() code.
113 					 */
114 struct l___sysctl_args
115 {
116 	l_uintptr_t	name;
117 	l_int		nlen;
118 	l_uintptr_t	oldval;
119 	l_uintptr_t	oldlenp;
120 	l_uintptr_t	newval;
121 	l_size_t	newlen;
122 	l_ulong		__spare[4];
123 } __packed;
124 
125 /* Resource limits */
126 #define	LINUX_RLIMIT_CPU	0
127 #define	LINUX_RLIMIT_FSIZE	1
128 #define	LINUX_RLIMIT_DATA	2
129 #define	LINUX_RLIMIT_STACK	3
130 #define	LINUX_RLIMIT_CORE	4
131 #define	LINUX_RLIMIT_RSS	5
132 #define	LINUX_RLIMIT_NPROC	6
133 #define	LINUX_RLIMIT_NOFILE	7
134 #define	LINUX_RLIMIT_MEMLOCK	8
135 #define	LINUX_RLIMIT_AS		9	/* Address space limit */
136 
137 #define	LINUX_RLIM_NLIMITS	10
138 
139 struct l_rlimit {
140 	l_ulong rlim_cur;
141 	l_ulong rlim_max;
142 } __packed;
143 
144 struct l_rusage {
145 	l_timeval ru_utime;
146 	l_timeval ru_stime;
147 	l_long	ru_maxrss;
148 	l_long	ru_ixrss;
149 	l_long	ru_idrss;
150 	l_long	ru_isrss;
151 	l_long	ru_minflt;
152 	l_long	ru_majflt;
153 	l_long	ru_nswap;
154 	l_long	ru_inblock;
155 	l_long	ru_oublock;
156 	l_long	ru_msgsnd;
157 	l_long	ru_msgrcv;
158 	l_long	ru_nsignals;
159 	l_long	ru_nvcsw;
160 	l_long	ru_nivcsw;
161 } __packed;
162 
163 struct l_mmap_argv {
164 	l_uintptr_t	addr;
165 	l_size_t	len;
166 	l_int		prot;
167 	l_int		flags;
168 	l_int		fd;
169 	l_ulong		pgoff;
170 };
171 
172 /*
173  * stat family of syscalls
174  */
175 struct l_timespec {
176 	l_time_t	tv_sec;
177 	l_long		tv_nsec;
178 } __packed;
179 
180 struct l_newstat {
181 	l_ushort	st_dev;
182 	l_ushort	__pad1;
183 	l_ulong		st_ino;
184 	l_ushort	st_mode;
185 	l_ushort	st_nlink;
186 	l_ushort	st_uid;
187 	l_ushort	st_gid;
188 	l_ushort	st_rdev;
189 	l_ushort	__pad2;
190 	l_ulong		st_size;
191 	l_ulong		st_blksize;
192 	l_ulong		st_blocks;
193 	struct l_timespec	st_atim;
194 	struct l_timespec	st_mtim;
195 	struct l_timespec	st_ctim;
196 	l_ulong		__unused4;
197 	l_ulong		__unused5;
198 } __packed;
199 
200 struct l_stat {
201 	l_ushort	st_dev;
202 	l_ulong		st_ino;
203 	l_ushort	st_mode;
204 	l_ushort	st_nlink;
205 	l_ushort	st_uid;
206 	l_ushort	st_gid;
207 	l_ushort	st_rdev;
208 	l_long		st_size;
209 	struct l_timespec	st_atim;
210 	struct l_timespec	st_mtim;
211 	struct l_timespec	st_ctim;
212 	l_long		st_blksize;
213 	l_long		st_blocks;
214 	l_ulong		st_flags;
215 	l_ulong		st_gen;
216 };
217 
218 struct l_stat64 {
219 	l_ushort	st_dev;
220 	u_char		__pad0[10];
221 	l_ulong		__st_ino;
222 	l_uint		st_mode;
223 	l_uint		st_nlink;
224 	l_ulong		st_uid;
225 	l_ulong		st_gid;
226 	l_ushort	st_rdev;
227 	u_char		__pad3[10];
228 	l_longlong	st_size;
229 	l_ulong		st_blksize;
230 	l_ulong		st_blocks;
231 	l_ulong		__pad4;
232 	struct l_timespec	st_atim;
233 	struct l_timespec	st_mtim;
234 	struct l_timespec	st_ctim;
235 	l_ulonglong	st_ino;
236 } __packed;
237 
238 struct l_statfs64 {
239 	l_int		f_type;
240 	l_int		f_bsize;
241 	uint64_t	f_blocks;
242 	uint64_t	f_bfree;
243 	uint64_t	f_bavail;
244 	uint64_t	f_files;
245 	uint64_t	f_ffree;
246 	l_fsid_t	f_fsid;
247 	l_int		f_namelen;
248 	l_int		f_frsize;
249 	l_int		f_flags;
250 	l_int		f_spare[4];
251 } __packed;
252 
253 /* sigaction flags */
254 #define	LINUX_SA_NOCLDSTOP	0x00000001
255 #define	LINUX_SA_NOCLDWAIT	0x00000002
256 #define	LINUX_SA_SIGINFO	0x00000004
257 #define	LINUX_SA_RESTORER	0x04000000
258 #define	LINUX_SA_ONSTACK	0x08000000
259 #define	LINUX_SA_RESTART	0x10000000
260 #define	LINUX_SA_INTERRUPT	0x20000000
261 #define	LINUX_SA_NOMASK		0x40000000
262 #define	LINUX_SA_ONESHOT	0x80000000
263 
264 /* sigprocmask actions */
265 #define	LINUX_SIG_BLOCK		0
266 #define	LINUX_SIG_UNBLOCK	1
267 #define	LINUX_SIG_SETMASK	2
268 
269 /* sigaltstack */
270 #define	LINUX_MINSIGSTKSZ	2048
271 
272 typedef l_uintptr_t l_handler_t;
273 typedef l_ulong	l_osigset_t;
274 
275 typedef struct {
276 	l_handler_t	lsa_handler;
277 	l_osigset_t	lsa_mask;
278 	l_ulong		lsa_flags;
279 	l_uintptr_t	lsa_restorer;
280 } __packed l_osigaction_t;
281 
282 typedef struct {
283 	l_handler_t	lsa_handler;
284 	l_ulong		lsa_flags;
285 	l_uintptr_t	lsa_restorer;
286 	l_sigset_t	lsa_mask;
287 } __packed l_sigaction_t;
288 
289 typedef struct {
290 	l_uintptr_t	ss_sp;
291 	l_int		ss_flags;
292 	l_size_t	ss_size;
293 } __packed l_stack_t;
294 
295 /* The Linux sigcontext, pretty much a standard 386 trapframe. */
296 struct l_sigcontext {
297 	l_uint		sc_gs;
298 	l_uint		sc_fs;
299 	l_uint		sc_es;
300 	l_uint		sc_ds;
301 	l_uint		sc_edi;
302 	l_uint		sc_esi;
303 	l_uint		sc_ebp;
304 	l_uint		sc_esp;
305 	l_uint		sc_ebx;
306 	l_uint		sc_edx;
307 	l_uint		sc_ecx;
308 	l_uint		sc_eax;
309 	l_uint		sc_trapno;
310 	l_uint		sc_err;
311 	l_uint		sc_eip;
312 	l_uint		sc_cs;
313 	l_uint		sc_eflags;
314 	l_uint		sc_esp_at_signal;
315 	l_uint		sc_ss;
316 	l_uint		sc_387;
317 	l_uint		sc_mask;
318 	l_uint		sc_cr2;
319 } __packed;
320 
321 struct l_ucontext {
322 	l_ulong		uc_flags;
323 	l_uintptr_t	uc_link;
324 	l_stack_t	uc_stack;
325 	struct l_sigcontext	uc_mcontext;
326 	l_sigset_t	uc_sigmask;
327 } __packed;
328 
329 #define	LINUX_SI_MAX_SIZE	128
330 #define	LINUX_SI_PAD_SIZE	((LINUX_SI_MAX_SIZE/sizeof(l_int)) - 3)
331 
332 typedef union l_sigval {
333 	l_int		sival_int;
334 	l_uintptr_t	sival_ptr;
335 } l_sigval_t;
336 
337 typedef struct l_siginfo {
338 	l_int		lsi_signo;
339 	l_int		lsi_errno;
340 	l_int		lsi_code;
341 	union {
342 		l_int	_pad[LINUX_SI_PAD_SIZE];
343 
344 		struct {
345 			l_pid_t		_pid;
346 			l_uid_t		_uid;
347 		} __packed _kill;
348 
349 		struct {
350 			l_timer_t	_tid;
351 			l_int		_overrun;
352 			char		_pad[sizeof(l_uid_t) - sizeof(l_int)];
353 			l_sigval_t	_sigval;
354 			l_int		_sys_private;
355 		} __packed _timer;
356 
357 		struct {
358 			l_pid_t		_pid;		/* sender's pid */
359 			l_uid_t		_uid;		/* sender's uid */
360 			l_sigval_t	_sigval;
361 		} __packed _rt;
362 
363 		struct {
364 			l_pid_t		_pid;		/* which child */
365 			l_uid_t		_uid;		/* sender's uid */
366 			l_int		_status;	/* exit code */
367 			l_clock_t	_utime;
368 			l_clock_t	_stime;
369 		} __packed _sigchld;
370 
371 		struct {
372 			l_uintptr_t	_addr;	/* Faulting insn/memory ref. */
373 		} __packed _sigfault;
374 
375 		struct {
376 			l_long		_band;	/* POLL_IN,POLL_OUT,POLL_MSG */
377 			l_int		_fd;
378 		} __packed _sigpoll;
379 	} _sifields;
380 } __packed l_siginfo_t;
381 
382 #define	lsi_pid		_sifields._kill._pid
383 #define	lsi_uid		_sifields._kill._uid
384 #define	lsi_tid		_sifields._timer._tid
385 #define	lsi_overrun	_sifields._timer._overrun
386 #define	lsi_sys_private	_sifields._timer._sys_private
387 #define	lsi_status	_sifields._sigchld._status
388 #define	lsi_utime	_sifields._sigchld._utime
389 #define	lsi_stime	_sifields._sigchld._stime
390 #define	lsi_value	_sifields._rt._sigval
391 #define	lsi_int		_sifields._rt._sigval.sival_int
392 #define	lsi_ptr		_sifields._rt._sigval.sival_ptr
393 #define	lsi_addr	_sifields._sigfault._addr
394 #define	lsi_band	_sifields._sigpoll._band
395 #define	lsi_fd		_sifields._sigpoll._fd
396 
397 struct l_fpreg {
398 	u_int16_t	significand[4];
399 	u_int16_t	exponent;
400 } __packed;
401 
402 struct l_fpxreg {
403 	u_int16_t	significand[4];
404 	u_int16_t	exponent;
405 	u_int16_t	padding[3];
406 } __packed;
407 
408 struct l_xmmreg {
409 	u_int32_t	element[4];
410 } __packed;
411 
412 struct l_fpstate {
413 	/* Regular FPU environment */
414 	u_int32_t		cw;
415 	u_int32_t		sw;
416 	u_int32_t		tag;
417 	u_int32_t		ipoff;
418 	u_int32_t		cssel;
419 	u_int32_t		dataoff;
420 	u_int32_t		datasel;
421 	struct l_fpreg		_st[8];
422 	u_int16_t		status;
423 	u_int16_t		magic;		/* 0xffff = regular FPU data */
424 
425 	/* FXSR FPU environment */
426 	u_int32_t		_fxsr_env[6];	/* env is ignored. */
427 	u_int32_t		mxcsr;
428 	u_int32_t		reserved;
429 	struct l_fpxreg		_fxsr_st[8];	/* reg data is ignored. */
430 	struct l_xmmreg		_xmm[8];
431 	u_int32_t		padding[56];
432 } __packed;
433 
434 /*
435  * We make the stack look like Linux expects it when calling a signal
436  * handler, but use the BSD way of calling the handler and sigreturn().
437  * This means that we need to pass the pointer to the handler too.
438  * It is appended to the frame to not interfere with the rest of it.
439  */
440 struct l_sigframe {
441 	l_int			sf_sig;
442 	struct l_sigcontext	sf_sc;
443 	struct l_fpstate	sf_fpstate;
444 	l_uint			sf_extramask[1];
445 	l_handler_t		sf_handler;
446 } __packed;
447 
448 struct l_rt_sigframe {
449 	l_int			sf_sig;
450 	l_uintptr_t		sf_siginfo;
451 	l_uintptr_t		sf_ucontext;
452 	l_siginfo_t		sf_si;
453 	struct l_ucontext	sf_sc;
454 	l_handler_t		sf_handler;
455 } __packed;
456 
457 /*
458  * arch specific open/fcntl flags
459  */
460 #define	LINUX_F_GETLK64		12
461 #define	LINUX_F_SETLK64		13
462 #define	LINUX_F_SETLKW64	14
463 
464 union l_semun {
465 	l_int		val;
466 	l_uintptr_t	buf;
467 	l_uintptr_t	array;
468 	l_uintptr_t	__buf;
469 	l_uintptr_t	__pad;
470 } __packed;
471 
472 struct l_ifmap {
473 	l_ulong		mem_start;
474 	l_ulong		mem_end;
475 	l_ushort	base_addr;
476 	u_char		irq;
477 	u_char		dma;
478 	u_char		port;
479 } __packed;
480 
481 struct l_ifreq {
482 	union {
483 		char	ifrn_name[LINUX_IFNAMSIZ];
484 	} ifr_ifrn;
485 
486 	union {
487 		struct l_sockaddr	ifru_addr;
488 		struct l_sockaddr	ifru_dstaddr;
489 		struct l_sockaddr	ifru_broadaddr;
490 		struct l_sockaddr	ifru_netmask;
491 		struct l_sockaddr	ifru_hwaddr;
492 		l_short		ifru_flags[1];
493 		l_int		ifru_ivalue;
494 		l_int		ifru_mtu;
495 		struct l_ifmap	ifru_map;
496 		char		ifru_slave[LINUX_IFNAMSIZ];
497 		l_uintptr_t	ifru_data;
498 	} ifr_ifru;
499 } __packed;
500 
501 #define	ifr_name	ifr_ifrn.ifrn_name	/* Interface name */
502 #define	ifr_hwaddr	ifr_ifru.ifru_hwaddr	/* MAC address */
503 #define	ifr_ifindex	ifr_ifru.ifru_ivalue	/* Interface index */
504 
505 struct l_ifconf {
506 	int	ifc_len;
507 	union {
508 		l_uintptr_t	ifcu_buf;
509 		l_uintptr_t	ifcu_req;
510 	} ifc_ifcu;
511 } __packed;
512 
513 #define	ifc_buf		ifc_ifcu.ifcu_buf
514 #define	ifc_req		ifc_ifcu.ifcu_req
515 
516 /*
517  * poll()
518  */
519 #define	LINUX_POLLIN		0x0001
520 #define	LINUX_POLLPRI		0x0002
521 #define	LINUX_POLLOUT		0x0004
522 #define	LINUX_POLLERR		0x0008
523 #define	LINUX_POLLHUP		0x0010
524 #define	LINUX_POLLNVAL		0x0020
525 #define	LINUX_POLLRDNORM	0x0040
526 #define	LINUX_POLLRDBAND	0x0080
527 #define	LINUX_POLLWRNORM	0x0100
528 #define	LINUX_POLLWRBAND	0x0200
529 #define	LINUX_POLLMSG		0x0400
530 
531 struct l_pollfd {
532 	l_int		fd;
533 	l_short		events;
534 	l_short		revents;
535 } __packed;
536 
537 struct l_user_desc {
538 	l_uint		entry_number;
539 	l_uint		base_addr;
540 	l_uint		limit;
541 	l_uint		seg_32bit:1;
542 	l_uint		contents:2;
543 	l_uint		read_exec_only:1;
544 	l_uint		limit_in_pages:1;
545 	l_uint		seg_not_present:1;
546 	l_uint		useable:1;
547 };
548 
549 #define	LINUX_LOWERWORD	0x0000ffff
550 
551 /*
552  * Macros which does the same thing as those in Linux include/asm-um/ldt-i386.h.
553  * These convert Linux user space descriptor to machine one.
554  */
555 #define	LINUX_LDT_entry_a(info)					\
556 	((((info)->base_addr & LINUX_LOWERWORD) << 16) |	\
557 	((info)->limit & LINUX_LOWERWORD))
558 
559 #define	LINUX_ENTRY_B_READ_EXEC_ONLY	9
560 #define	LINUX_ENTRY_B_CONTENTS		10
561 #define	LINUX_ENTRY_B_SEG_NOT_PRESENT	15
562 #define	LINUX_ENTRY_B_BASE_ADDR		16
563 #define	LINUX_ENTRY_B_USEABLE		20
564 #define	LINUX_ENTRY_B_SEG32BIT		22
565 #define	LINUX_ENTRY_B_LIMIT		23
566 
567 #define	LINUX_LDT_entry_b(info)							\
568 	(((info)->base_addr & 0xff000000) |					\
569 	((info)->limit & 0xf0000) |						\
570 	((info)->contents << LINUX_ENTRY_B_CONTENTS) |				\
571 	(((info)->seg_not_present == 0) << LINUX_ENTRY_B_SEG_NOT_PRESENT) |	\
572 	(((info)->base_addr & 0x00ff0000) >> LINUX_ENTRY_B_BASE_ADDR) |		\
573 	(((info)->read_exec_only == 0) << LINUX_ENTRY_B_READ_EXEC_ONLY) |	\
574 	((info)->seg_32bit << LINUX_ENTRY_B_SEG32BIT) |				\
575 	((info)->useable << LINUX_ENTRY_B_USEABLE) |				\
576 	((info)->limit_in_pages << LINUX_ENTRY_B_LIMIT) | 0x7000)
577 
578 #define	LINUX_LDT_empty(info)		\
579 	((info)->base_addr == 0 &&	\
580 	(info)->limit == 0 &&		\
581 	(info)->contents == 0 &&	\
582 	(info)->seg_not_present == 1 &&	\
583 	(info)->read_exec_only == 1 &&	\
584 	(info)->seg_32bit == 0 &&	\
585 	(info)->limit_in_pages == 0 &&	\
586 	(info)->useable == 0)
587 
588 /*
589  * Macros for converting segments.
590  * They do the same as those in arch/i386/kernel/process.c in Linux.
591  */
592 #define	LINUX_GET_BASE(desc)				\
593 	((((desc)->a >> 16) & LINUX_LOWERWORD) |	\
594 	(((desc)->b << 16) & 0x00ff0000) |		\
595 	((desc)->b & 0xff000000))
596 
597 #define	LINUX_GET_LIMIT(desc)			\
598 	(((desc)->a & LINUX_LOWERWORD) |	\
599 	((desc)->b & 0xf0000))
600 
601 #define	LINUX_GET_32BIT(desc)		\
602 	(((desc)->b >> LINUX_ENTRY_B_SEG32BIT) & 1)
603 #define	LINUX_GET_CONTENTS(desc)	\
604 	(((desc)->b >> LINUX_ENTRY_B_CONTENTS) & 3)
605 #define	LINUX_GET_WRITABLE(desc)	\
606 	(((desc)->b >> LINUX_ENTRY_B_READ_EXEC_ONLY) & 1)
607 #define	LINUX_GET_LIMIT_PAGES(desc)	\
608 	(((desc)->b >> LINUX_ENTRY_B_LIMIT) & 1)
609 #define	LINUX_GET_PRESENT(desc)		\
610 	(((desc)->b >> LINUX_ENTRY_B_SEG_NOT_PRESENT) & 1)
611 #define	LINUX_GET_USEABLE(desc)		\
612 	(((desc)->b >> LINUX_ENTRY_B_USEABLE) & 1)
613 
614 struct iovec;
615 struct uio;
616 
617 struct l_iovec32 {
618 	uint32_t	iov_base;
619 	l_size_t	iov_len;
620 };
621 
622 int linux32_copyiniov(struct l_iovec32 *iovp32, l_ulong iovcnt,
623 			    struct iovec **iovp, int error);
624 int linux32_copyinuio(struct l_iovec32 *iovp, l_ulong iovcnt,
625 			    struct uio **uiop);
626 int linux_copyout_rusage(struct rusage *ru, void *uaddr);
627 
628 /* robust futexes */
629 struct linux_robust_list {
630 	l_uintptr_t			next;
631 };
632 
633 struct linux_robust_list_head {
634 	struct linux_robust_list	list;
635 	l_long				futex_offset;
636 	l_uintptr_t			pending_list;
637 };
638 
639 #endif /* !_AMD64_LINUX_H_ */
640