1 2 /*--------------------------------------------------------------------*/ 3 /*--- Platform-specific syscalls stuff. syswrap-ppc32-linux.c ---*/ 4 /*--------------------------------------------------------------------*/ 5 6 /* 7 This file is part of Valgrind, a dynamic binary instrumentation 8 framework. 9 10 Copyright (C) 2005-2017 Nicholas Nethercote <njn (at) valgrind.org> 11 Copyright (C) 2005-2017 Cerion Armour-Brown <cerion (at) open-works.co.uk> 12 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 31 #if defined(VGP_ppc32_linux) 32 33 #include "pub_core_basics.h" 34 #include "pub_core_vki.h" 35 #include "pub_core_vkiscnums.h" 36 #include "pub_core_threadstate.h" 37 #include "pub_core_aspacemgr.h" 38 #include "pub_core_debuglog.h" 39 #include "pub_core_libcbase.h" 40 #include "pub_core_libcassert.h" 41 #include "pub_core_libcprint.h" 42 #include "pub_core_libcproc.h" 43 #include "pub_core_libcsignal.h" 44 #include "pub_core_options.h" 45 #include "pub_core_scheduler.h" 46 #include "pub_core_sigframe.h" // For VG_(sigframe_destroy)() 47 #include "pub_core_signals.h" 48 #include "pub_core_syscall.h" 49 #include "pub_core_syswrap.h" 50 #include "pub_core_tooliface.h" 51 52 #include "priv_types_n_macros.h" 53 #include "priv_syswrap-generic.h" /* for decls of generic wrappers */ 54 #include "priv_syswrap-linux.h" /* for decls of linux-ish wrappers */ 55 #include "priv_syswrap-main.h" 56 57 58 /* --------------------------------------------------------------------- 59 clone() handling 60 ------------------------------------------------------------------ */ 61 62 /* Call f(arg1), but first switch stacks, using 'stack' as the new 63 stack, and use 'retaddr' as f's return-to address. Also, clear all 64 the integer registers before entering f.*/ 65 __attribute__((noreturn)) 66 void ML_(call_on_new_stack_0_1) ( Addr stack, 67 Addr retaddr, 68 void (*f)(Word), 69 Word arg1 ); 70 // r3 = stack 71 // r4 = retaddr 72 // r5 = f 73 // r6 = arg1 74 asm( 75 ".text\n" 76 ".globl vgModuleLocal_call_on_new_stack_0_1\n" 77 "vgModuleLocal_call_on_new_stack_0_1:\n" 78 " mr %r1,%r3\n\t" // stack to %sp 79 " mtlr %r4\n\t" // retaddr to %lr 80 " mtctr %r5\n\t" // f to count reg 81 " mr %r3,%r6\n\t" // arg1 to %r3 82 " li 0,0\n\t" // zero all GP regs 83 " li 4,0\n\t" 84 " li 5,0\n\t" 85 " li 6,0\n\t" 86 " li 7,0\n\t" 87 " li 8,0\n\t" 88 " li 9,0\n\t" 89 " li 10,0\n\t" 90 " li 11,0\n\t" 91 " li 12,0\n\t" 92 " li 13,0\n\t" 93 " li 14,0\n\t" 94 " li 15,0\n\t" 95 " li 16,0\n\t" 96 " li 17,0\n\t" 97 " li 18,0\n\t" 98 " li 19,0\n\t" 99 " li 20,0\n\t" 100 " li 21,0\n\t" 101 " li 22,0\n\t" 102 " li 23,0\n\t" 103 " li 24,0\n\t" 104 " li 25,0\n\t" 105 " li 26,0\n\t" 106 " li 27,0\n\t" 107 " li 28,0\n\t" 108 " li 29,0\n\t" 109 " li 30,0\n\t" 110 " li 31,0\n\t" 111 " mtxer 0\n\t" // CAB: Need this? 112 " mtcr 0\n\t" // CAB: Need this? 113 " bctr\n\t" // jump to dst 114 " trap\n" // should never get here 115 ".previous\n" 116 ); 117 118 119 /* 120 Perform a clone system call. clone is strange because it has 121 fork()-like return-twice semantics, so it needs special 122 handling here. 123 124 Upon entry, we have: 125 126 int (fn)(void*) in r3 127 void* child_stack in r4 128 int flags in r5 129 void* arg in r6 130 pid_t* child_tid in r7 131 pid_t* parent_tid in r8 132 void* ??? in r9 133 134 System call requires: 135 136 int $__NR_clone in r0 (sc number) 137 int flags in r3 (sc arg1) 138 void* child_stack in r4 (sc arg2) 139 pid_t* parent_tid in r5 (sc arg3) 140 ?? child_tls in r6 (sc arg4) 141 pid_t* child_tid in r7 (sc arg5) 142 void* ??? in r8 (sc arg6) 143 144 Returns an Int encoded in the linux-ppc32 way, not a SysRes. 145 */ 146 #define __NR_CLONE VG_STRINGIFY(__NR_clone) 147 #define __NR_EXIT VG_STRINGIFY(__NR_exit) 148 149 // See priv_syswrap-linux.h for arg profile. 150 asm( 151 ".text\n" 152 ".globl do_syscall_clone_ppc32_linux\n" 153 "do_syscall_clone_ppc32_linux:\n" 154 " stwu 1,-32(1)\n" 155 " stw 29,20(1)\n" 156 " stw 30,24(1)\n" 157 " stw 31,28(1)\n" 158 " mr 30,3\n" // preserve fn 159 " mr 31,6\n" // preserve arg 160 161 // setup child stack 162 " rlwinm 4,4,0,~0xf\n" // trim sp to multiple of 16 bytes 163 " li 0,0\n" 164 " stwu 0,-16(4)\n" // make initial stack frame 165 " mr 29,4\n" // preserve sp 166 167 // setup syscall 168 " li 0,"__NR_CLONE"\n" // syscall number 169 " mr 3,5\n" // syscall arg1: flags 170 // r4 already setup // syscall arg2: child_stack 171 " mr 5,8\n" // syscall arg3: parent_tid 172 " mr 6,2\n" // syscall arg4: REAL THREAD tls 173 " mr 7,7\n" // syscall arg5: child_tid 174 " mr 8,8\n" // syscall arg6: ???? 175 " mr 9,9\n" // syscall arg7: ???? 176 177 " sc\n" // clone() 178 179 " mfcr 4\n" // return CR in r4 (low word of ULong) 180 " cmpwi 3,0\n" // child if retval == 0 181 " bne 1f\n" // jump if !child 182 183 /* CHILD - call thread function */ 184 /* Note: 2.4 kernel doesn't set the child stack pointer, 185 so we do it here. 186 That does leave a small window for a signal to be delivered 187 on the wrong stack, unfortunately. */ 188 " mr 1,29\n" 189 " mtctr 30\n" // ctr reg = fn 190 " mr 3,31\n" // r3 = arg 191 " bctrl\n" // call fn() 192 193 // exit with result 194 " li 0,"__NR_EXIT"\n" 195 " sc\n" 196 197 // Exit returned?! 198 " .long 0\n" 199 200 // PARENT or ERROR - return 201 "1: lwz 29,20(1)\n" 202 " lwz 30,24(1)\n" 203 " lwz 31,28(1)\n" 204 " addi 1,1,32\n" 205 " blr\n" 206 ".previous\n" 207 ); 208 209 #undef __NR_CLONE 210 #undef __NR_EXIT 211 212 213 /* --------------------------------------------------------------------- 214 More thread stuff 215 ------------------------------------------------------------------ */ 216 217 void VG_(cleanup_thread) ( ThreadArchState* arch ) 218 { 219 } 220 221 /* --------------------------------------------------------------------- 222 PRE/POST wrappers for ppc32/Linux-specific syscalls 223 ------------------------------------------------------------------ */ 224 225 #define PRE(name) DEFN_PRE_TEMPLATE(ppc32_linux, name) 226 #define POST(name) DEFN_POST_TEMPLATE(ppc32_linux, name) 227 228 /* Add prototypes for the wrappers declared here, so that gcc doesn't 229 harass us for not having prototypes. Really this is a kludge -- 230 the right thing to do is to make these wrappers 'static' since they 231 aren't visible outside this file, but that requires even more macro 232 magic. */ 233 234 DECL_TEMPLATE(ppc32_linux, sys_mmap); 235 DECL_TEMPLATE(ppc32_linux, sys_mmap2); 236 DECL_TEMPLATE(ppc32_linux, sys_stat64); 237 DECL_TEMPLATE(ppc32_linux, sys_lstat64); 238 DECL_TEMPLATE(ppc32_linux, sys_fstatat64); 239 DECL_TEMPLATE(ppc32_linux, sys_fstat64); 240 DECL_TEMPLATE(ppc32_linux, sys_sigreturn); 241 DECL_TEMPLATE(ppc32_linux, sys_rt_sigreturn); 242 DECL_TEMPLATE(ppc32_linux, sys_sigsuspend); 243 DECL_TEMPLATE(ppc32_linux, sys_spu_create); 244 DECL_TEMPLATE(ppc32_linux, sys_spu_run); 245 246 PRE(sys_mmap) 247 { 248 SysRes r; 249 250 PRINT("sys_mmap ( %#lx, %lu, %lu, %lu, %lu, %lu )", 251 ARG1, ARG2, ARG3, ARG4, ARG5, ARG6 ); 252 PRE_REG_READ6(long, "mmap", 253 unsigned long, start, unsigned long, length, 254 unsigned long, prot, unsigned long, flags, 255 unsigned long, fd, unsigned long, offset); 256 257 r = ML_(generic_PRE_sys_mmap)( tid, ARG1, ARG2, ARG3, ARG4, ARG5, 258 (Off64T)ARG6 ); 259 SET_STATUS_from_SysRes(r); 260 } 261 262 PRE(sys_mmap2) 263 { 264 SysRes r; 265 266 // Exactly like old_mmap() except: 267 // - the file offset is specified in 4K units rather than bytes, 268 // so that it can be used for files bigger than 2^32 bytes. 269 PRINT("sys_mmap2 ( %#lx, %lu, %lu, %lu, %lu, %lu )", 270 ARG1, ARG2, ARG3, ARG4, ARG5, ARG6 ); 271 PRE_REG_READ6(long, "mmap2", 272 unsigned long, start, unsigned long, length, 273 unsigned long, prot, unsigned long, flags, 274 unsigned long, fd, unsigned long, offset); 275 276 r = ML_(generic_PRE_sys_mmap)( tid, ARG1, ARG2, ARG3, ARG4, ARG5, 277 4096 * (Off64T)ARG6 ); 278 SET_STATUS_from_SysRes(r); 279 } 280 281 // XXX: lstat64/fstat64/stat64 are generic, but not necessarily 282 // applicable to every architecture -- I think only to 32-bit archs. 283 // We're going to need something like linux/core_os32.h for such 284 // things, eventually, I think. --njn 285 PRE(sys_stat64) 286 { 287 PRINT("sys_stat64 ( %#lx, %#lx )",ARG1,ARG2); 288 PRE_REG_READ2(long, "stat64", char *, file_name, struct stat64 *, buf); 289 PRE_MEM_RASCIIZ( "stat64(file_name)", ARG1 ); 290 PRE_MEM_WRITE( "stat64(buf)", ARG2, sizeof(struct vki_stat64) ); 291 } 292 293 POST(sys_stat64) 294 { 295 POST_MEM_WRITE( ARG2, sizeof(struct vki_stat64) ); 296 } 297 298 PRE(sys_lstat64) 299 { 300 PRINT("sys_lstat64 ( %#lx(%s), %#lx )", ARG1, (HChar*)ARG1, ARG2); 301 PRE_REG_READ2(long, "lstat64", char *, file_name, struct stat64 *, buf); 302 PRE_MEM_RASCIIZ( "lstat64(file_name)", ARG1 ); 303 PRE_MEM_WRITE( "lstat64(buf)", ARG2, sizeof(struct vki_stat64) ); 304 } 305 306 POST(sys_lstat64) 307 { 308 vg_assert(SUCCESS); 309 if (RES == 0) { 310 POST_MEM_WRITE( ARG2, sizeof(struct vki_stat64) ); 311 } 312 } 313 314 PRE(sys_fstatat64) 315 { 316 PRINT("sys_fstatat64 ( %ld, %#lx(%s), %#lx )", SARG1, ARG2, (HChar*)ARG2, 317 ARG3); 318 PRE_REG_READ3(long, "fstatat64", 319 int, dfd, char *, file_name, struct stat64 *, buf); 320 PRE_MEM_RASCIIZ( "fstatat64(file_name)", ARG2 ); 321 PRE_MEM_WRITE( "fstatat64(buf)", ARG3, sizeof(struct vki_stat64) ); 322 } 323 324 POST(sys_fstatat64) 325 { 326 POST_MEM_WRITE( ARG3, sizeof(struct vki_stat64) ); 327 } 328 329 PRE(sys_fstat64) 330 { 331 PRINT("sys_fstat64 ( %lu, %#lx )", ARG1, ARG2); 332 PRE_REG_READ2(long, "fstat64", unsigned long, fd, struct stat64 *, buf); 333 PRE_MEM_WRITE( "fstat64(buf)", ARG2, sizeof(struct vki_stat64) ); 334 } 335 336 POST(sys_fstat64) 337 { 338 POST_MEM_WRITE( ARG2, sizeof(struct vki_stat64) ); 339 } 340 341 342 343 //.. PRE(old_select, MayBlock) 344 //.. { 345 //.. /* struct sel_arg_struct { 346 //.. unsigned long n; 347 //.. fd_set *inp, *outp, *exp; 348 //.. struct timeval *tvp; 349 //.. }; 350 //.. */ 351 //.. PRE_REG_READ1(long, "old_select", struct sel_arg_struct *, args); 352 //.. PRE_MEM_READ( "old_select(args)", ARG1, 5*sizeof(UWord) ); 353 //.. 354 //.. { 355 //.. UInt* arg_struct = (UInt*)ARG1; 356 //.. UInt a1, a2, a3, a4, a5; 357 //.. 358 //.. a1 = arg_struct[0]; 359 //.. a2 = arg_struct[1]; 360 //.. a3 = arg_struct[2]; 361 //.. a4 = arg_struct[3]; 362 //.. a5 = arg_struct[4]; 363 //.. 364 //.. PRINT("old_select ( %d, %p, %p, %p, %p )", a1,a2,a3,a4,a5); 365 //.. if (a2 != (Addr)NULL) 366 //.. PRE_MEM_READ( "old_select(readfds)", a2, a1/8 /* __FD_SETSIZE/8 */ ); 367 //.. if (a3 != (Addr)NULL) 368 //.. PRE_MEM_READ( "old_select(writefds)", a3, a1/8 /* __FD_SETSIZE/8 */ ); 369 //.. if (a4 != (Addr)NULL) 370 //.. PRE_MEM_READ( "old_select(exceptfds)", a4, a1/8 /* __FD_SETSIZE/8 */ ); 371 //.. if (a5 != (Addr)NULL) 372 //.. PRE_MEM_READ( "old_select(timeout)", a5, sizeof(struct vki_timeval) ); 373 //.. } 374 //.. } 375 376 PRE(sys_sigreturn) 377 { 378 /* See comments on PRE(sys_rt_sigreturn) in syswrap-amd64-linux.c for 379 an explanation of what follows. */ 380 381 //ThreadState* tst; 382 PRINT("sys_sigreturn ( )"); 383 384 vg_assert(VG_(is_valid_tid)(tid)); 385 vg_assert(tid >= 1 && tid < VG_N_THREADS); 386 vg_assert(VG_(is_running_thread)(tid)); 387 388 ///* Adjust esp to point to start of frame; skip back up over 389 // sigreturn sequence's "popl %eax" and handler ret addr */ 390 //tst = VG_(get_ThreadState)(tid); 391 //tst->arch.vex.guest_ESP -= sizeof(Addr)+sizeof(Word); 392 // Should we do something equivalent on ppc32? Who knows. 393 394 ///* This is only so that the EIP is (might be) useful to report if 395 // something goes wrong in the sigreturn */ 396 //ML_(fixup_guest_state_to_restart_syscall)(&tst->arch); 397 // Should we do something equivalent on ppc32? Who knows. 398 399 /* Restore register state from frame and remove it */ 400 VG_(sigframe_destroy)(tid, False); 401 402 /* Tell the driver not to update the guest state with the "result", 403 and set a bogus result to keep it happy. */ 404 *flags |= SfNoWriteResult; 405 SET_STATUS_Success(0); 406 407 /* Check to see if any signals arose as a result of this. */ 408 *flags |= SfPollAfter; 409 } 410 411 PRE(sys_rt_sigreturn) 412 { 413 /* See comments on PRE(sys_rt_sigreturn) in syswrap-amd64-linux.c for 414 an explanation of what follows. */ 415 416 //ThreadState* tst; 417 PRINT("rt_sigreturn ( )"); 418 419 vg_assert(VG_(is_valid_tid)(tid)); 420 vg_assert(tid >= 1 && tid < VG_N_THREADS); 421 vg_assert(VG_(is_running_thread)(tid)); 422 423 ///* Adjust esp to point to start of frame; skip back up over handler 424 // ret addr */ 425 //tst = VG_(get_ThreadState)(tid); 426 //tst->arch.vex.guest_ESP -= sizeof(Addr); 427 // Should we do something equivalent on ppc32? Who knows. 428 429 ///* This is only so that the EIP is (might be) useful to report if 430 // something goes wrong in the sigreturn */ 431 //ML_(fixup_guest_state_to_restart_syscall)(&tst->arch); 432 // Should we do something equivalent on ppc32? Who knows. 433 434 /* Restore register state from frame and remove it */ 435 VG_(sigframe_destroy)(tid, True); 436 437 /* Tell the driver not to update the guest state with the "result", 438 and set a bogus result to keep it happy. */ 439 *flags |= SfNoWriteResult; 440 SET_STATUS_Success(0); 441 442 /* Check to see if any signals arose as a result of this. */ 443 *flags |= SfPollAfter; 444 } 445 446 447 //.. PRE(sys_modify_ldt, Special) 448 //.. { 449 //.. PRINT("sys_modify_ldt ( %d, %p, %d )", ARG1,ARG2,ARG3); 450 //.. PRE_REG_READ3(int, "modify_ldt", int, func, void *, ptr, 451 //.. unsigned long, bytecount); 452 //.. 453 //.. if (ARG1 == 0) { 454 //.. /* read the LDT into ptr */ 455 //.. PRE_MEM_WRITE( "modify_ldt(ptr)", ARG2, ARG3 ); 456 //.. } 457 //.. if (ARG1 == 1 || ARG1 == 0x11) { 458 //.. /* write the LDT with the entry pointed at by ptr */ 459 //.. PRE_MEM_READ( "modify_ldt(ptr)", ARG2, sizeof(vki_modify_ldt_t) ); 460 //.. } 461 //.. /* "do" the syscall ourselves; the kernel never sees it */ 462 //.. SET_RESULT( VG_(sys_modify_ldt)( tid, ARG1, (void*)ARG2, ARG3 ) ); 463 //.. 464 //.. if (ARG1 == 0 && !VG_(is_kerror)(RES) && RES > 0) { 465 //.. POST_MEM_WRITE( ARG2, RES ); 466 //.. } 467 //.. } 468 469 //.. PRE(sys_set_thread_area, Special) 470 //.. { 471 //.. PRINT("sys_set_thread_area ( %p )", ARG1); 472 //.. PRE_REG_READ1(int, "set_thread_area", struct user_desc *, u_info) 473 //.. PRE_MEM_READ( "set_thread_area(u_info)", ARG1, sizeof(vki_modify_ldt_t) ); 474 //.. 475 //.. /* "do" the syscall ourselves; the kernel never sees it */ 476 //.. SET_RESULT( VG_(sys_set_thread_area)( tid, (void *)ARG1 ) ); 477 //.. } 478 479 //.. PRE(sys_get_thread_area, Special) 480 //.. { 481 //.. PRINT("sys_get_thread_area ( %p )", ARG1); 482 //.. PRE_REG_READ1(int, "get_thread_area", struct user_desc *, u_info) 483 //.. PRE_MEM_WRITE( "get_thread_area(u_info)", ARG1, sizeof(vki_modify_ldt_t) ); 484 //.. 485 //.. /* "do" the syscall ourselves; the kernel never sees it */ 486 //.. SET_RESULT( VG_(sys_get_thread_area)( tid, (void *)ARG1 ) ); 487 //.. 488 //.. if (!VG_(is_kerror)(RES)) { 489 //.. POST_MEM_WRITE( ARG1, sizeof(vki_modify_ldt_t) ); 490 //.. } 491 //.. } 492 493 //.. // Parts of this are ppc32-specific, but the *PEEK* cases are generic. 494 //.. // XXX: Why is the memory pointed to by ARG3 never checked? 495 //.. PRE(sys_ptrace, 0) 496 //.. { 497 //.. PRINT("sys_ptrace ( %d, %d, %p, %p )", ARG1,ARG2,ARG3,ARG4); 498 //.. PRE_REG_READ4(int, "ptrace", 499 //.. long, request, long, pid, long, addr, long, data); 500 //.. switch (ARG1) { 501 //.. case VKI_PTRACE_PEEKTEXT: 502 //.. case VKI_PTRACE_PEEKDATA: 503 //.. case VKI_PTRACE_PEEKUSR: 504 //.. PRE_MEM_WRITE( "ptrace(peek)", ARG4, 505 //.. sizeof (long)); 506 //.. break; 507 //.. case VKI_PTRACE_GETREGS: 508 //.. PRE_MEM_WRITE( "ptrace(getregs)", ARG4, 509 //.. sizeof (struct vki_user_regs_struct)); 510 //.. break; 511 //.. case VKI_PTRACE_GETFPREGS: 512 //.. PRE_MEM_WRITE( "ptrace(getfpregs)", ARG4, 513 //.. sizeof (struct vki_user_i387_struct)); 514 //.. break; 515 //.. case VKI_PTRACE_GETFPXREGS: 516 //.. PRE_MEM_WRITE( "ptrace(getfpxregs)", ARG4, 517 //.. sizeof(struct vki_user_fxsr_struct) ); 518 //.. break; 519 //.. case VKI_PTRACE_SETREGS: 520 //.. PRE_MEM_READ( "ptrace(setregs)", ARG4, 521 //.. sizeof (struct vki_user_regs_struct)); 522 //.. break; 523 //.. case VKI_PTRACE_SETFPREGS: 524 //.. PRE_MEM_READ( "ptrace(setfpregs)", ARG4, 525 //.. sizeof (struct vki_user_i387_struct)); 526 //.. break; 527 //.. case VKI_PTRACE_SETFPXREGS: 528 //.. PRE_MEM_READ( "ptrace(setfpxregs)", ARG4, 529 //.. sizeof(struct vki_user_fxsr_struct) ); 530 //.. break; 531 //.. default: 532 //.. break; 533 //.. } 534 //.. } 535 536 //.. POST(sys_ptrace) 537 //.. { 538 //.. switch (ARG1) { 539 //.. case VKI_PTRACE_PEEKTEXT: 540 //.. case VKI_PTRACE_PEEKDATA: 541 //.. case VKI_PTRACE_PEEKUSR: 542 //.. POST_MEM_WRITE( ARG4, sizeof (long)); 543 //.. break; 544 //.. case VKI_PTRACE_GETREGS: 545 //.. POST_MEM_WRITE( ARG4, sizeof (struct vki_user_regs_struct)); 546 //.. break; 547 //.. case VKI_PTRACE_GETFPREGS: 548 //.. POST_MEM_WRITE( ARG4, sizeof (struct vki_user_i387_struct)); 549 //.. break; 550 //.. case VKI_PTRACE_GETFPXREGS: 551 //.. POST_MEM_WRITE( ARG4, sizeof(struct vki_user_fxsr_struct) ); 552 //.. break; 553 //.. default: 554 //.. break; 555 //.. } 556 //.. } 557 558 /* NB: This is an almost identical clone of versions for x86-linux and 559 arm-linux, which are themselves literally identical. */ 560 PRE(sys_sigsuspend) 561 { 562 /* The C library interface to sigsuspend just takes a pointer to 563 a signal mask but this system call only takes the first word of 564 the signal mask as an argument so only 32 signals are supported. 565 566 In fact glibc normally uses rt_sigsuspend if it is available as 567 that takes a pointer to the signal mask so supports more signals. 568 */ 569 *flags |= SfMayBlock; 570 PRINT("sys_sigsuspend ( %lu )", ARG1 ); 571 PRE_REG_READ1(int, "sigsuspend", vki_old_sigset_t, mask); 572 } 573 574 PRE(sys_spu_create) 575 { 576 PRE_MEM_RASCIIZ("stat64(filename)", ARG1); 577 } 578 POST(sys_spu_create) 579 { 580 vg_assert(SUCCESS); 581 } 582 583 PRE(sys_spu_run) 584 { 585 *flags |= SfMayBlock; 586 if (ARG2 != 0) 587 PRE_MEM_WRITE("npc", ARG2, sizeof(unsigned int)); 588 PRE_MEM_READ("event", ARG3, sizeof(unsigned int)); 589 } 590 POST(sys_spu_run) 591 { 592 if (ARG2 != 0) 593 POST_MEM_WRITE(ARG2, sizeof(unsigned int)); 594 } 595 596 #undef PRE 597 #undef POST 598 599 /* --------------------------------------------------------------------- 600 The ppc32/Linux syscall table 601 ------------------------------------------------------------------ */ 602 603 /* Add an ppc32-linux specific wrapper to a syscall table. */ 604 #define PLAX_(sysno, name) WRAPPER_ENTRY_X_(ppc32_linux, sysno, name) 605 #define PLAXY(sysno, name) WRAPPER_ENTRY_XY(ppc32_linux, sysno, name) 606 607 // This table maps from __NR_xxx syscall numbers (from 608 // linux/include/asm-ppc/unistd.h) to the appropriate PRE/POST sys_foo() 609 // wrappers on ppc32 (as per sys_call_table in linux/arch/ppc/kernel/entry.S). 610 // 611 // For those syscalls not handled by Valgrind, the annotation indicate its 612 // arch/OS combination, eg. */* (generic), */Linux (Linux only), ?/? 613 // (unknown). 614 615 static SyscallTableEntry syscall_table[] = { 616 //.. (restart_syscall) // 0 617 GENX_(__NR_exit, sys_exit), // 1 618 GENX_(__NR_fork, sys_fork), // 2 619 GENXY(__NR_read, sys_read), // 3 620 GENX_(__NR_write, sys_write), // 4 621 622 GENXY(__NR_open, sys_open), // 5 623 GENXY(__NR_close, sys_close), // 6 624 GENXY(__NR_waitpid, sys_waitpid), // 7 625 GENXY(__NR_creat, sys_creat), // 8 626 GENX_(__NR_link, sys_link), // 9 627 628 GENX_(__NR_unlink, sys_unlink), // 10 629 GENX_(__NR_execve, sys_execve), // 11 630 GENX_(__NR_chdir, sys_chdir), // 12 631 GENXY(__NR_time, sys_time), // 13 632 GENX_(__NR_mknod, sys_mknod), // 14 633 //.. 634 GENX_(__NR_chmod, sys_chmod), // 15 635 GENX_(__NR_lchown, sys_lchown), // 16 ## P 636 //.. GENX_(__NR_break, sys_ni_syscall), // 17 637 //.. // (__NR_oldstat, sys_stat), // 18 (obsolete) 638 LINX_(__NR_lseek, sys_lseek), // 19 639 //.. 640 GENX_(__NR_getpid, sys_getpid), // 20 641 LINX_(__NR_mount, sys_mount), // 21 642 LINX_(__NR_umount, sys_oldumount), // 22 643 GENX_(__NR_setuid, sys_setuid), // 23 ## P 644 GENX_(__NR_getuid, sys_getuid), // 24 ## P 645 //.. 646 //.. // (__NR_stime, sys_stime), // 25 * (SVr4,SVID,X/OPEN) 647 //.. PLAXY(__NR_ptrace, sys_ptrace), // 26 648 GENX_(__NR_alarm, sys_alarm), // 27 649 //.. // (__NR_oldfstat, sys_fstat), // 28 * L -- obsolete 650 GENX_(__NR_pause, sys_pause), // 29 651 //.. 652 LINX_(__NR_utime, sys_utime), // 30 653 //.. GENX_(__NR_stty, sys_ni_syscall), // 31 654 //.. GENX_(__NR_gtty, sys_ni_syscall), // 32 655 GENX_(__NR_access, sys_access), // 33 656 //.. GENX_(__NR_nice, sys_nice), // 34 657 //.. 658 //.. GENX_(__NR_ftime, sys_ni_syscall), // 35 659 GENX_(__NR_sync, sys_sync), // 36 660 GENX_(__NR_kill, sys_kill), // 37 661 GENX_(__NR_rename, sys_rename), // 38 662 GENX_(__NR_mkdir, sys_mkdir), // 39 663 664 GENX_(__NR_rmdir, sys_rmdir), // 40 665 GENXY(__NR_dup, sys_dup), // 41 666 LINXY(__NR_pipe, sys_pipe), // 42 667 GENXY(__NR_times, sys_times), // 43 668 //.. GENX_(__NR_prof, sys_ni_syscall), // 44 669 //.. 670 GENX_(__NR_brk, sys_brk), // 45 671 GENX_(__NR_setgid, sys_setgid), // 46 672 GENX_(__NR_getgid, sys_getgid), // 47 673 //.. // (__NR_signal, sys_signal), // 48 */* (ANSI C) 674 GENX_(__NR_geteuid, sys_geteuid), // 49 675 676 GENX_(__NR_getegid, sys_getegid), // 50 677 //.. GENX_(__NR_acct, sys_acct), // 51 678 LINX_(__NR_umount2, sys_umount), // 52 679 //.. GENX_(__NR_lock, sys_ni_syscall), // 53 680 LINXY(__NR_ioctl, sys_ioctl), // 54 681 //.. 682 LINXY(__NR_fcntl, sys_fcntl), // 55 683 //.. GENX_(__NR_mpx, sys_ni_syscall), // 56 684 GENX_(__NR_setpgid, sys_setpgid), // 57 685 //.. GENX_(__NR_ulimit, sys_ni_syscall), // 58 686 //.. // (__NR_oldolduname, sys_olduname), // 59 Linux -- obsolete 687 688 GENX_(__NR_umask, sys_umask), // 60 689 GENX_(__NR_chroot, sys_chroot), // 61 690 //.. // (__NR_ustat, sys_ustat) // 62 SVr4 -- deprecated 691 GENXY(__NR_dup2, sys_dup2), // 63 692 GENX_(__NR_getppid, sys_getppid), // 64 693 694 GENX_(__NR_getpgrp, sys_getpgrp), // 65 695 GENX_(__NR_setsid, sys_setsid), // 66 696 LINXY(__NR_sigaction, sys_sigaction), // 67 697 //.. // (__NR_sgetmask, sys_sgetmask), // 68 */* (ANSI C) 698 //.. // (__NR_ssetmask, sys_ssetmask), // 69 */* (ANSI C) 699 //.. 700 GENX_(__NR_setreuid, sys_setreuid), // 70 701 GENX_(__NR_setregid, sys_setregid), // 71 702 PLAX_(__NR_sigsuspend, sys_sigsuspend), // 72 703 LINXY(__NR_sigpending, sys_sigpending), // 73 704 //.. // (__NR_sethostname, sys_sethostname), // 74 */* 705 //.. 706 GENX_(__NR_setrlimit, sys_setrlimit), // 75 707 //.. GENXY(__NR_getrlimit, sys_old_getrlimit), // 76 708 GENXY(__NR_getrusage, sys_getrusage), // 77 709 GENXY(__NR_gettimeofday, sys_gettimeofday), // 78 710 //.. GENX_(__NR_settimeofday, sys_settimeofday), // 79 711 //.. 712 GENXY(__NR_getgroups, sys_getgroups), // 80 713 GENX_(__NR_setgroups, sys_setgroups), // 81 714 //.. PLAX_(__NR_select, old_select), // 82 715 GENX_(__NR_symlink, sys_symlink), // 83 716 //.. // (__NR_oldlstat, sys_lstat), // 84 -- obsolete 717 //.. 718 GENX_(__NR_readlink, sys_readlink), // 85 719 //.. // (__NR_uselib, sys_uselib), // 86 */Linux 720 //.. // (__NR_swapon, sys_swapon), // 87 */Linux 721 //.. // (__NR_reboot, sys_reboot), // 88 */Linux 722 //.. // (__NR_readdir, old_readdir), // 89 -- superseded 723 724 PLAX_(__NR_mmap, sys_mmap), // 90 725 GENXY(__NR_munmap, sys_munmap), // 91 726 GENX_(__NR_truncate, sys_truncate), // 92 727 GENX_(__NR_ftruncate, sys_ftruncate), // 93 728 GENX_(__NR_fchmod, sys_fchmod), // 94 729 730 GENX_(__NR_fchown, sys_fchown), // 95 731 GENX_(__NR_getpriority, sys_getpriority), // 96 732 GENX_(__NR_setpriority, sys_setpriority), // 97 733 //.. GENX_(__NR_profil, sys_ni_syscall), // 98 734 GENXY(__NR_statfs, sys_statfs), // 99 735 //.. 736 GENXY(__NR_fstatfs, sys_fstatfs), // 100 737 //.. LINX_(__NR_ioperm, sys_ioperm), // 101 738 LINXY(__NR_socketcall, sys_socketcall), // 102 739 LINXY(__NR_syslog, sys_syslog), // 103 740 GENXY(__NR_setitimer, sys_setitimer), // 104 741 742 GENXY(__NR_getitimer, sys_getitimer), // 105 743 GENXY(__NR_stat, sys_newstat), // 106 744 GENXY(__NR_lstat, sys_newlstat), // 107 745 GENXY(__NR_fstat, sys_newfstat), // 108 746 //.. // (__NR_olduname, sys_uname), // 109 -- obsolete 747 //.. 748 //.. GENX_(__NR_iopl, sys_iopl), // 110 749 LINX_(__NR_vhangup, sys_vhangup), // 111 750 //.. GENX_(__NR_idle, sys_ni_syscall), // 112 751 //.. // (__NR_vm86old, sys_vm86old), // 113 x86/Linux-only 752 GENXY(__NR_wait4, sys_wait4), // 114 753 //.. 754 //.. // (__NR_swapoff, sys_swapoff), // 115 */Linux 755 LINXY(__NR_sysinfo, sys_sysinfo), // 116 756 LINXY(__NR_ipc, sys_ipc), // 117 757 GENX_(__NR_fsync, sys_fsync), // 118 758 PLAX_(__NR_sigreturn, sys_sigreturn), // 119 ?/Linux 759 //.. 760 LINX_(__NR_clone, sys_clone), // 120 761 //.. // (__NR_setdomainname, sys_setdomainname), // 121 */*(?) 762 GENXY(__NR_uname, sys_newuname), // 122 763 //.. PLAX_(__NR_modify_ldt, sys_modify_ldt), // 123 764 LINXY(__NR_adjtimex, sys_adjtimex), // 124 765 766 GENXY(__NR_mprotect, sys_mprotect), // 125 767 LINXY(__NR_sigprocmask, sys_sigprocmask), // 126 768 GENX_(__NR_create_module, sys_ni_syscall), // 127 769 LINX_(__NR_init_module, sys_init_module), // 128 770 LINX_(__NR_delete_module, sys_delete_module), // 129 771 //.. 772 //.. // Nb: get_kernel_syms() was removed 2.4-->2.6 773 //.. GENX_(__NR_get_kernel_syms, sys_ni_syscall), // 130 774 //.. LINX_(__NR_quotactl, sys_quotactl), // 131 775 GENX_(__NR_getpgid, sys_getpgid), // 132 776 GENX_(__NR_fchdir, sys_fchdir), // 133 777 //.. // (__NR_bdflush, sys_bdflush), // 134 */Linux 778 //.. 779 //.. // (__NR_sysfs, sys_sysfs), // 135 SVr4 780 LINX_(__NR_personality, sys_personality), // 136 781 //.. GENX_(__NR_afs_syscall, sys_ni_syscall), // 137 782 LINX_(__NR_setfsuid, sys_setfsuid), // 138 783 LINX_(__NR_setfsgid, sys_setfsgid), // 139 784 785 LINXY(__NR__llseek, sys_llseek), // 140 786 GENXY(__NR_getdents, sys_getdents), // 141 787 GENX_(__NR__newselect, sys_select), // 142 788 GENX_(__NR_flock, sys_flock), // 143 789 GENX_(__NR_msync, sys_msync), // 144 790 //.. 791 GENXY(__NR_readv, sys_readv), // 145 792 GENX_(__NR_writev, sys_writev), // 146 793 GENX_(__NR_getsid, sys_getsid), // 147 794 GENX_(__NR_fdatasync, sys_fdatasync), // 148 795 LINXY(__NR__sysctl, sys_sysctl), // 149 796 //.. 797 GENX_(__NR_mlock, sys_mlock), // 150 798 GENX_(__NR_munlock, sys_munlock), // 151 799 GENX_(__NR_mlockall, sys_mlockall), // 152 800 LINX_(__NR_munlockall, sys_munlockall), // 153 801 LINXY(__NR_sched_setparam, sys_sched_setparam), // 154 802 //.. 803 LINXY(__NR_sched_getparam, sys_sched_getparam), // 155 804 LINX_(__NR_sched_setscheduler, sys_sched_setscheduler), // 156 805 LINX_(__NR_sched_getscheduler, sys_sched_getscheduler), // 157 806 LINX_(__NR_sched_yield, sys_sched_yield), // 158 807 LINX_(__NR_sched_get_priority_max, sys_sched_get_priority_max),// 159 808 809 LINX_(__NR_sched_get_priority_min, sys_sched_get_priority_min),// 160 810 LINXY(__NR_sched_rr_get_interval, sys_sched_rr_get_interval), // 161 811 GENXY(__NR_nanosleep, sys_nanosleep), // 162 812 GENX_(__NR_mremap, sys_mremap), // 163 813 LINX_(__NR_setresuid, sys_setresuid), // 164 814 815 LINXY(__NR_getresuid, sys_getresuid), // 165 816 817 //.. GENX_(__NR_query_module, sys_ni_syscall), // 166 818 GENXY(__NR_poll, sys_poll), // 167 819 //.. // (__NR_nfsservctl, sys_nfsservctl), // 168 */Linux 820 //.. 821 LINX_(__NR_setresgid, sys_setresgid), // 169 822 LINXY(__NR_getresgid, sys_getresgid), // 170 823 LINXY(__NR_prctl, sys_prctl), // 171 824 PLAX_(__NR_rt_sigreturn, sys_rt_sigreturn), // 172 825 LINXY(__NR_rt_sigaction, sys_rt_sigaction), // 173 826 827 LINXY(__NR_rt_sigprocmask, sys_rt_sigprocmask), // 174 828 LINXY(__NR_rt_sigpending, sys_rt_sigpending), // 175 829 LINXY(__NR_rt_sigtimedwait, sys_rt_sigtimedwait), // 176 830 LINXY(__NR_rt_sigqueueinfo, sys_rt_sigqueueinfo), // 177 831 LINX_(__NR_rt_sigsuspend, sys_rt_sigsuspend), // 178 832 833 GENXY(__NR_pread64, sys_pread64), // 179 834 GENX_(__NR_pwrite64, sys_pwrite64), // 180 835 GENX_(__NR_chown, sys_chown), // 181 836 GENXY(__NR_getcwd, sys_getcwd), // 182 837 LINXY(__NR_capget, sys_capget), // 183 838 LINX_(__NR_capset, sys_capset), // 184 839 GENXY(__NR_sigaltstack, sys_sigaltstack), // 185 840 LINXY(__NR_sendfile, sys_sendfile), // 186 841 //.. GENXY(__NR_getpmsg, sys_getpmsg), // 187 842 //.. GENX_(__NR_putpmsg, sys_putpmsg), // 188 843 844 // Nb: we treat vfork as fork 845 GENX_(__NR_vfork, sys_fork), // 189 846 GENXY(__NR_ugetrlimit, sys_getrlimit), // 190 847 LINX_(__NR_readahead, sys_readahead), // 191 */Linux 848 PLAX_(__NR_mmap2, sys_mmap2), // 192 849 GENX_(__NR_truncate64, sys_truncate64), // 193 850 GENX_(__NR_ftruncate64, sys_ftruncate64), // 194 851 //.. 852 853 PLAXY(__NR_stat64, sys_stat64), // 195 854 PLAXY(__NR_lstat64, sys_lstat64), // 196 855 PLAXY(__NR_fstat64, sys_fstat64), // 197 856 857 // __NR_pciconfig_read // 198 858 // __NR_pciconfig_write // 199 859 // __NR_pciconfig_iobase // 200 860 // __NR_multiplexer // 201 861 862 GENXY(__NR_getdents64, sys_getdents64), // 202 863 LINX_(__NR_pivot_root, sys_pivot_root), // 203 864 LINXY(__NR_fcntl64, sys_fcntl64), // 204 865 GENX_(__NR_madvise, sys_madvise), // 205 866 GENXY(__NR_mincore, sys_mincore), // 206 867 LINX_(__NR_gettid, sys_gettid), // 207 868 //.. LINX_(__NR_tkill, sys_tkill), // 208 */Linux 869 LINX_(__NR_setxattr, sys_setxattr), // 209 870 LINX_(__NR_lsetxattr, sys_lsetxattr), // 210 871 LINX_(__NR_fsetxattr, sys_fsetxattr), // 211 872 LINXY(__NR_getxattr, sys_getxattr), // 212 873 LINXY(__NR_lgetxattr, sys_lgetxattr), // 213 874 LINXY(__NR_fgetxattr, sys_fgetxattr), // 214 875 LINXY(__NR_listxattr, sys_listxattr), // 215 876 LINXY(__NR_llistxattr, sys_llistxattr), // 216 877 LINXY(__NR_flistxattr, sys_flistxattr), // 217 878 LINX_(__NR_removexattr, sys_removexattr), // 218 879 LINX_(__NR_lremovexattr, sys_lremovexattr), // 219 880 LINX_(__NR_fremovexattr, sys_fremovexattr), // 220 881 882 LINXY(__NR_futex, sys_futex), // 221 883 LINX_(__NR_sched_setaffinity, sys_sched_setaffinity), // 222 884 LINXY(__NR_sched_getaffinity, sys_sched_getaffinity), // 223 885 /* 224 currently unused */ 886 887 // __NR_tuxcall // 225 888 889 LINXY(__NR_sendfile64, sys_sendfile64), // 226 890 //.. 891 LINX_(__NR_io_setup, sys_io_setup), // 227 892 LINX_(__NR_io_destroy, sys_io_destroy), // 228 893 LINXY(__NR_io_getevents, sys_io_getevents), // 229 894 LINX_(__NR_io_submit, sys_io_submit), // 230 895 LINXY(__NR_io_cancel, sys_io_cancel), // 231 896 //.. 897 LINX_(__NR_set_tid_address, sys_set_tid_address), // 232 898 899 LINX_(__NR_fadvise64, sys_fadvise64), // 233 */(Linux?) 900 LINX_(__NR_exit_group, sys_exit_group), // 234 901 //.. GENXY(__NR_lookup_dcookie, sys_lookup_dcookie), // 235 902 LINXY(__NR_epoll_create, sys_epoll_create), // 236 903 LINX_(__NR_epoll_ctl, sys_epoll_ctl), // 237 904 LINXY(__NR_epoll_wait, sys_epoll_wait), // 238 905 906 //.. // (__NR_remap_file_pages, sys_remap_file_pages), // 239 */Linux 907 LINXY(__NR_timer_create, sys_timer_create), // 240 908 LINXY(__NR_timer_settime, sys_timer_settime), // 241 909 LINXY(__NR_timer_gettime, sys_timer_gettime), // 242 910 LINX_(__NR_timer_getoverrun, sys_timer_getoverrun), // 243 911 LINX_(__NR_timer_delete, sys_timer_delete), // 244 912 LINX_(__NR_clock_settime, sys_clock_settime), // 245 913 LINXY(__NR_clock_gettime, sys_clock_gettime), // 246 914 LINXY(__NR_clock_getres, sys_clock_getres), // 247 915 LINXY(__NR_clock_nanosleep, sys_clock_nanosleep), // 248 916 917 // __NR_swapcontext // 249 918 919 LINXY(__NR_tgkill, sys_tgkill), // 250 */Linux 920 //.. GENX_(__NR_utimes, sys_utimes), // 251 921 GENXY(__NR_statfs64, sys_statfs64), // 252 922 GENXY(__NR_fstatfs64, sys_fstatfs64), // 253 923 LINX_(__NR_fadvise64_64, sys_fadvise64_64), // 254 */(Linux?) 924 925 // __NR_rtas // 255 926 927 /* Number 256 is reserved for sys_debug_setcontext */ 928 /* Number 257 is reserved for vserver */ 929 /* Number 258 is reserved for new sys_remap_file_pages */ 930 LINX_(__NR_mbind, sys_mbind), // 259 931 LINXY(__NR_get_mempolicy, sys_get_mempolicy), // 260 932 LINX_(__NR_set_mempolicy, sys_set_mempolicy), // 261 933 934 LINXY(__NR_mq_open, sys_mq_open), // 262 935 LINX_(__NR_mq_unlink, sys_mq_unlink), // 263 936 LINX_(__NR_mq_timedsend, sys_mq_timedsend), // 264 937 LINXY(__NR_mq_timedreceive, sys_mq_timedreceive), // 265 938 LINX_(__NR_mq_notify, sys_mq_notify), // 266 939 LINXY(__NR_mq_getsetattr, sys_mq_getsetattr), // 267 940 // __NR_kexec_load // 268 941 942 /* Number 269 is reserved for sys_add_key */ 943 /* Number 270 is reserved for sys_request_key */ 944 /* Number 271 is reserved for sys_keyctl */ 945 /* Number 272 is reserved for sys_waitid */ 946 LINX_(__NR_ioprio_set, sys_ioprio_set), // 273 947 LINX_(__NR_ioprio_get, sys_ioprio_get), // 274 948 949 LINX_(__NR_inotify_init, sys_inotify_init), // 275 950 LINX_(__NR_inotify_add_watch, sys_inotify_add_watch), // 276 951 LINX_(__NR_inotify_rm_watch, sys_inotify_rm_watch), // 277 952 PLAXY(__NR_spu_run, sys_spu_run), // 278 953 PLAX_(__NR_spu_create, sys_spu_create), // 279 954 955 LINXY(__NR_pselect6, sys_pselect6), // 280 956 LINXY(__NR_ppoll, sys_ppoll), // 281 957 958 LINXY(__NR_openat, sys_openat), // 286 959 LINX_(__NR_mkdirat, sys_mkdirat), // 287 960 LINX_(__NR_mknodat, sys_mknodat), // 288 961 LINX_(__NR_fchownat, sys_fchownat), // 289 962 LINX_(__NR_futimesat, sys_futimesat), // 290 963 PLAXY(__NR_fstatat64, sys_fstatat64), // 291 964 LINX_(__NR_unlinkat, sys_unlinkat), // 292 965 LINX_(__NR_renameat, sys_renameat), // 293 966 LINX_(__NR_linkat, sys_linkat), // 294 967 LINX_(__NR_symlinkat, sys_symlinkat), // 295 968 LINX_(__NR_readlinkat, sys_readlinkat), // 296 969 LINX_(__NR_fchmodat, sys_fchmodat), // 297 970 LINX_(__NR_faccessat, sys_faccessat), // 298 971 LINX_(__NR_set_robust_list, sys_set_robust_list), // 299 972 LINXY(__NR_get_robust_list, sys_get_robust_list), // 300 973 LINXY(__NR_move_pages, sys_move_pages), // 301 974 LINXY(__NR_getcpu, sys_getcpu), // 302 975 LINXY(__NR_epoll_pwait, sys_epoll_pwait), // 303 976 LINX_(__NR_utimensat, sys_utimensat), // 304 977 LINXY(__NR_signalfd, sys_signalfd), // 305 978 LINXY(__NR_timerfd_create, sys_timerfd_create), // 306 979 LINXY(__NR_eventfd, sys_eventfd), // 307 980 LINX_(__NR_sync_file_range2, sys_sync_file_range2), // 308 981 LINX_(__NR_fallocate, sys_fallocate), // 309 982 // LINXY(__NR_subpage_prot, sys_ni_syscall), // 310 983 LINXY(__NR_timerfd_settime, sys_timerfd_settime), // 311 984 LINXY(__NR_timerfd_gettime, sys_timerfd_gettime), // 312 985 LINXY(__NR_signalfd4, sys_signalfd4), // 313 986 LINXY(__NR_eventfd2, sys_eventfd2), // 314 987 LINXY(__NR_epoll_create1, sys_epoll_create1), // 315 988 LINXY(__NR_dup3, sys_dup3), // 316 989 LINXY(__NR_pipe2, sys_pipe2), // 317 990 LINXY(__NR_inotify_init1, sys_inotify_init1), // 318 991 LINXY(__NR_perf_event_open, sys_perf_event_open), // 319 992 LINXY(__NR_preadv, sys_preadv), // 320 993 LINX_(__NR_pwritev, sys_pwritev), // 321 994 LINXY(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo),// 322 995 996 LINXY(__NR_socket, sys_socket), // 326 997 LINX_(__NR_bind, sys_bind), // 327 998 LINX_(__NR_connect, sys_connect), // 328 999 LINX_(__NR_listen, sys_listen), // 329 1000 LINXY(__NR_accept, sys_accept), // 330 1001 LINXY(__NR_getsockname, sys_getsockname), // 331 1002 LINXY(__NR_getpeername, sys_getpeername), // 332 1003 1004 LINX_(__NR_send, sys_send), // 334 1005 LINX_(__NR_sendto, sys_sendto), // 335 1006 LINXY(__NR_recv, sys_recv), // 336 1007 LINXY(__NR_recvfrom, sys_recvfrom), // 337 1008 LINX_(__NR_shutdown, sys_shutdown), // 338 1009 LINX_(__NR_setsockopt, sys_setsockopt), // 339 1010 1011 LINXY(__NR_recvmmsg, sys_recvmmsg), // 343 1012 LINXY(__NR_accept4, sys_accept4), // 344 1013 1014 LINX_(__NR_clock_adjtime, sys_clock_adjtime), // 347 1015 LINX_(__NR_syncfs, sys_syncfs), // 348 1016 LINXY(__NR_sendmmsg, sys_sendmmsg), // 349 1017 1018 LINXY(__NR_process_vm_readv, sys_process_vm_readv), // 351 1019 LINX_(__NR_process_vm_writev, sys_process_vm_writev),// 352 1020 1021 LINXY(__NR_getrandom, sys_getrandom), // 359 1022 LINXY(__NR_memfd_create, sys_memfd_create) // 360 1023 }; 1024 1025 SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno ) 1026 { 1027 const UInt syscall_table_size 1028 = sizeof(syscall_table) / sizeof(syscall_table[0]); 1029 1030 /* Is it in the contiguous initial section of the table? */ 1031 if (sysno < syscall_table_size) { 1032 SyscallTableEntry* sys = &syscall_table[sysno]; 1033 if (sys->before == NULL) 1034 return NULL; /* no entry */ 1035 else 1036 return sys; 1037 } 1038 1039 /* Can't find a wrapper */ 1040 return NULL; 1041 } 1042 1043 #endif // defined(VGP_ppc32_linux) 1044 1045 /*--------------------------------------------------------------------*/ 1046 /*--- end ---*/ 1047 /*--------------------------------------------------------------------*/ 1048