blob: a39148d1e8b3b67243db266d880c9f109a255785 [file] [log] [blame]
njnc6168192004-11-29 13:54:10 +00001
2/*--------------------------------------------------------------------*/
njnc1b01812005-06-17 22:19:06 +00003/*--- Platform-specific syscalls stuff. syswrap-amd64-linux.c ---*/
njnc6168192004-11-29 13:54:10 +00004/*--------------------------------------------------------------------*/
5
6/*
njnb9c427c2004-12-01 14:14:42 +00007 This file is part of Valgrind, a dynamic binary instrumentation
8 framework.
njnc6168192004-11-29 13:54:10 +00009
sewardjb3a1e4b2015-08-21 11:32:26 +000010 Copyright (C) 2000-2015 Nicholas Nethercote
njn2bc10122005-05-08 02:10:27 +000011 njn@valgrind.org
njnc6168192004-11-29 13:54:10 +000012
13 This program is free software; you can redistribute it and/or
14 modify it under the terms of the GNU General Public License as
15 published by the Free Software Foundation; either version 2 of the
16 License, or (at your option) any later version.
17
18 This program is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
26 02111-1307, USA.
27
28 The GNU General Public License is contained in the file COPYING.
29*/
30
njn8b68b642009-06-24 00:37:09 +000031#if defined(VGP_amd64_linux)
32
njnc7561b92005-06-19 01:24:32 +000033#include "pub_core_basics.h"
sewardj53c0dc92006-10-14 20:06:48 +000034#include "pub_core_vki.h"
35#include "pub_core_vkiscnums.h"
njnc7561b92005-06-19 01:24:32 +000036#include "pub_core_threadstate.h"
sewardj601371a2005-04-25 16:21:17 +000037#include "pub_core_aspacemgr.h"
njn899ce732005-06-21 00:28:11 +000038#include "pub_core_debuglog.h"
sewardje7aa4ae2005-06-09 12:43:42 +000039#include "pub_core_options.h"
40#include "pub_core_libcbase.h"
njn132bfcc2005-06-04 19:16:06 +000041#include "pub_core_libcassert.h"
njn36a20fa2005-06-03 03:08:39 +000042#include "pub_core_libcprint.h"
njnf39e9a32005-06-12 02:43:17 +000043#include "pub_core_libcproc.h"
njnde62cbf2005-06-10 22:08:14 +000044#include "pub_core_libcsignal.h"
njnc7561b92005-06-19 01:24:32 +000045#include "pub_core_scheduler.h"
njn2521d322005-05-08 14:45:13 +000046#include "pub_core_sigframe.h"
njnde62cbf2005-06-10 22:08:14 +000047#include "pub_core_signals.h"
njn9abd6082005-06-17 21:31:45 +000048#include "pub_core_syscall.h"
njnc1b01812005-06-17 22:19:06 +000049#include "pub_core_syswrap.h"
njn43b9a8a2005-05-10 04:37:01 +000050#include "pub_core_tooliface.h"
njnc6168192004-11-29 13:54:10 +000051
sewardje7aa4ae2005-06-09 12:43:42 +000052#include "priv_types_n_macros.h"
njnc1b01812005-06-17 22:19:06 +000053#include "priv_syswrap-generic.h" /* for decls of generic wrappers */
54#include "priv_syswrap-linux.h" /* for decls of linux-ish wrappers */
sewardje25e7652006-04-20 14:38:50 +000055#include "priv_syswrap-linux-variants.h" /* decls of linux variant wrappers */
njnc1b01812005-06-17 22:19:06 +000056#include "priv_syswrap-main.h"
sewardje7aa4ae2005-06-09 12:43:42 +000057
sewardj8eff3822005-02-17 09:30:21 +000058
njnc6168192004-11-29 13:54:10 +000059/* ---------------------------------------------------------------------
njne1486662005-11-10 02:48:04 +000060 clone() handling
sewardj4d89e302005-03-16 22:04:40 +000061 ------------------------------------------------------------------ */
62
njnfcb7c3e2005-06-18 15:54:25 +000063/* Call f(arg1), but first switch stacks, using 'stack' as the new
64 stack, and use 'retaddr' as f's return-to address. Also, clear all
65 the integer registers before entering f. */
66__attribute__((noreturn))
njna3afdfb2005-11-09 04:49:28 +000067void ML_(call_on_new_stack_0_1) ( Addr stack,
68 Addr retaddr,
69 void (*f)(Word),
70 Word arg1 );
njnfcb7c3e2005-06-18 15:54:25 +000071// %rdi == stack
72// %rsi == retaddr
73// %rdx == f
74// %rcx == arg1
75asm(
sewardjd9fc3822005-11-18 23:50:43 +000076".text\n"
njna3afdfb2005-11-09 04:49:28 +000077".globl vgModuleLocal_call_on_new_stack_0_1\n"
tom0dce48b2005-11-09 08:52:21 +000078"vgModuleLocal_call_on_new_stack_0_1:\n"
njnfcb7c3e2005-06-18 15:54:25 +000079" movq %rdi, %rsp\n" // set stack
80" pushq %rsi\n" // retaddr to stack
81" pushq %rdx\n" // f to stack
82" pushq %rcx\n" // arg1 to stack
83" movq $0, %rax\n" // zero all GP regs
84" movq $0, %rbx\n"
85" movq $0, %rcx\n"
86" movq $0, %rdx\n"
87" movq $0, %rsi\n"
88" movq $0, %rdi\n"
89" movq $0, %rbp\n"
90" movq $0, %r8\n"
91" movq $0, %r9\n"
92" movq $0, %r10\n"
93" movq $0, %r11\n"
94" movq $0, %r12\n"
95" movq $0, %r13\n"
96" movq $0, %r14\n"
97" movq $0, %r15\n"
98" popq %rdi\n" // arg1 to correct arg reg
99" ret\n" // jump to f
100" ud2\n" // should never get here
sewardj2fedc642005-11-19 02:02:57 +0000101".previous\n"
njnfcb7c3e2005-06-18 15:54:25 +0000102);
103
sewardje7aa4ae2005-06-09 12:43:42 +0000104/*
105 Perform a clone system call. clone is strange because it has
106 fork()-like return-twice semantics, so it needs special
107 handling here.
108
109 Upon entry, we have:
110
111 int (*fn)(void*) in %rdi
112 void* child_stack in %rsi
113 int flags in %rdx
114 void* arg in %rcx
115 pid_t* child_tid in %r8
116 pid_t* parent_tid in %r9
117 void* tls_ptr at 8(%rsp)
118
119 System call requires:
120
121 int $__NR_clone in %rax
122 int flags in %rdi
123 void* child_stack in %rsi
124 pid_t* parent_tid in %rdx
125 pid_t* child_tid in %r10
126 void* tls_ptr in %r8
127
128 Returns a Long encoded in the linux-amd64 way, not a SysRes.
129 */
sewardj7d15e512005-09-30 01:20:47 +0000130#define __NR_CLONE VG_STRINGIFY(__NR_clone)
131#define __NR_EXIT VG_STRINGIFY(__NR_exit)
sewardje7aa4ae2005-06-09 12:43:42 +0000132
133extern
njnffd9c1d2005-11-10 04:02:19 +0000134Long do_syscall_clone_amd64_linux ( Word (*fn)(void *),
sewardje7aa4ae2005-06-09 12:43:42 +0000135 void* stack,
136 Long flags,
137 void* arg,
138 Long* child_tid,
139 Long* parent_tid,
140 vki_modify_ldt_t * );
141asm(
sewardjd9fc3822005-11-18 23:50:43 +0000142".text\n"
philippe9fdca562012-04-16 22:06:47 +0000143".globl do_syscall_clone_amd64_linux\n"
sewardje7aa4ae2005-06-09 12:43:42 +0000144"do_syscall_clone_amd64_linux:\n"
145 // set up child stack, temporarily preserving fn and arg
146" subq $16, %rsi\n" // make space on stack
147" movq %rcx, 8(%rsi)\n" // save arg
148" movq %rdi, 0(%rsi)\n" // save fn
149
150 // setup syscall
151" movq $"__NR_CLONE", %rax\n" // syscall number
152" movq %rdx, %rdi\n" // syscall arg1: flags
153 // %rsi already setup // syscall arg2: child_stack
154" movq %r9, %rdx\n" // syscall arg3: parent_tid
155" movq %r8, %r10\n" // syscall arg4: child_tid
156" movq 8(%rsp), %r8\n" // syscall arg5: tls_ptr
157
158" syscall\n" // clone()
159
160" testq %rax, %rax\n" // child if retval == 0
161" jnz 1f\n"
162
163 // CHILD - call thread function
164" pop %rax\n" // pop fn
165" pop %rdi\n" // pop fn arg1: arg
166" call *%rax\n" // call fn
167
168 // exit with result
169" movq %rax, %rdi\n" // arg1: return value from fn
170" movq $"__NR_EXIT", %rax\n"
171
172" syscall\n"
173
174 // Exit returned?!
175" ud2\n"
176
177"1:\n" // PARENT or ERROR
178" ret\n"
sewardj2fedc642005-11-19 02:02:57 +0000179".previous\n"
sewardje7aa4ae2005-06-09 12:43:42 +0000180);
181
182#undef __NR_CLONE
183#undef __NR_EXIT
sewardje7aa4ae2005-06-09 12:43:42 +0000184
185
njn2335d112005-05-15 20:52:04 +0000186// forward declaration
187static void setup_child ( ThreadArchState*, ThreadArchState* );
188
189/*
sewardj96f71e12005-03-24 19:38:57 +0000190 When a client clones, we need to keep track of the new thread. This means:
florianad4e9792015-07-05 21:53:33 +0000191 1. allocate a ThreadId+ThreadState+stack for the thread
sewardj96f71e12005-03-24 19:38:57 +0000192
193 2. initialize the thread's new VCPU state
194
195 3. create the thread using the same args as the client requested,
196 but using the scheduler entrypoint for EIP, and a separate stack
197 for ESP.
198 */
sewardje7aa4ae2005-06-09 12:43:42 +0000199static SysRes do_clone ( ThreadId ptid,
200 ULong flags, Addr rsp,
201 Long* parent_tidptr,
202 Long* child_tidptr,
203 Addr tlsaddr )
sewardj96f71e12005-03-24 19:38:57 +0000204{
205 static const Bool debug = False;
206
sewardje7aa4ae2005-06-09 12:43:42 +0000207 ThreadId ctid = VG_(alloc_ThreadState)();
208 ThreadState* ptst = VG_(get_ThreadState)(ptid);
209 ThreadState* ctst = VG_(get_ThreadState)(ctid);
210 UWord* stack;
sewardje7aa4ae2005-06-09 12:43:42 +0000211 SysRes res;
212 Long rax;
sewardj96f71e12005-03-24 19:38:57 +0000213 vki_sigset_t blockall, savedmask;
214
215 VG_(sigfillset)(&blockall);
216
217 vg_assert(VG_(is_running_thread)(ptid));
218 vg_assert(VG_(is_valid_tid)(ctid));
219
njna3afdfb2005-11-09 04:49:28 +0000220 stack = (UWord*)ML_(allocstack)(ctid);
sewardj45f4e7c2005-09-27 19:20:21 +0000221 if (stack == NULL) {
222 res = VG_(mk_SysRes_Error)( VKI_ENOMEM );
223 goto out;
224 }
sewardj96f71e12005-03-24 19:38:57 +0000225
226 /* Copy register state
227
228 Both parent and child return to the same place, and the code
229 following the clone syscall works out which is which, so we
230 don't need to worry about it.
231
232 The parent gets the child's new tid returned from clone, but the
233 child gets 0.
234
235 If the clone call specifies a NULL rsp for the new thread, then
236 it actually gets a copy of the parent's rsp.
237 */
njn2335d112005-05-15 20:52:04 +0000238 setup_child( &ctst->arch, &ptst->arch );
sewardj96f71e12005-03-24 19:38:57 +0000239
sewardje7aa4ae2005-06-09 12:43:42 +0000240 /* Make sys_clone appear to have returned Success(0) in the
241 child. */
242 ctst->arch.vex.guest_RAX = 0;
243
sewardj96f71e12005-03-24 19:38:57 +0000244 if (rsp != 0)
245 ctst->arch.vex.guest_RSP = rsp;
246
247 ctst->os_state.parent = ptid;
sewardj96f71e12005-03-24 19:38:57 +0000248
249 /* inherit signal mask */
250 ctst->sig_mask = ptst->sig_mask;
251 ctst->tmp_sig_mask = ptst->sig_mask;
252
sewardjce215632010-02-22 11:03:10 +0000253 /* Start the child with its threadgroup being the same as the
254 parent's. This is so that any exit_group calls that happen
255 after the child is created but before it sets its
256 os_state.threadgroup field for real (in thread_wrapper in
257 syswrap-linux.c), really kill the new thread. a.k.a this avoids
258 a race condition in which the thread is unkillable (via
259 exit_group) because its threadgroup is not set. The race window
260 is probably only a few hundred or a few thousand cycles long.
261 See #226116. */
262 ctst->os_state.threadgroup = ptst->os_state.threadgroup;
263
philippe38a74d22014-08-29 22:53:19 +0000264 ML_(guess_and_register_stack) (rsp, ctst);
sewardj96f71e12005-03-24 19:38:57 +0000265
sewardjadb102f2007-11-09 23:21:44 +0000266 /* Assume the clone will succeed, and tell any tool that wants to
267 know that this thread has come into existence. If the clone
268 fails, we'll send out a ll_exit notification for it at the out:
269 label below, to clean up. */
bart9a2b80d2012-03-25 17:51:59 +0000270 vg_assert(VG_(owns_BigLock_LL)(ptid));
sewardjadb102f2007-11-09 23:21:44 +0000271 VG_TRACK ( pre_thread_ll_create, ptid, ctid );
272
sewardj96f71e12005-03-24 19:38:57 +0000273 if (flags & VKI_CLONE_SETTLS) {
274 if (debug)
barta0b6b2c2008-07-07 06:49:24 +0000275 VG_(printf)("clone child has SETTLS: tls at %#lx\n", tlsaddr);
philippe8e785772014-12-17 00:00:11 +0000276 ctst->arch.vex.guest_FS_CONST = tlsaddr;
sewardj96f71e12005-03-24 19:38:57 +0000277 }
278
279 flags &= ~VKI_CLONE_SETTLS;
280
281 /* start the thread with everything blocked */
282 VG_(sigprocmask)(VKI_SIG_SETMASK, &blockall, &savedmask);
283
284 /* Create the new thread */
sewardje7aa4ae2005-06-09 12:43:42 +0000285 rax = do_syscall_clone_amd64_linux(
njna3afdfb2005-11-09 04:49:28 +0000286 ML_(start_thread_NORETURN), stack, flags, &VG_(threads)[ctid],
sewardje7aa4ae2005-06-09 12:43:42 +0000287 child_tidptr, parent_tidptr, NULL
288 );
cerion85665ca2005-06-20 15:51:07 +0000289 res = VG_(mk_SysRes_amd64_linux)( rax );
sewardj96f71e12005-03-24 19:38:57 +0000290
291 VG_(sigprocmask)(VKI_SIG_SETMASK, &savedmask, NULL);
292
sewardj45f4e7c2005-09-27 19:20:21 +0000293 out:
njncda2f0f2009-05-18 02:12:08 +0000294 if (sr_isError(res)) {
sewardj96f71e12005-03-24 19:38:57 +0000295 /* clone failed */
njnaf839f52005-06-23 03:27:57 +0000296 VG_(cleanup_thread)(&ctst->arch);
sewardj96f71e12005-03-24 19:38:57 +0000297 ctst->status = VgTs_Empty;
sewardjadb102f2007-11-09 23:21:44 +0000298 /* oops. Better tell the tool the thread exited in a hurry :-) */
299 VG_TRACK( pre_thread_ll_exit, ctid );
sewardj96f71e12005-03-24 19:38:57 +0000300 }
301
sewardje7aa4ae2005-06-09 12:43:42 +0000302 return res;
sewardj96f71e12005-03-24 19:38:57 +0000303}
304
sewardje7aa4ae2005-06-09 12:43:42 +0000305
sewardj4d89e302005-03-16 22:04:40 +0000306/* ---------------------------------------------------------------------
njn2335d112005-05-15 20:52:04 +0000307 More thread stuff
308 ------------------------------------------------------------------ */
309
njnaf839f52005-06-23 03:27:57 +0000310void VG_(cleanup_thread) ( ThreadArchState *arch )
njn2335d112005-05-15 20:52:04 +0000311{
312}
313
314void setup_child ( /*OUT*/ ThreadArchState *child,
315 /*IN*/ ThreadArchState *parent )
316{
317 /* We inherit our parent's guest state. */
318 child->vex = parent->vex;
sewardj7cf4e6b2008-05-01 20:24:26 +0000319 child->vex_shadow1 = parent->vex_shadow1;
320 child->vex_shadow2 = parent->vex_shadow2;
njn2335d112005-05-15 20:52:04 +0000321}
322
sewardje7aa4ae2005-06-09 12:43:42 +0000323
njn2335d112005-05-15 20:52:04 +0000324/* ---------------------------------------------------------------------
njnc6168192004-11-29 13:54:10 +0000325 PRE/POST wrappers for AMD64/Linux-specific syscalls
326 ------------------------------------------------------------------ */
327
sewardje7aa4ae2005-06-09 12:43:42 +0000328#define PRE(name) DEFN_PRE_TEMPLATE(amd64_linux, name)
329#define POST(name) DEFN_POST_TEMPLATE(amd64_linux, name)
njnc6168192004-11-29 13:54:10 +0000330
sewardje7aa4ae2005-06-09 12:43:42 +0000331/* Add prototypes for the wrappers declared here, so that gcc doesn't
332 harass us for not having prototypes. Really this is a kludge --
333 the right thing to do is to make these wrappers 'static' since they
334 aren't visible outside this file, but that requires even more macro
335 magic. */
336DECL_TEMPLATE(amd64_linux, sys_clone);
337DECL_TEMPLATE(amd64_linux, sys_rt_sigreturn);
sewardje7aa4ae2005-06-09 12:43:42 +0000338DECL_TEMPLATE(amd64_linux, sys_arch_prctl);
tom2af58f22005-07-22 15:04:14 +0000339DECL_TEMPLATE(amd64_linux, sys_ptrace);
tom20d35722005-07-27 22:57:18 +0000340DECL_TEMPLATE(amd64_linux, sys_fadvise64);
tom9548a162005-09-30 08:07:53 +0000341DECL_TEMPLATE(amd64_linux, sys_mmap);
sewardje25e7652006-04-20 14:38:50 +0000342DECL_TEMPLATE(amd64_linux, sys_syscall184);
njnc6168192004-11-29 13:54:10 +0000343
sewardje7aa4ae2005-06-09 12:43:42 +0000344
345PRE(sys_clone)
sewardj96f71e12005-03-24 19:38:57 +0000346{
sewardje7aa4ae2005-06-09 12:43:42 +0000347 ULong cloneflags;
sewardj96f71e12005-03-24 19:38:57 +0000348
barta0b6b2c2008-07-07 06:49:24 +0000349 PRINT("sys_clone ( %lx, %#lx, %#lx, %#lx, %#lx )",ARG1,ARG2,ARG3,ARG4,ARG5);
philippe8414ab32012-05-26 23:08:41 +0000350 PRE_REG_READ2(int, "clone",
sewardj96f71e12005-03-24 19:38:57 +0000351 unsigned long, flags,
philippe8414ab32012-05-26 23:08:41 +0000352 void *, child_stack);
sewardj96f71e12005-03-24 19:38:57 +0000353
354 if (ARG1 & VKI_CLONE_PARENT_SETTID) {
philippe8414ab32012-05-26 23:08:41 +0000355 if (VG_(tdict).track_pre_reg_read) {
356 PRA3("clone", int *, parent_tidptr);
357 }
sewardj96f71e12005-03-24 19:38:57 +0000358 PRE_MEM_WRITE("clone(parent_tidptr)", ARG3, sizeof(Int));
sewardj45f4e7c2005-09-27 19:20:21 +0000359 if (!VG_(am_is_valid_for_client)(ARG3, sizeof(Int), VKI_PROT_WRITE)) {
sewardje7aa4ae2005-06-09 12:43:42 +0000360 SET_STATUS_Failure( VKI_EFAULT );
sewardj96f71e12005-03-24 19:38:57 +0000361 return;
362 }
363 }
philippe8414ab32012-05-26 23:08:41 +0000364 if (ARG1 & VKI_CLONE_SETTLS) {
365 if (VG_(tdict).track_pre_reg_read) {
366 PRA4("clone", vki_modify_ldt_t *, tlsinfo);
367 }
368 PRE_MEM_READ("clone(tlsinfo)", ARG4, sizeof(vki_modify_ldt_t));
369 if (!VG_(am_is_valid_for_client)(ARG4, sizeof(vki_modify_ldt_t),
370 VKI_PROT_READ)) {
371 SET_STATUS_Failure( VKI_EFAULT );
372 return;
373 }
374 }
sewardj96f71e12005-03-24 19:38:57 +0000375 if (ARG1 & (VKI_CLONE_CHILD_SETTID | VKI_CLONE_CHILD_CLEARTID)) {
philippe8414ab32012-05-26 23:08:41 +0000376 if (VG_(tdict).track_pre_reg_read) {
377 PRA5("clone", int *, child_tidptr);
378 }
sewardj96f71e12005-03-24 19:38:57 +0000379 PRE_MEM_WRITE("clone(child_tidptr)", ARG4, sizeof(Int));
sewardj45f4e7c2005-09-27 19:20:21 +0000380 if (!VG_(am_is_valid_for_client)(ARG4, sizeof(Int), VKI_PROT_WRITE)) {
sewardje7aa4ae2005-06-09 12:43:42 +0000381 SET_STATUS_Failure( VKI_EFAULT );
sewardj96f71e12005-03-24 19:38:57 +0000382 return;
383 }
384 }
385
386 cloneflags = ARG1;
387
cerion7b2c38c2005-06-23 07:52:54 +0000388 if (!ML_(client_signal_OK)(ARG1 & VKI_CSIGNAL)) {
sewardje7aa4ae2005-06-09 12:43:42 +0000389 SET_STATUS_Failure( VKI_EINVAL );
sewardj96f71e12005-03-24 19:38:57 +0000390 return;
391 }
392
393 /* Only look at the flags we really care about */
sewardje7aa4ae2005-06-09 12:43:42 +0000394 switch (cloneflags & (VKI_CLONE_VM | VKI_CLONE_FS
395 | VKI_CLONE_FILES | VKI_CLONE_VFORK)) {
sewardj96f71e12005-03-24 19:38:57 +0000396 case VKI_CLONE_VM | VKI_CLONE_FS | VKI_CLONE_FILES:
397 /* thread creation */
sewardje7aa4ae2005-06-09 12:43:42 +0000398 SET_STATUS_from_SysRes(
399 do_clone(tid,
400 ARG1, /* flags */
401 (Addr)ARG2, /* child ESP */
402 (Long *)ARG3, /* parent_tidptr */
403 (Long *)ARG4, /* child_tidptr */
404 (Addr)ARG5)); /* set_tls */
sewardj96f71e12005-03-24 19:38:57 +0000405 break;
406
407 case VKI_CLONE_VFORK | VKI_CLONE_VM: /* vfork */
408 /* FALLTHROUGH - assume vfork == fork */
409 cloneflags &= ~(VKI_CLONE_VFORK | VKI_CLONE_VM);
410
411 case 0: /* plain fork */
sewardje7aa4ae2005-06-09 12:43:42 +0000412 SET_STATUS_from_SysRes(
njne1486662005-11-10 02:48:04 +0000413 ML_(do_fork_clone)(tid,
sewardje7aa4ae2005-06-09 12:43:42 +0000414 cloneflags, /* flags */
tom60677fb2005-11-11 11:54:11 +0000415 (Int *)ARG3, /* parent_tidptr */
416 (Int *)ARG4)); /* child_tidptr */
sewardj96f71e12005-03-24 19:38:57 +0000417 break;
418
419 default:
420 /* should we just ENOSYS? */
sewardj738856f2009-07-15 14:48:32 +0000421 VG_(message)(Vg_UserMsg,
422 "Unsupported clone() flags: 0x%lx\n", ARG1);
423 VG_(message)(Vg_UserMsg,
424 "\n");
425 VG_(message)(Vg_UserMsg,
426 "The only supported clone() uses are:\n");
427 VG_(message)(Vg_UserMsg,
428 " - via a threads library (LinuxThreads or NPTL)\n");
429 VG_(message)(Vg_UserMsg,
430 " - via the implementation of fork or vfork\n");
sewardj96f71e12005-03-24 19:38:57 +0000431 VG_(unimplemented)
sewardje7aa4ae2005-06-09 12:43:42 +0000432 ("Valgrind does not support general clone().");
sewardj96f71e12005-03-24 19:38:57 +0000433 }
434
sewardje7aa4ae2005-06-09 12:43:42 +0000435 if (SUCCESS) {
sewardj96f71e12005-03-24 19:38:57 +0000436 if (ARG1 & VKI_CLONE_PARENT_SETTID)
437 POST_MEM_WRITE(ARG3, sizeof(Int));
438 if (ARG1 & (VKI_CLONE_CHILD_SETTID | VKI_CLONE_CHILD_CLEARTID))
439 POST_MEM_WRITE(ARG4, sizeof(Int));
440
441 /* Thread creation was successful; let the child have the chance
442 to run */
sewardje7aa4ae2005-06-09 12:43:42 +0000443 *flags |= SfYieldAfter;
sewardj96f71e12005-03-24 19:38:57 +0000444 }
445}
446
sewardje7aa4ae2005-06-09 12:43:42 +0000447PRE(sys_rt_sigreturn)
sewardj62601592005-03-26 13:48:19 +0000448{
sewardj18290532007-03-19 13:38:11 +0000449 /* This isn't really a syscall at all - it's a misuse of the
450 syscall mechanism by m_sigframe. VG_(sigframe_create) sets the
451 return address of the signal frames it creates to be a short
452 piece of code which does this "syscall". The only purpose of
453 the syscall is to call VG_(sigframe_destroy), which restores the
454 thread's registers from the frame and then removes it.
455 Consequently we must ask the syswrap driver logic not to write
456 back the syscall "result" as that would overwrite the
457 just-restored register state. */
458
sewardje7aa4ae2005-06-09 12:43:42 +0000459 ThreadState* tst;
sewardj18290532007-03-19 13:38:11 +0000460 PRINT("sys_rt_sigreturn ( )");
sewardj62601592005-03-26 13:48:19 +0000461
sewardje7aa4ae2005-06-09 12:43:42 +0000462 vg_assert(VG_(is_valid_tid)(tid));
463 vg_assert(tid >= 1 && tid < VG_N_THREADS);
464 vg_assert(VG_(is_running_thread)(tid));
465
sewardj18290532007-03-19 13:38:11 +0000466 /* Adjust RSP to point to start of frame; skip back up over handler
sewardj62601592005-03-26 13:48:19 +0000467 ret addr */
sewardje7aa4ae2005-06-09 12:43:42 +0000468 tst = VG_(get_ThreadState)(tid);
sewardj62601592005-03-26 13:48:19 +0000469 tst->arch.vex.guest_RSP -= sizeof(Addr);
470
471 /* This is only so that the RIP is (might be) useful to report if
sewardj18290532007-03-19 13:38:11 +0000472 something goes wrong in the sigreturn. JRS 20070318: no idea
473 what this is for */
cerion7b2c38c2005-06-23 07:52:54 +0000474 ML_(fixup_guest_state_to_restart_syscall)(&tst->arch);
sewardj62601592005-03-26 13:48:19 +0000475
sewardj18290532007-03-19 13:38:11 +0000476 /* Restore register state from frame and remove it, as
477 described above */
sewardj8a7fdd22005-04-24 14:31:29 +0000478 VG_(sigframe_destroy)(tid, True);
sewardj62601592005-03-26 13:48:19 +0000479
sewardj18290532007-03-19 13:38:11 +0000480 /* Tell the driver not to update the guest state with the "result",
481 and set a bogus result to keep it happy. */
482 *flags |= SfNoWriteResult;
483 SET_STATUS_Success(0);
sewardj62601592005-03-26 13:48:19 +0000484
sewardjcba8f432007-03-19 14:34:08 +0000485 /* Check to see if any signals arose as a result of this. */
sewardje7aa4ae2005-06-09 12:43:42 +0000486 *flags |= SfPollAfter;
sewardj62601592005-03-26 13:48:19 +0000487}
488
sewardje7aa4ae2005-06-09 12:43:42 +0000489PRE(sys_arch_prctl)
njnc6168192004-11-29 13:54:10 +0000490{
sewardje7aa4ae2005-06-09 12:43:42 +0000491 ThreadState* tst;
florianb26101c2015-08-08 21:45:33 +0000492 PRINT( "arch_prctl ( %ld, %lx )", SARG1, ARG2 );
sewardj8eff3822005-02-17 09:30:21 +0000493
sewardje7aa4ae2005-06-09 12:43:42 +0000494 vg_assert(VG_(is_valid_tid)(tid));
495 vg_assert(tid >= 1 && tid < VG_N_THREADS);
496 vg_assert(VG_(is_running_thread)(tid));
497
sewardj8eff3822005-02-17 09:30:21 +0000498 // Nb: can't use "ARG2".."ARG5" here because that's our own macro...
499 PRE_REG_READ2(long, "arch_prctl",
500 int, option, unsigned long, arg2);
501 // XXX: totally wrong... we need to look at the 'option' arg, and do
502 // PRE_MEM_READs/PRE_MEM_WRITEs as necessary...
503
504 /* "do" the syscall ourselves; the kernel never sees it */
tomf2dab382005-07-19 22:35:58 +0000505 if (ARG1 == VKI_ARCH_SET_FS) {
506 tst = VG_(get_ThreadState)(tid);
philippe8e785772014-12-17 00:00:11 +0000507 tst->arch.vex.guest_FS_CONST = ARG2;
tomf2dab382005-07-19 22:35:58 +0000508 }
509 else if (ARG1 == VKI_ARCH_GET_FS) {
510 PRE_MEM_WRITE("arch_prctl(addr)", ARG2, sizeof(unsigned long));
511 tst = VG_(get_ThreadState)(tid);
philippe8e785772014-12-17 00:00:11 +0000512 *(unsigned long *)ARG2 = tst->arch.vex.guest_FS_CONST;
513 POST_MEM_WRITE(ARG2, sizeof(unsigned long));
514 }
515 else if (ARG1 == VKI_ARCH_SET_GS) {
516 tst = VG_(get_ThreadState)(tid);
517 tst->arch.vex.guest_GS_CONST = ARG2;
518 }
519 else if (ARG1 == VKI_ARCH_GET_GS) {
520 PRE_MEM_WRITE("arch_prctl(addr)", ARG2, sizeof(unsigned long));
521 tst = VG_(get_ThreadState)(tid);
522 *(unsigned long *)ARG2 = tst->arch.vex.guest_GS_CONST;
tomf2dab382005-07-19 22:35:58 +0000523 POST_MEM_WRITE(ARG2, sizeof(unsigned long));
524 }
525 else {
philippe8e785772014-12-17 00:00:11 +0000526 VG_(core_panic)("Unsupported arch_prctl option");
tomf2dab382005-07-19 22:35:58 +0000527 }
sewardje7aa4ae2005-06-09 12:43:42 +0000528
529 /* Note; the Status writeback to guest state that happens after
philippe8e785772014-12-17 00:00:11 +0000530 this wrapper returns does not change guest_FS_CONST or guest_GS_CONST;
531 hence that direct assignment to the guest state is safe here. */
sewardje7aa4ae2005-06-09 12:43:42 +0000532 SET_STATUS_Success( 0 );
njnc6168192004-11-29 13:54:10 +0000533}
534
tom2af58f22005-07-22 15:04:14 +0000535// Parts of this are amd64-specific, but the *PEEK* cases are generic.
tomb807a782007-03-07 09:48:32 +0000536//
537// ARG3 is only used for pointers into the traced process's address
538// space and for offsets into the traced process's struct
539// user_regs_struct. It is never a pointer into this process's memory
540// space, and we should therefore not check anything it points to.
tom2af58f22005-07-22 15:04:14 +0000541PRE(sys_ptrace)
542{
florianb26101c2015-08-08 21:45:33 +0000543 PRINT("sys_ptrace ( %ld, %ld, %#lx, %#lx )", SARG1, SARG2, ARG3, ARG4);
tom2af58f22005-07-22 15:04:14 +0000544 PRE_REG_READ4(int, "ptrace",
545 long, request, long, pid, long, addr, long, data);
546 switch (ARG1) {
547 case VKI_PTRACE_PEEKTEXT:
548 case VKI_PTRACE_PEEKDATA:
549 case VKI_PTRACE_PEEKUSR:
550 PRE_MEM_WRITE( "ptrace(peek)", ARG4,
551 sizeof (long));
552 break;
553 case VKI_PTRACE_GETREGS:
554 PRE_MEM_WRITE( "ptrace(getregs)", ARG4,
555 sizeof (struct vki_user_regs_struct));
556 break;
557 case VKI_PTRACE_GETFPREGS:
558 PRE_MEM_WRITE( "ptrace(getfpregs)", ARG4,
559 sizeof (struct vki_user_i387_struct));
560 break;
561 case VKI_PTRACE_SETREGS:
562 PRE_MEM_READ( "ptrace(setregs)", ARG4,
563 sizeof (struct vki_user_regs_struct));
564 break;
565 case VKI_PTRACE_SETFPREGS:
566 PRE_MEM_READ( "ptrace(setfpregs)", ARG4,
567 sizeof (struct vki_user_i387_struct));
568 break;
tomb807a782007-03-07 09:48:32 +0000569 case VKI_PTRACE_GETEVENTMSG:
570 PRE_MEM_WRITE( "ptrace(geteventmsg)", ARG4, sizeof(unsigned long));
571 break;
572 case VKI_PTRACE_GETSIGINFO:
573 PRE_MEM_WRITE( "ptrace(getsiginfo)", ARG4, sizeof(vki_siginfo_t));
574 break;
575 case VKI_PTRACE_SETSIGINFO:
576 PRE_MEM_READ( "ptrace(setsiginfo)", ARG4, sizeof(vki_siginfo_t));
577 break;
cborntrab2cd1bc2012-11-08 20:27:05 +0000578 case VKI_PTRACE_GETREGSET:
579 ML_(linux_PRE_getregset)(tid, ARG3, ARG4);
580 break;
581 case VKI_PTRACE_SETREGSET:
582 ML_(linux_PRE_setregset)(tid, ARG3, ARG4);
583 break;
tom2af58f22005-07-22 15:04:14 +0000584 default:
585 break;
586 }
587}
588
589POST(sys_ptrace)
590{
591 switch (ARG1) {
592 case VKI_PTRACE_PEEKTEXT:
593 case VKI_PTRACE_PEEKDATA:
594 case VKI_PTRACE_PEEKUSR:
595 POST_MEM_WRITE( ARG4, sizeof (long));
596 break;
597 case VKI_PTRACE_GETREGS:
598 POST_MEM_WRITE( ARG4, sizeof (struct vki_user_regs_struct));
599 break;
600 case VKI_PTRACE_GETFPREGS:
601 POST_MEM_WRITE( ARG4, sizeof (struct vki_user_i387_struct));
602 break;
tomb807a782007-03-07 09:48:32 +0000603 case VKI_PTRACE_GETEVENTMSG:
604 POST_MEM_WRITE( ARG4, sizeof(unsigned long));
605 break;
606 case VKI_PTRACE_GETSIGINFO:
607 /* XXX: This is a simplification. Different parts of the
608 * siginfo_t are valid depending on the type of signal.
609 */
610 POST_MEM_WRITE( ARG4, sizeof(vki_siginfo_t));
611 break;
cborntrab2cd1bc2012-11-08 20:27:05 +0000612 case VKI_PTRACE_GETREGSET:
613 ML_(linux_POST_getregset)(tid, ARG3, ARG4);
614 break;
tom2af58f22005-07-22 15:04:14 +0000615 default:
616 break;
617 }
618}
619
tom20d35722005-07-27 22:57:18 +0000620PRE(sys_fadvise64)
621{
florianb26101c2015-08-08 21:45:33 +0000622 PRINT("sys_fadvise64 ( %ld, %ld, %lu, %ld )", SARG1, SARG2, ARG3, SARG4);
tom20d35722005-07-27 22:57:18 +0000623 PRE_REG_READ4(long, "fadvise64",
624 int, fd, vki_loff_t, offset, vki_size_t, len, int, advice);
625}
626
tom9548a162005-09-30 08:07:53 +0000627PRE(sys_mmap)
628{
629 SysRes r;
630
florianb26101c2015-08-08 21:45:33 +0000631 PRINT("sys_mmap ( %#lx, %lu, %ld, %ld, %ld, %ld )",
632 ARG1, ARG2, SARG3, SARG4, SARG5, SARG6 );
tom9548a162005-09-30 08:07:53 +0000633 PRE_REG_READ6(long, "mmap",
634 unsigned long, start, unsigned long, length,
florianb26101c2015-08-08 21:45:33 +0000635 int, prot, int, flags, int, fd, vki_off_t, offset);
tom9548a162005-09-30 08:07:53 +0000636
637 r = ML_(generic_PRE_sys_mmap)( tid, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6 );
638 SET_STATUS_from_SysRes(r);
639}
640
sewardje25e7652006-04-20 14:38:50 +0000641
642/* ---------------------------------------------------------------
643 PRE/POST wrappers for AMD64/Linux-variant specific syscalls
644 ------------------------------------------------------------ */
645
646PRE(sys_syscall184)
647{
648 Int err;
649
650 /* 184 is used by sys_bproc. If we're not on a declared bproc
651 variant, fail in the usual way, since it is otherwise unused. */
652
philippeec905f72014-08-17 20:03:51 +0000653 if (!KernelVariantiS(KernelVariant_bproc, VG_(clo_kernel_variant))) {
sewardje25e7652006-04-20 14:38:50 +0000654 PRINT("non-existent syscall! (syscall 184)");
655 PRE_REG_READ0(long, "ni_syscall(184)");
656 SET_STATUS_Failure( VKI_ENOSYS );
657 return;
658 }
659
660 err = ML_(linux_variant_PRE_sys_bproc)( ARG1, ARG2, ARG3,
661 ARG4, ARG5, ARG6 );
662 if (err) {
663 SET_STATUS_Failure( err );
664 return;
665 }
666 /* Let it go through. */
667 *flags |= SfMayBlock; /* who knows? play safe. */
668}
669
670POST(sys_syscall184)
671{
672 ML_(linux_variant_POST_sys_bproc)( ARG1, ARG2, ARG3,
673 ARG4, ARG5, ARG6 );
674}
675
njnc6168192004-11-29 13:54:10 +0000676#undef PRE
677#undef POST
678
sewardj987a8eb2005-03-01 19:00:30 +0000679
njnc6168192004-11-29 13:54:10 +0000680/* ---------------------------------------------------------------------
681 The AMD64/Linux syscall table
682 ------------------------------------------------------------------ */
683
sewardje7aa4ae2005-06-09 12:43:42 +0000684/* Add an amd64-linux specific wrapper to a syscall table. */
685#define PLAX_(const, name) WRAPPER_ENTRY_X_(amd64_linux, const, name)
686#define PLAXY(const, name) WRAPPER_ENTRY_XY(amd64_linux, const, name)
njnc6168192004-11-29 13:54:10 +0000687
688// This table maps from __NR_xxx syscall numbers (from
689// linux/include/asm-x86_64/unistd.h) to the appropriate PRE/POST sys_foo()
690// wrappers on AMD64 (as per sys_call_table in
691// linux/arch/x86_64/kernel/entry.S).
692//
njna22a93a2004-11-29 17:28:41 +0000693// When implementing these wrappers, you need to work out if the wrapper is
694// generic, Linux-only (but arch-independent), or AMD64/Linux only.
njnc6168192004-11-29 13:54:10 +0000695
sewardj59570ff2010-01-01 11:59:33 +0000696static SyscallTableEntry syscall_table[] = {
sewardj91f1c6f2005-02-13 10:47:24 +0000697 GENXY(__NR_read, sys_read), // 0
sewardj8eff3822005-02-17 09:30:21 +0000698 GENX_(__NR_write, sys_write), // 1
tom04e069e2005-03-28 23:25:58 +0000699 GENXY(__NR_open, sys_open), // 2
sewardj91f1c6f2005-02-13 10:47:24 +0000700 GENXY(__NR_close, sys_close), // 3
701 GENXY(__NR_stat, sys_newstat), // 4
njna22a93a2004-11-29 17:28:41 +0000702
sewardj91f1c6f2005-02-13 10:47:24 +0000703 GENXY(__NR_fstat, sys_newfstat), // 5
sewardjc9b7b122005-02-19 22:45:15 +0000704 GENXY(__NR_lstat, sys_newlstat), // 6
sewardj987a8eb2005-03-01 19:00:30 +0000705 GENXY(__NR_poll, sys_poll), // 7
njncd405ea2005-08-31 02:44:31 +0000706 LINX_(__NR_lseek, sys_lseek), // 8
tom9548a162005-09-30 08:07:53 +0000707 PLAX_(__NR_mmap, sys_mmap), // 9
njna22a93a2004-11-29 17:28:41 +0000708
sewardj91f1c6f2005-02-13 10:47:24 +0000709 GENXY(__NR_mprotect, sys_mprotect), // 10
sewardj8eff3822005-02-17 09:30:21 +0000710 GENXY(__NR_munmap, sys_munmap), // 11
sewardj91f1c6f2005-02-13 10:47:24 +0000711 GENX_(__NR_brk, sys_brk), // 12
njncd405ea2005-08-31 02:44:31 +0000712 LINXY(__NR_rt_sigaction, sys_rt_sigaction), // 13
713 LINXY(__NR_rt_sigprocmask, sys_rt_sigprocmask), // 14
njna22a93a2004-11-29 17:28:41 +0000714
sewardj62601592005-03-26 13:48:19 +0000715 PLAX_(__NR_rt_sigreturn, sys_rt_sigreturn), // 15
njn096ccdd2009-02-22 23:00:30 +0000716 LINXY(__NR_ioctl, sys_ioctl), // 16
njn7b1edbd2009-05-19 06:50:37 +0000717 GENXY(__NR_pread64, sys_pread64), // 17
718 GENX_(__NR_pwrite64, sys_pwrite64), // 18
sewardj6941a1a2005-03-02 16:01:23 +0000719 GENXY(__NR_readv, sys_readv), // 19
njna22a93a2004-11-29 17:28:41 +0000720
sewardj91f1c6f2005-02-13 10:47:24 +0000721 GENX_(__NR_writev, sys_writev), // 20
722 GENX_(__NR_access, sys_access), // 21
njncd405ea2005-08-31 02:44:31 +0000723 LINXY(__NR_pipe, sys_pipe), // 22
sewardj6941a1a2005-03-02 16:01:23 +0000724 GENX_(__NR_select, sys_select), // 23
njnb2480c92005-08-30 02:17:23 +0000725 LINX_(__NR_sched_yield, sys_sched_yield), // 24
njna22a93a2004-11-29 17:28:41 +0000726
sewardj33586e52005-03-23 11:41:15 +0000727 GENX_(__NR_mremap, sys_mremap), // 25
tom507ae562005-07-20 08:46:50 +0000728 GENX_(__NR_msync, sys_msync), // 26
tom5ba95302011-08-10 09:57:27 +0000729 GENXY(__NR_mincore, sys_mincore), // 27
sewardj91f1c6f2005-02-13 10:47:24 +0000730 GENX_(__NR_madvise, sys_madvise), // 28
philippe6b087762013-03-01 23:31:09 +0000731 LINX_(__NR_shmget, sys_shmget), // 29
njna22a93a2004-11-29 17:28:41 +0000732
philippe6b087762013-03-01 23:31:09 +0000733 LINXY(__NR_shmat, wrap_sys_shmat), // 30
734 LINXY(__NR_shmctl, sys_shmctl), // 31
sewardjb369c5e2005-03-24 17:52:02 +0000735 GENXY(__NR_dup, sys_dup), // 32
736 GENXY(__NR_dup2, sys_dup2), // 33
sewardj96f71e12005-03-24 19:38:57 +0000737 GENX_(__NR_pause, sys_pause), // 34
njna22a93a2004-11-29 17:28:41 +0000738
sewardj96f71e12005-03-24 19:38:57 +0000739 GENXY(__NR_nanosleep, sys_nanosleep), // 35
tom074edc62005-04-02 17:43:50 +0000740 GENXY(__NR_getitimer, sys_getitimer), // 36
sewardj33586e52005-03-23 11:41:15 +0000741 GENX_(__NR_alarm, sys_alarm), // 37
tom074edc62005-04-02 17:43:50 +0000742 GENXY(__NR_setitimer, sys_setitimer), // 38
sewardj8eff3822005-02-17 09:30:21 +0000743 GENX_(__NR_getpid, sys_getpid), // 39
njna22a93a2004-11-29 17:28:41 +0000744
sewardja58bbbc2006-04-14 01:04:04 +0000745 LINXY(__NR_sendfile, sys_sendfile), // 40
philippe6b087762013-03-01 23:31:09 +0000746 LINXY(__NR_socket, sys_socket), // 41
747 LINX_(__NR_connect, sys_connect), // 42
748 LINXY(__NR_accept, sys_accept), // 43
749 LINX_(__NR_sendto, sys_sendto), // 44
njna22a93a2004-11-29 17:28:41 +0000750
philippe6b087762013-03-01 23:31:09 +0000751 LINXY(__NR_recvfrom, sys_recvfrom), // 45
752 LINX_(__NR_sendmsg, sys_sendmsg), // 46
753 LINXY(__NR_recvmsg, sys_recvmsg), // 47
754 LINX_(__NR_shutdown, sys_shutdown), // 48
755 LINX_(__NR_bind, sys_bind), // 49
njna22a93a2004-11-29 17:28:41 +0000756
philippe6b087762013-03-01 23:31:09 +0000757 LINX_(__NR_listen, sys_listen), // 50
758 LINXY(__NR_getsockname, sys_getsockname), // 51
759 LINXY(__NR_getpeername, sys_getpeername), // 52
760 LINXY(__NR_socketpair, sys_socketpair), // 53
761 LINX_(__NR_setsockopt, sys_setsockopt), // 54
njna22a93a2004-11-29 17:28:41 +0000762
philippe6b087762013-03-01 23:31:09 +0000763 LINXY(__NR_getsockopt, sys_getsockopt), // 55
sewardj96f71e12005-03-24 19:38:57 +0000764 PLAX_(__NR_clone, sys_clone), // 56
765 GENX_(__NR_fork, sys_fork), // 57
766 GENX_(__NR_vfork, sys_fork), // 58 treat as fork
sewardjb369c5e2005-03-24 17:52:02 +0000767 GENX_(__NR_execve, sys_execve), // 59
njna22a93a2004-11-29 17:28:41 +0000768
njnc6168192004-11-29 13:54:10 +0000769 GENX_(__NR_exit, sys_exit), // 60
sewardjb369c5e2005-03-24 17:52:02 +0000770 GENXY(__NR_wait4, sys_wait4), // 61
sewardj860fc632005-03-27 01:35:16 +0000771 GENX_(__NR_kill, sys_kill), // 62
sewardj91f1c6f2005-02-13 10:47:24 +0000772 GENXY(__NR_uname, sys_newuname), // 63
philippe6b087762013-03-01 23:31:09 +0000773 LINX_(__NR_semget, sys_semget), // 64
njna22a93a2004-11-29 17:28:41 +0000774
philippe6b087762013-03-01 23:31:09 +0000775 LINX_(__NR_semop, sys_semop), // 65
776 LINXY(__NR_semctl, sys_semctl), // 66
777 LINXY(__NR_shmdt, sys_shmdt), // 67
778 LINX_(__NR_msgget, sys_msgget), // 68
779 LINX_(__NR_msgsnd, sys_msgsnd), // 69
njna22a93a2004-11-29 17:28:41 +0000780
philippe6b087762013-03-01 23:31:09 +0000781 LINXY(__NR_msgrcv, sys_msgrcv), // 70
782 LINXY(__NR_msgctl, sys_msgctl), // 71
njn096ccdd2009-02-22 23:00:30 +0000783 LINXY(__NR_fcntl, sys_fcntl), // 72
tome329b262005-11-21 13:57:49 +0000784 GENX_(__NR_flock, sys_flock), // 73
sewardj5d2ca932005-04-07 02:23:50 +0000785 GENX_(__NR_fsync, sys_fsync), // 74
njna22a93a2004-11-29 17:28:41 +0000786
sewardj5d2ca932005-04-07 02:23:50 +0000787 GENX_(__NR_fdatasync, sys_fdatasync), // 75
tom507ae562005-07-20 08:46:50 +0000788 GENX_(__NR_truncate, sys_truncate), // 76
sewardjb369c5e2005-03-24 17:52:02 +0000789 GENX_(__NR_ftruncate, sys_ftruncate), // 77
sewardj6941a1a2005-03-02 16:01:23 +0000790 GENXY(__NR_getdents, sys_getdents), // 78
791 GENXY(__NR_getcwd, sys_getcwd), // 79
njna22a93a2004-11-29 17:28:41 +0000792
sewardj6941a1a2005-03-02 16:01:23 +0000793 GENX_(__NR_chdir, sys_chdir), // 80
794 GENX_(__NR_fchdir, sys_fchdir), // 81
tom7286be52005-04-01 23:22:36 +0000795 GENX_(__NR_rename, sys_rename), // 82
796 GENX_(__NR_mkdir, sys_mkdir), // 83
797 GENX_(__NR_rmdir, sys_rmdir), // 84
njna22a93a2004-11-29 17:28:41 +0000798
sewardj33586e52005-03-23 11:41:15 +0000799 GENXY(__NR_creat, sys_creat), // 85
tom7286be52005-04-01 23:22:36 +0000800 GENX_(__NR_link, sys_link), // 86
sewardjc9b7b122005-02-19 22:45:15 +0000801 GENX_(__NR_unlink, sys_unlink), // 87
tom7286be52005-04-01 23:22:36 +0000802 GENX_(__NR_symlink, sys_symlink), // 88
sewardj33586e52005-03-23 11:41:15 +0000803 GENX_(__NR_readlink, sys_readlink), // 89
njna22a93a2004-11-29 17:28:41 +0000804
sewardjc9b7b122005-02-19 22:45:15 +0000805 GENX_(__NR_chmod, sys_chmod), // 90
sewardj5d2ca932005-04-07 02:23:50 +0000806 GENX_(__NR_fchmod, sys_fchmod), // 91
tomb2112c12005-07-05 23:34:44 +0000807 GENX_(__NR_chown, sys_chown), // 92
808 GENX_(__NR_fchown, sys_fchown), // 93
809 GENX_(__NR_lchown, sys_lchown), // 94
njna22a93a2004-11-29 17:28:41 +0000810
sewardj33586e52005-03-23 11:41:15 +0000811 GENX_(__NR_umask, sys_umask), // 95
sewardj6941a1a2005-03-02 16:01:23 +0000812 GENXY(__NR_gettimeofday, sys_gettimeofday), // 96
sewardj987a8eb2005-03-01 19:00:30 +0000813 GENXY(__NR_getrlimit, sys_getrlimit), // 97
sewardj33586e52005-03-23 11:41:15 +0000814 GENXY(__NR_getrusage, sys_getrusage), // 98
tombc49f3d2005-07-19 16:05:49 +0000815 LINXY(__NR_sysinfo, sys_sysinfo), // 99
njna22a93a2004-11-29 17:28:41 +0000816
sewardjb369c5e2005-03-24 17:52:02 +0000817 GENXY(__NR_times, sys_times), // 100
tom2af58f22005-07-22 15:04:14 +0000818 PLAXY(__NR_ptrace, sys_ptrace), // 101
sewardj33586e52005-03-23 11:41:15 +0000819 GENX_(__NR_getuid, sys_getuid), // 102
bart65bfd212008-04-26 10:57:07 +0000820 LINXY(__NR_syslog, sys_syslog), // 103
sewardj6193c092005-03-27 18:20:26 +0000821 GENX_(__NR_getgid, sys_getgid), // 104
njna22a93a2004-11-29 17:28:41 +0000822
tom96375732005-07-19 15:26:33 +0000823 GENX_(__NR_setuid, sys_setuid), // 105
824 GENX_(__NR_setgid, sys_setgid), // 106
sewardj6193c092005-03-27 18:20:26 +0000825 GENX_(__NR_geteuid, sys_geteuid), // 107
826 GENX_(__NR_getegid, sys_getegid), // 108
tom7286be52005-04-01 23:22:36 +0000827 GENX_(__NR_setpgid, sys_setpgid), // 109
njna22a93a2004-11-29 17:28:41 +0000828
sewardj33586e52005-03-23 11:41:15 +0000829 GENX_(__NR_getppid, sys_getppid), // 110
sewardj6193c092005-03-27 18:20:26 +0000830 GENX_(__NR_getpgrp, sys_getpgrp), // 111
tom074edc62005-04-02 17:43:50 +0000831 GENX_(__NR_setsid, sys_setsid), // 112
tombc49f3d2005-07-19 16:05:49 +0000832 GENX_(__NR_setreuid, sys_setreuid), // 113
833 GENX_(__NR_setregid, sys_setregid), // 114
njna22a93a2004-11-29 17:28:41 +0000834
sewardj6193c092005-03-27 18:20:26 +0000835 GENXY(__NR_getgroups, sys_getgroups), // 115
tombc49f3d2005-07-19 16:05:49 +0000836 GENX_(__NR_setgroups, sys_setgroups), // 116
837 LINX_(__NR_setresuid, sys_setresuid), // 117
tom9749a502005-04-01 23:38:37 +0000838 LINXY(__NR_getresuid, sys_getresuid), // 118
tombc49f3d2005-07-19 16:05:49 +0000839 LINX_(__NR_setresgid, sys_setresgid), // 119
njna22a93a2004-11-29 17:28:41 +0000840
tom9749a502005-04-01 23:38:37 +0000841 LINXY(__NR_getresgid, sys_getresgid), // 120
tom074edc62005-04-02 17:43:50 +0000842 GENX_(__NR_getpgid, sys_getpgid), // 121
tom507ae562005-07-20 08:46:50 +0000843 LINX_(__NR_setfsuid, sys_setfsuid), // 122
844 LINX_(__NR_setfsgid, sys_setfsgid), // 123
tom2af58f22005-07-22 15:04:14 +0000845 GENX_(__NR_getsid, sys_getsid), // 124
njna22a93a2004-11-29 17:28:41 +0000846
bart744f9ea2008-08-27 17:41:56 +0000847 LINXY(__NR_capget, sys_capget), // 125
848 LINX_(__NR_capset, sys_capset), // 126
njncd405ea2005-08-31 02:44:31 +0000849 LINXY(__NR_rt_sigpending, sys_rt_sigpending), // 127
850 LINXY(__NR_rt_sigtimedwait, sys_rt_sigtimedwait),// 128
851 LINXY(__NR_rt_sigqueueinfo, sys_rt_sigqueueinfo),// 129
njna22a93a2004-11-29 17:28:41 +0000852
njncd405ea2005-08-31 02:44:31 +0000853 LINX_(__NR_rt_sigsuspend, sys_rt_sigsuspend), // 130
sewardj33586e52005-03-23 11:41:15 +0000854 GENXY(__NR_sigaltstack, sys_sigaltstack), // 131
njncd405ea2005-08-31 02:44:31 +0000855 LINX_(__NR_utime, sys_utime), // 132
tom7286be52005-04-01 23:22:36 +0000856 GENX_(__NR_mknod, sys_mknod), // 133
njna22a93a2004-11-29 17:28:41 +0000857 // (__NR_uselib, sys_uselib), // 134
858
tom2af58f22005-07-22 15:04:14 +0000859 LINX_(__NR_personality, sys_personality), // 135
njna22a93a2004-11-29 17:28:41 +0000860 // (__NR_ustat, sys_ustat), // 136
sewardj33586e52005-03-23 11:41:15 +0000861 GENXY(__NR_statfs, sys_statfs), // 137
tome329b262005-11-21 13:57:49 +0000862 GENXY(__NR_fstatfs, sys_fstatfs), // 138
njna22a93a2004-11-29 17:28:41 +0000863 // (__NR_sysfs, sys_sysfs), // 139
864
tom1a626ab2005-12-01 09:21:37 +0000865 GENX_(__NR_getpriority, sys_getpriority), // 140
866 GENX_(__NR_setpriority, sys_setpriority), // 141
bart2819f142008-07-09 07:39:09 +0000867 LINXY(__NR_sched_setparam, sys_sched_setparam), // 142
njnb2480c92005-08-30 02:17:23 +0000868 LINXY(__NR_sched_getparam, sys_sched_getparam), // 143
869 LINX_(__NR_sched_setscheduler, sys_sched_setscheduler), // 144
njna22a93a2004-11-29 17:28:41 +0000870
njnb2480c92005-08-30 02:17:23 +0000871 LINX_(__NR_sched_getscheduler, sys_sched_getscheduler), // 145
872 LINX_(__NR_sched_get_priority_max, sys_sched_get_priority_max), // 146
873 LINX_(__NR_sched_get_priority_min, sys_sched_get_priority_min), // 147
tomb8b48482009-11-24 16:03:19 +0000874 LINXY(__NR_sched_rr_get_interval, sys_sched_rr_get_interval), // 148
tom686d4ca2005-04-02 11:39:56 +0000875 GENX_(__NR_mlock, sys_mlock), // 149
njna22a93a2004-11-29 17:28:41 +0000876
tom686d4ca2005-04-02 11:39:56 +0000877 GENX_(__NR_munlock, sys_munlock), // 150
878 GENX_(__NR_mlockall, sys_mlockall), // 151
njncd405ea2005-08-31 02:44:31 +0000879 LINX_(__NR_munlockall, sys_munlockall), // 152
tomacb7c342009-11-25 11:54:56 +0000880 LINX_(__NR_vhangup, sys_vhangup), // 153
njna22a93a2004-11-29 17:28:41 +0000881 // (__NR_modify_ldt, sys_modify_ldt), // 154
882
sewardj8a3377f2014-09-08 11:19:48 +0000883 LINX_(__NR_pivot_root, sys_pivot_root), // 155
sewardj02f718f2005-03-23 03:42:26 +0000884 LINXY(__NR__sysctl, sys_sysctl), // 156
toma39ebc82006-12-18 15:22:46 +0000885 LINXY(__NR_prctl, sys_prctl), // 157
njna22a93a2004-11-29 17:28:41 +0000886 PLAX_(__NR_arch_prctl, sys_arch_prctl), // 158
tom9ceaa972009-11-24 16:38:21 +0000887 LINXY(__NR_adjtimex, sys_adjtimex), // 159
njna22a93a2004-11-29 17:28:41 +0000888
sewardjb369c5e2005-03-24 17:52:02 +0000889 GENX_(__NR_setrlimit, sys_setrlimit), // 160
tom7286be52005-04-01 23:22:36 +0000890 GENX_(__NR_chroot, sys_chroot), // 161
tom686d4ca2005-04-02 11:39:56 +0000891 GENX_(__NR_sync, sys_sync), // 162
njna22a93a2004-11-29 17:28:41 +0000892 // (__NR_acct, sys_acct), // 163
tom1b1a2232005-07-20 09:24:04 +0000893 GENX_(__NR_settimeofday, sys_settimeofday), // 164
njna22a93a2004-11-29 17:28:41 +0000894
njnc6168192004-11-29 13:54:10 +0000895 LINX_(__NR_mount, sys_mount), // 165
sewardja58bbbc2006-04-14 01:04:04 +0000896 LINX_(__NR_umount2, sys_umount), // 166
njna22a93a2004-11-29 17:28:41 +0000897 // (__NR_swapon, sys_swapon), // 167
898 // (__NR_swapoff, sys_swapoff), // 168
899 // (__NR_reboot, sys_reboot), // 169
900
tomf93bbd92013-07-17 12:43:30 +0000901 GENX_(__NR_sethostname, sys_sethostname), // 170
njna22a93a2004-11-29 17:28:41 +0000902 // (__NR_setdomainname, sys_setdomainname), // 171
njn877d53e2005-09-30 01:05:53 +0000903 GENX_(__NR_iopl, sys_iopl), // 172
tom2af58f22005-07-22 15:04:14 +0000904 LINX_(__NR_ioperm, sys_ioperm), // 173
bart65bfd212008-04-26 10:57:07 +0000905 GENX_(__NR_create_module, sys_ni_syscall), // 174
njna22a93a2004-11-29 17:28:41 +0000906
bart10ac1442008-06-21 16:28:24 +0000907 LINX_(__NR_init_module, sys_init_module), // 175
908 LINX_(__NR_delete_module, sys_delete_module), // 176
njna22a93a2004-11-29 17:28:41 +0000909 // (__NR_get_kernel_syms, sys_ni_syscall), // 177
910 // (__NR_query_module, sys_ni_syscall), // 178
sewardja4885132008-10-30 13:12:50 +0000911 LINX_(__NR_quotactl, sys_quotactl), // 179
njna22a93a2004-11-29 17:28:41 +0000912
913 // (__NR_nfsservctl, sys_nfsservctl), // 180
914 // (__NR_getpmsg, sys_ni_syscall), // 181
915 // (__NR_putpmsg, sys_ni_syscall), // 182
916 // (__NR_afs_syscall, sys_ni_syscall), // 183
sewardje25e7652006-04-20 14:38:50 +0000917 PLAXY(184, sys_syscall184), // 184 // sys_bproc?
njna22a93a2004-11-29 17:28:41 +0000918
919 // (__NR_security, sys_ni_syscall), // 185
toma8d1ec62005-03-31 16:02:07 +0000920 LINX_(__NR_gettid, sys_gettid), // 186
sewardj792e00a2010-10-04 20:03:27 +0000921 LINX_(__NR_readahead, sys_readahead), // 187
tom1a7bda92005-11-13 00:08:03 +0000922 LINX_(__NR_setxattr, sys_setxattr), // 188
923 LINX_(__NR_lsetxattr, sys_lsetxattr), // 189
njna22a93a2004-11-29 17:28:41 +0000924
tom1a7bda92005-11-13 00:08:03 +0000925 LINX_(__NR_fsetxattr, sys_fsetxattr), // 190
njn65ccc502005-08-30 01:53:54 +0000926 LINXY(__NR_getxattr, sys_getxattr), // 191
tom1a7bda92005-11-13 00:08:03 +0000927 LINXY(__NR_lgetxattr, sys_lgetxattr), // 192
928 LINXY(__NR_fgetxattr, sys_fgetxattr), // 193
929 LINXY(__NR_listxattr, sys_listxattr), // 194
njna22a93a2004-11-29 17:28:41 +0000930
tom1a7bda92005-11-13 00:08:03 +0000931 LINXY(__NR_llistxattr, sys_llistxattr), // 195
932 LINXY(__NR_flistxattr, sys_flistxattr), // 196
933 LINX_(__NR_removexattr, sys_removexattr), // 197
934 LINX_(__NR_lremovexattr, sys_lremovexattr), // 198
935 LINX_(__NR_fremovexattr, sys_fremovexattr), // 199
njna22a93a2004-11-29 17:28:41 +0000936
tomc8cfca62006-02-15 10:34:50 +0000937 LINXY(__NR_tkill, sys_tkill), // 200
sewardj6941a1a2005-03-02 16:01:23 +0000938 GENXY(__NR_time, sys_time), /*was sys_time64*/ // 201
sewardj02f718f2005-03-23 03:42:26 +0000939 LINXY(__NR_futex, sys_futex), // 202
njnb2480c92005-08-30 02:17:23 +0000940 LINX_(__NR_sched_setaffinity, sys_sched_setaffinity), // 203
941 LINXY(__NR_sched_getaffinity, sys_sched_getaffinity), // 204
njna22a93a2004-11-29 17:28:41 +0000942
943 // (__NR_set_thread_area, sys_ni_syscall), // 205
sewardj45f4e7c2005-09-27 19:20:21 +0000944 LINXY(__NR_io_setup, sys_io_setup), // 206
tomb2112c12005-07-05 23:34:44 +0000945 LINX_(__NR_io_destroy, sys_io_destroy), // 207
946 LINXY(__NR_io_getevents, sys_io_getevents), // 208
947 LINX_(__NR_io_submit, sys_io_submit), // 209
njna22a93a2004-11-29 17:28:41 +0000948
tomb2112c12005-07-05 23:34:44 +0000949 LINXY(__NR_io_cancel, sys_io_cancel), // 210
njna22a93a2004-11-29 17:28:41 +0000950 // (__NR_get_thread_area, sys_ni_syscall), // 211
sewardjd3263e52008-11-16 21:40:54 +0000951 LINXY(__NR_lookup_dcookie, sys_lookup_dcookie), // 212
sewardj43557d32005-07-01 08:39:38 +0000952 LINXY(__NR_epoll_create, sys_epoll_create), // 213
njna22a93a2004-11-29 17:28:41 +0000953 // (__NR_epoll_ctl_old, sys_ni_syscall), // 214
954
955 // (__NR_epoll_wait_old, sys_ni_syscall), // 215
956 // (__NR_remap_file_pages, sys_remap_file_pages)// 216
sewardj33586e52005-03-23 11:41:15 +0000957 GENXY(__NR_getdents64, sys_getdents64), // 217
sewardje7aa4ae2005-06-09 12:43:42 +0000958 LINX_(__NR_set_tid_address, sys_set_tid_address),// 218
njna22a93a2004-11-29 17:28:41 +0000959 // (__NR_restart_syscall, sys_restart_syscall),// 219
960
philippe6b087762013-03-01 23:31:09 +0000961 LINX_(__NR_semtimedop, sys_semtimedop), // 220
tom20d35722005-07-27 22:57:18 +0000962 PLAX_(__NR_fadvise64, sys_fadvise64), // 221
njn424c0562005-08-26 03:54:30 +0000963 LINXY(__NR_timer_create, sys_timer_create), // 222
964 LINXY(__NR_timer_settime, sys_timer_settime), // 223
965 LINXY(__NR_timer_gettime, sys_timer_gettime), // 224
njna22a93a2004-11-29 17:28:41 +0000966
njn424c0562005-08-26 03:54:30 +0000967 LINX_(__NR_timer_getoverrun, sys_timer_getoverrun), // 225
968 LINX_(__NR_timer_delete, sys_timer_delete), // 226
njn1588bc02005-08-26 03:49:43 +0000969 LINX_(__NR_clock_settime, sys_clock_settime), // 227
970 LINXY(__NR_clock_gettime, sys_clock_gettime), // 228
971 LINXY(__NR_clock_getres, sys_clock_getres), // 229
njna22a93a2004-11-29 17:28:41 +0000972
njn1588bc02005-08-26 03:49:43 +0000973 LINXY(__NR_clock_nanosleep, sys_clock_nanosleep),// 230
sewardj02f718f2005-03-23 03:42:26 +0000974 LINX_(__NR_exit_group, sys_exit_group), // 231
sewardj43557d32005-07-01 08:39:38 +0000975 LINXY(__NR_epoll_wait, sys_epoll_wait), // 232
976 LINX_(__NR_epoll_ctl, sys_epoll_ctl), // 233
sewardj62601592005-03-26 13:48:19 +0000977 LINXY(__NR_tgkill, sys_tgkill), // 234
njna22a93a2004-11-29 17:28:41 +0000978
tome329b262005-11-21 13:57:49 +0000979 GENX_(__NR_utimes, sys_utimes), // 235
njna22a93a2004-11-29 17:28:41 +0000980 // (__NR_vserver, sys_ni_syscall), // 236
tom70a5cb02005-10-20 17:00:23 +0000981 LINX_(__NR_mbind, sys_mbind), // 237
tom2af58f22005-07-22 15:04:14 +0000982 LINX_(__NR_set_mempolicy, sys_set_mempolicy), // 238
tom95d23cc2005-08-06 18:07:17 +0000983 LINXY(__NR_get_mempolicy, sys_get_mempolicy), // 239
njna22a93a2004-11-29 17:28:41 +0000984
njn4279a882005-08-26 03:43:28 +0000985 LINXY(__NR_mq_open, sys_mq_open), // 240
986 LINX_(__NR_mq_unlink, sys_mq_unlink), // 241
987 LINX_(__NR_mq_timedsend, sys_mq_timedsend), // 242
tom44e534d2010-05-24 13:40:10 +0000988 LINXY(__NR_mq_timedreceive, sys_mq_timedreceive),// 243
njn4279a882005-08-26 03:43:28 +0000989 LINX_(__NR_mq_notify, sys_mq_notify), // 244
njna22a93a2004-11-29 17:28:41 +0000990
njn4279a882005-08-26 03:43:28 +0000991 LINXY(__NR_mq_getsetattr, sys_mq_getsetattr), // 245
njna22a93a2004-11-29 17:28:41 +0000992 // (__NR_kexec_load, sys_ni_syscall), // 246
njncd405ea2005-08-31 02:44:31 +0000993 LINXY(__NR_waitid, sys_waitid), // 247
tom7f4d7e42007-03-07 11:12:13 +0000994 LINX_(__NR_add_key, sys_add_key), // 248
995 LINX_(__NR_request_key, sys_request_key), // 249
tom95d23cc2005-08-06 18:07:17 +0000996
tom7f4d7e42007-03-07 11:12:13 +0000997 LINXY(__NR_keyctl, sys_keyctl), // 250
sewardj7acef082007-03-11 19:28:02 +0000998 LINX_(__NR_ioprio_set, sys_ioprio_set), // 251
tom16dfea42008-12-15 08:58:29 +0000999 LINX_(__NR_ioprio_get, sys_ioprio_get), // 252
tom95d23cc2005-08-06 18:07:17 +00001000 LINX_(__NR_inotify_init, sys_inotify_init), // 253
1001 LINX_(__NR_inotify_add_watch, sys_inotify_add_watch), // 254
1002
1003 LINX_(__NR_inotify_rm_watch, sys_inotify_rm_watch), // 255
tom363ec762006-03-21 10:58:35 +00001004// LINX_(__NR_migrate_pages, sys_migrate_pages), // 256
1005 LINXY(__NR_openat, sys_openat), // 257
1006 LINX_(__NR_mkdirat, sys_mkdirat), // 258
1007 LINX_(__NR_mknodat, sys_mknodat), // 259
1008
1009 LINX_(__NR_fchownat, sys_fchownat), // 260
1010 LINX_(__NR_futimesat, sys_futimesat), // 261
1011 LINXY(__NR_newfstatat, sys_newfstatat), // 262
1012 LINX_(__NR_unlinkat, sys_unlinkat), // 263
1013 LINX_(__NR_renameat, sys_renameat), // 264
1014
1015 LINX_(__NR_linkat, sys_linkat), // 265
1016 LINX_(__NR_symlinkat, sys_symlinkat), // 266
1017 LINX_(__NR_readlinkat, sys_readlinkat), // 267
1018 LINX_(__NR_fchmodat, sys_fchmodat), // 268
1019 LINX_(__NR_faccessat, sys_faccessat), // 269
1020
Elliott Hughesa0664b92017-04-18 17:46:52 -07001021 LINXY(__NR_pselect6, sys_pselect6), // 270
bartf5ceec82008-04-26 07:45:10 +00001022 LINXY(__NR_ppoll, sys_ppoll), // 271
sewardj8a3377f2014-09-08 11:19:48 +00001023 LINX_(__NR_unshare, sys_unshare), // 272
tom05b1f9a2006-05-17 14:24:12 +00001024 LINX_(__NR_set_robust_list, sys_set_robust_list), // 273
1025 LINXY(__NR_get_robust_list, sys_get_robust_list), // 274
tomc4e466f2008-01-08 16:31:25 +00001026
tom110743c2010-02-23 10:49:48 +00001027 LINX_(__NR_splice, sys_splice), // 275
tom5db7a792012-08-08 08:03:44 +00001028 LINX_(__NR_tee, sys_tee), // 276
tomc4e466f2008-01-08 16:31:25 +00001029 LINX_(__NR_sync_file_range, sys_sync_file_range), // 277
tom5db7a792012-08-08 08:03:44 +00001030 LINXY(__NR_vmsplice, sys_vmsplice), // 278
tomd5fb58e2012-04-03 10:51:27 +00001031 LINXY(__NR_move_pages, sys_move_pages), // 279
sewardj586c8152008-11-05 11:20:59 +00001032
bartf5ceec82008-04-26 07:45:10 +00001033 LINX_(__NR_utimensat, sys_utimensat), // 280
1034 LINXY(__NR_epoll_pwait, sys_epoll_pwait), // 281
1035 LINXY(__NR_signalfd, sys_signalfd), // 282
bart5fc7da22008-04-27 12:56:06 +00001036 LINXY(__NR_timerfd_create, sys_timerfd_create), // 283
tom4f5be8c2014-01-30 21:47:30 +00001037 LINXY(__NR_eventfd, sys_eventfd), // 284
sewardj586c8152008-11-05 11:20:59 +00001038
njn0bd71772009-07-15 03:08:35 +00001039 LINX_(__NR_fallocate, sys_fallocate), // 285
bart5fc7da22008-04-27 12:56:06 +00001040 LINXY(__NR_timerfd_settime, sys_timerfd_settime), // 286
1041 LINXY(__NR_timerfd_gettime, sys_timerfd_gettime), // 287
philippe6b087762013-03-01 23:31:09 +00001042 LINXY(__NR_accept4, sys_accept4), // 288
tom6c67ef52009-01-09 16:42:51 +00001043 LINXY(__NR_signalfd4, sys_signalfd4), // 289
sewardj586c8152008-11-05 11:20:59 +00001044
tom4f5be8c2014-01-30 21:47:30 +00001045 LINXY(__NR_eventfd2, sys_eventfd2), // 290
njn72715882009-07-10 12:02:03 +00001046 LINXY(__NR_epoll_create1, sys_epoll_create1), // 291
tomf43793a2009-11-23 08:19:20 +00001047 LINXY(__NR_dup3, sys_dup3), // 292
tom3fbccee2009-10-27 09:19:26 +00001048 LINXY(__NR_pipe2, sys_pipe2), // 293
tom7bb1b1c2009-10-27 14:17:27 +00001049 LINXY(__NR_inotify_init1, sys_inotify_init1), // 294
tom4969c792009-10-27 09:01:43 +00001050
tomd8feb702009-10-28 10:04:11 +00001051 LINXY(__NR_preadv, sys_preadv), // 295
1052 LINX_(__NR_pwritev, sys_pwritev), // 296
tomd18b5412009-11-24 16:08:40 +00001053 LINXY(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo),// 297
tom46d02ab2011-06-08 09:55:54 +00001054 LINXY(__NR_perf_event_open, sys_perf_event_open), // 298
toma4991232012-02-10 11:30:09 +00001055 LINXY(__NR_recvmmsg, sys_recvmmsg), // 299
tom46d02ab2011-06-08 09:55:54 +00001056
tomcec24b52013-07-17 13:58:59 +00001057 LINXY(__NR_fanotify_init, sys_fanotify_init), // 300
1058 LINX_(__NR_fanotify_mark, sys_fanotify_mark), // 301
tom5eac4b52012-02-09 11:48:28 +00001059 LINXY(__NR_prlimit64, sys_prlimit64), // 302
tomf9e5b5e2013-03-03 12:57:20 +00001060 LINXY(__NR_name_to_handle_at, sys_name_to_handle_at),// 303
tom43ca0972013-07-17 13:25:08 +00001061 LINXY(__NR_open_by_handle_at, sys_open_by_handle_at),// 304
tom46d02ab2011-06-08 09:55:54 +00001062
tomddc4a182014-01-30 22:33:02 +00001063 LINXY(__NR_clock_adjtime, sys_clock_adjtime), // 305
tom9e2645c2015-05-07 18:54:31 +00001064 LINX_(__NR_syncfs, sys_syncfs), // 306
tom27640002012-02-10 11:48:01 +00001065 LINXY(__NR_sendmmsg, sys_sendmmsg), // 307
tom46d02ab2011-06-08 09:55:54 +00001066// LINX_(__NR_setns, sys_ni_syscall), // 308
tom9e4b6362012-02-10 09:39:37 +00001067 LINXY(__NR_getcpu, sys_getcpu), // 309
1068
1069 LINXY(__NR_process_vm_readv, sys_process_vm_readv), // 310
sewardj2fee8702014-09-04 10:17:08 +00001070 LINX_(__NR_process_vm_writev, sys_process_vm_writev),// 311
tome6366712014-11-10 09:55:59 +00001071 LINX_(__NR_kcmp, sys_kcmp), // 312
1072// LIN__(__NR_finit_module, sys_ni_syscall), // 313
1073// LIN__(__NR_sched_setattr, sys_ni_syscall), // 314
1074
1075// LIN__(__NR_sched_getattr, sys_ni_syscall), // 315
Elliott Hughesa0664b92017-04-18 17:46:52 -07001076 LINX_(__NR_renameat2, sys_renameat2), // 316
tome6366712014-11-10 09:55:59 +00001077// LIN__(__NR_seccomp, sys_ni_syscall), // 317
tom9d7592e2015-01-19 21:52:44 +00001078 LINXY(__NR_getrandom, sys_getrandom), // 318
1079 LINXY(__NR_memfd_create, sys_memfd_create) // 319
tome6366712014-11-10 09:55:59 +00001080
1081// LIN__(__NR_kexec_file_load, sys_ni_syscall), // 320
1082// LIN__(__NR_bpf, sys_ni_syscall) // 321
njnc6168192004-11-29 13:54:10 +00001083};
1084
sewardj59570ff2010-01-01 11:59:33 +00001085SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno )
1086{
1087 const UInt syscall_table_size
1088 = sizeof(syscall_table) / sizeof(syscall_table[0]);
1089
1090 /* Is it in the contiguous initial section of the table? */
1091 if (sysno < syscall_table_size) {
1092 SyscallTableEntry* sys = &syscall_table[sysno];
1093 if (sys->before == NULL)
1094 return NULL; /* no entry */
1095 else
1096 return sys;
1097 }
1098
1099 /* Can't find a wrapper */
1100 return NULL;
1101}
njn27ce2562004-11-30 15:10:02 +00001102
njn8b68b642009-06-24 00:37:09 +00001103#endif // defined(VGP_amd64_linux)
1104
njnc6168192004-11-29 13:54:10 +00001105/*--------------------------------------------------------------------*/
njn2521d322005-05-08 14:45:13 +00001106/*--- end ---*/
njnc6168192004-11-29 13:54:10 +00001107/*--------------------------------------------------------------------*/