2 * Copyright (c) 1994-1996 Søren Schmidt
3 * Copyright (c) 2013 Dmitry Chagin <dchagin@FreeBSD.org>
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 #define LINUX_DTRACE linuxulator
41 /* Provide a separate set of types for the Linux types */
42 typedef int32_t l_int;
43 typedef int64_t l_long;
44 typedef int16_t l_short;
45 typedef uint32_t l_uint;
46 typedef uint64_t l_ulong;
47 typedef uint16_t l_ushort;
49 typedef l_ulong l_uintptr_t;
50 typedef l_long l_clock_t;
51 typedef l_int l_daddr_t;
52 typedef l_uint l_gid_t;
53 typedef l_ushort l_gid16_t; /* XXX */
54 typedef l_uint l_uid_t;
55 typedef l_ushort l_uid16_t; /* XXX */
56 typedef l_ulong l_ino_t;
57 typedef l_int l_key_t;
58 typedef l_long l_loff_t;
59 typedef l_uint l_mode_t;
60 typedef l_long l_off_t;
61 typedef l_int l_pid_t;
62 typedef l_ulong l_size_t;
63 typedef l_long l_suseconds_t;
64 typedef l_long l_time_t;
65 typedef l_int l_timer_t; /* XXX */
66 typedef l_int l_mqd_t;
67 typedef l_ulong l_fd_mask;
69 #include <compat/linux/linux_siginfo.h>
77 l_suseconds_t tv_usec;
80 #define l_fd_set fd_set
83 #define LINUX_AT_COUNT 21 /* Count of used aux entry types.
84 * Keep this synchronized with
85 * linux_copyout_auxargs() code.
88 struct l___sysctl_args
100 #define LINUX_RLIMIT_CPU 0
101 #define LINUX_RLIMIT_FSIZE 1
102 #define LINUX_RLIMIT_DATA 2
103 #define LINUX_RLIMIT_STACK 3
104 #define LINUX_RLIMIT_CORE 4
105 #define LINUX_RLIMIT_RSS 5
106 #define LINUX_RLIMIT_NPROC 6
107 #define LINUX_RLIMIT_NOFILE 7
108 #define LINUX_RLIMIT_MEMLOCK 8
109 #define LINUX_RLIMIT_AS 9 /* Address space limit */
111 #define LINUX_RLIM_NLIMITS 10
118 /* stat family of syscalls */
124 #define LINUX_O_DIRECTORY 000040000 /* Must be a directory */
125 #define LINUX_O_NOFOLLOW 000100000 /* Do not follow links */
126 #define LINUX_O_DIRECT 000200000 /* Direct disk access hint */
127 #define LINUX_O_LARGEFILE 000400000
145 struct l_timespec st_atim;
146 struct l_timespec st_mtim;
147 struct l_timespec st_ctim;
152 /* sigaction flags */
153 #define LINUX_SA_NOCLDSTOP 0x00000001
154 #define LINUX_SA_NOCLDWAIT 0x00000002
155 #define LINUX_SA_SIGINFO 0x00000004
156 #define LINUX_SA_RESTORER 0x04000000
157 #define LINUX_SA_ONSTACK 0x08000000
158 #define LINUX_SA_RESTART 0x10000000
159 #define LINUX_SA_INTERRUPT 0x20000000 /* XXX */
160 #define LINUX_SA_NOMASK 0x40000000 /* SA_NODEFER */
161 #define LINUX_SA_ONESHOT 0x80000000 /* SA_RESETHAND */
163 typedef void (*l_handler_t)(l_int);
166 l_handler_t lsa_handler;
168 l_uintptr_t lsa_restorer;
170 } l_sigaction_t; /* XXX */
186 #define linux_copyout_rusage(r, u) copyout(r, u, sizeof(*r))
188 struct linux_pt_regset {
199 void bsd_to_linux_regset(const struct reg *b_reg,
200 struct linux_pt_regset *l_regset);
201 void linux_to_bsd_regset(struct reg *b_reg,
202 const struct linux_pt_regset *l_regset);
203 void linux_ptrace_get_syscall_info_machdep(const struct reg *reg,
204 struct syscall_info *si);
205 int linux_ptrace_getregs_machdep(struct thread *td, pid_t pid,
206 struct linux_pt_regset *l_regset);
207 int linux_ptrace_peekuser(struct thread *td, pid_t pid,
208 void *addr, void *data);
209 int linux_ptrace_pokeuser(struct thread *td, pid_t pid,
210 void *addr, void *data);
213 #endif /* _ARM64_LINUX_H_ */