2 * Copyright (c) 1994-1996 Søren Schmidt
3 * Copyright (c) 2013 Dmitry Chagin
4 * Copyright (c) 2018 Turing Robotic Industries Inc.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 #ifndef _ARM64_LINUX_H_
32 #define _ARM64_LINUX_H_
34 #include <sys/abi_compat.h>
36 #include <compat/linux/linux.h>
37 #include <arm64/linux/linux_syscall.h>
39 /* Debugging support */
41 extern u_char linux_debug_map[];
42 #define ldebug(name) isclr(linux_debug_map, LINUX_SYS_linux_ ## name)
43 #define ARGS(nm, fmt) "linux(%ld/%ld): "#nm"("fmt")\n", \
44 (long)td->td_proc->p_pid, (long)td->td_tid
45 #define LMSG(fmt) "linux(%ld/%ld): "fmt"\n", \
46 (long)td->td_proc->p_pid, (long)td->td_tid
47 #define LINUX_DTRACE linuxulator
49 /* Provide a separate set of types for the Linux types */
50 typedef int32_t l_int;
51 typedef int64_t l_long;
52 typedef int16_t l_short;
53 typedef uint32_t l_uint;
54 typedef uint64_t l_ulong;
55 typedef uint16_t l_ushort;
57 typedef l_ulong l_uintptr_t;
58 typedef l_long l_clock_t;
59 typedef l_int l_daddr_t;
60 typedef l_ulong l_dev_t;
61 typedef l_uint l_gid_t;
62 typedef l_ushort l_gid16_t; /* XXX */
63 typedef l_uint l_uid_t;
64 typedef l_ushort l_uid16_t; /* XXX */
65 typedef l_ulong l_ino_t;
66 typedef l_int l_key_t;
67 typedef l_long l_loff_t;
68 typedef l_uint l_mode_t;
69 typedef l_long l_off_t;
70 typedef l_int l_pid_t;
71 typedef l_ulong l_size_t;
72 typedef l_long l_suseconds_t;
73 typedef l_long l_time_t;
74 typedef l_int l_timer_t; /* XXX */
75 typedef l_ulong l_fd_mask;
83 l_suseconds_t tv_usec;
86 #define l_fd_set fd_set
89 #define LINUX_AT_COUNT 20
91 struct l___sysctl_args
102 /* Resource limits */
103 #define LINUX_RLIMIT_CPU 0
104 #define LINUX_RLIMIT_FSIZE 1
105 #define LINUX_RLIMIT_DATA 2
106 #define LINUX_RLIMIT_STACK 3
107 #define LINUX_RLIMIT_CORE 4
108 #define LINUX_RLIMIT_RSS 5
109 #define LINUX_RLIMIT_NPROC 6
110 #define LINUX_RLIMIT_NOFILE 7
111 #define LINUX_RLIMIT_MEMLOCK 8
112 #define LINUX_RLIMIT_AS 9 /* Address space limit */
114 #define LINUX_RLIM_NLIMITS 10
121 /* stat family of syscalls */
143 struct l_timespec st_atim;
144 struct l_timespec st_mtim;
145 struct l_timespec st_ctim;
150 /* sigaction flags */
151 #define LINUX_SA_NOCLDSTOP 0x00000001
152 #define LINUX_SA_NOCLDWAIT 0x00000002
153 #define LINUX_SA_SIGINFO 0x00000004
154 #define LINUX_SA_RESTORER 0x04000000
155 #define LINUX_SA_ONSTACK 0x08000000
156 #define LINUX_SA_RESTART 0x10000000
157 #define LINUX_SA_INTERRUPT 0x20000000 /* XXX */
158 #define LINUX_SA_NOMASK 0x40000000 /* SA_NODEFER */
159 #define LINUX_SA_ONESHOT 0x80000000 /* SA_RESETHAND */
161 /* sigprocmask actions */
162 #define LINUX_SIG_BLOCK 0
163 #define LINUX_SIG_UNBLOCK 1
164 #define LINUX_SIG_SETMASK 2
167 #define LINUX_MINSIGSTKSZ 2048 /* XXX */
169 typedef void (*l_handler_t)(l_int);
172 l_handler_t lsa_handler;
175 l_uintptr_t lsa_restorer;
176 } l_sigaction_t; /* XXX */
184 #define LINUX_SI_PREAMBLE_SIZE (4 * sizeof(int))
185 #define LINUX_SI_MAX_SIZE 128
186 #define LINUX_SI_PAD_SIZE ((LINUX_SI_MAX_SIZE - \
187 LINUX_SI_PREAMBLE_SIZE) / sizeof(l_int))
188 typedef union l_sigval {
190 l_uintptr_t sival_ptr;
193 typedef struct l_siginfo {
198 l_int _pad[LINUX_SI_PAD_SIZE];
208 char _pad[sizeof(l_uid_t) - sizeof(int)];
209 union l_sigval _sigval;
214 l_pid_t _pid; /* sender's pid */
215 l_uid_t _uid; /* sender's uid */
216 union l_sigval _sigval;
220 l_pid_t _pid; /* which child */
221 l_uid_t _uid; /* sender's uid */
222 l_int _status; /* exit code */
228 l_uintptr_t _addr; /* Faulting insn/memory ref. */
232 l_long _band; /* POLL_IN,POLL_OUT,POLL_MSG */
238 #define lsi_pid _sifields._kill._pid
239 #define lsi_uid _sifields._kill._uid
240 #define lsi_tid _sifields._timer._tid
241 #define lsi_overrun _sifields._timer._overrun
242 #define lsi_sys_private _sifields._timer._sys_private
243 #define lsi_status _sifields._sigchld._status
244 #define lsi_utime _sifields._sigchld._utime
245 #define lsi_stime _sifields._sigchld._stime
246 #define lsi_value _sifields._rt._sigval
247 #define lsi_int _sifields._rt._sigval.sival_int
248 #define lsi_ptr _sifields._rt._sigval.sival_ptr
249 #define lsi_addr _sifields._sigfault._addr
250 #define lsi_band _sifields._sigpoll._band
251 #define lsi_fd _sifields._sigpoll._fd
272 char ifrn_name[LINUX_IFNAMSIZ];
276 struct l_sockaddr ifru_addr;
277 struct l_sockaddr ifru_dstaddr;
278 struct l_sockaddr ifru_broadaddr;
279 struct l_sockaddr ifru_netmask;
280 struct l_sockaddr ifru_hwaddr;
281 l_short ifru_flags[1];
284 struct l_ifmap ifru_map;
285 char ifru_slave[LINUX_IFNAMSIZ];
286 l_uintptr_t ifru_data;
290 #define ifr_name ifr_ifrn.ifrn_name /* Interface name */
291 #define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */
292 #define ifr_ifindex ifr_ifru.ifru_ivalue /* Interface index */
294 #define linux_copyout_rusage(r, u) copyout(r, u, sizeof(*r))
297 struct linux_robust_list {
301 struct linux_robust_list_head {
302 struct linux_robust_list list;
304 l_uintptr_t pending_list;
307 #endif /* _ARM64_LINUX_H_ */