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