1 2 /*--------------------------------------------------------------------*/ 3 /*--- Private syscalls header for Darwin. priv_syswrap-darwin.h ---*/ 4 /*--------------------------------------------------------------------*/ 5 6 /* 7 This file is part of Valgrind, a dynamic binary instrumentation 8 framework. 9 10 Copyright (C) 2005-2015 Apple Inc. 11 Greg Parker gparker@apple.com 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 #ifndef __PRIV_SYSWRAP_DARWIN_H 32 #define __PRIV_SYSWRAP_DARWIN_H 33 34 #include "pub_core_basics.h" // ThreadId 35 #include "priv_types_n_macros.h" // DECL_TEMPLATE 36 37 // syswrap-darwin.c 38 Addr allocstack ( ThreadId tid ); 39 void find_stack_segment ( ThreadId tid, Addr sp ); 40 void start_thread_NORETURN ( Word arg ); 41 void assign_port_name(mach_port_t port, const char *name); 42 void record_named_port(ThreadId tid, mach_port_t port, mach_port_right_t right, const char *name); 43 44 extern const SyscallTableEntry ML_(mach_trap_table)[]; 45 extern const SyscallTableEntry ML_(syscall_table)[]; 46 extern const SyscallTableEntry ML_(mdep_trap_table)[]; 47 48 extern const UInt ML_(syscall_table_size); 49 extern const UInt ML_(mach_trap_table_size); 50 extern const UInt ML_(mdep_trap_table_size); 51 52 void VG_(show_open_ports)(void); 53 54 Bool ML_(sync_mappings)(const HChar *when, const HChar *where, UWord num); 55 56 // Unix syscalls. 57 // GEN = it uses the generic wrapper 58 // NYI = wrapper not yet implemented in Valgrind 59 // NOC = the non-"_nocancel" wrapper is used 60 // old = the syscall no longer exists in Darwin 61 DECL_TEMPLATE(darwin, exit); // 1 62 // GEN fork 2 63 // GEN read 3 64 // GEN write 4 65 // GEN open 5 66 // GEN close 6 67 // GEN wait4 7 68 // old creat 8 69 // GEN link 9 70 // GEN unlink 10 71 // old execv 11 72 // GEN chdir 12 73 // GEN fchdir 13 74 // GEN mknod 14 75 // GEN chmod 15 76 // GEN chown 16 77 // old break 17 78 DECL_TEMPLATE(darwin, getfsstat); // 18 79 // old lseek 19 80 // GEN getpid 20 81 // old mount 21 82 // old umount 22 83 // GEN setuid 23 84 // GEN getuid 24 85 // GEN geteuid 25 86 DECL_TEMPLATE(darwin, ptrace); // 26 87 DECL_TEMPLATE(darwin, recvmsg); // 27 88 DECL_TEMPLATE(darwin, sendmsg); // 28 89 DECL_TEMPLATE(darwin, recvfrom); // 29 90 DECL_TEMPLATE(darwin, accept); // 30 91 DECL_TEMPLATE(darwin, getpeername); // 31 92 DECL_TEMPLATE(darwin, getsockname); // 32 93 // GEN access 33 94 DECL_TEMPLATE(darwin, chflags); // 34 95 DECL_TEMPLATE(darwin, fchflags); // 35 96 // GEN sync 36 97 // GEN kill 37 98 // old stat 38 99 // GEN getppid 39 100 // old lstat 40 101 // GEN dup 41 102 DECL_TEMPLATE(darwin, pipe); // 42 103 // GEN getegid 43 104 // NYI profil 105 // old ktrace 106 DECL_TEMPLATE(darwin, sigaction); // 46 107 // GEN getgid 47 108 DECL_TEMPLATE(darwin, sigprocmask); // 48 109 DECL_TEMPLATE(darwin, getlogin); // 49 110 // NYI setlogin 50 111 // NYI acct 51 112 DECL_TEMPLATE(darwin, sigpending); // 52 113 // GEN sigaltstack 53 114 DECL_TEMPLATE(darwin, ioctl); // 54 115 // NYI reboot 55 116 // NYI revoke 56 117 // NYI symlink 57 118 // GEN readlink 58 119 // GEN execve 59 120 // GEN umask 60 121 // GEN chroot 61 122 // old fstat 123 // 63 used internally, reserved 124 // old getpagesize 64 125 // GEN msync 65 126 // GEN vfork 66 127 // old vread 128 // old vwrite 129 // old sbrk 130 // old sstk 131 // old mmap 132 // old vadvise 133 // GEN munmap 73 134 // GEN mprotect 74 135 // GEN madvise 75 136 // old vhangup 137 // old vlimit 138 // NYI mincore 78 139 // GEN getgroups 79 140 // NYI setgroups 80 141 // GEN getpgrp 81 142 // NYI setpgid 82 143 // GEN setitimer 83 144 // old wait 145 // NYI swapon 85 146 // GEN getitimer 86 147 // old gethostname 148 // old sethostname 149 DECL_TEMPLATE(darwin, getdtablesize); // 89 150 // GEN dup2 90 151 // old getdopt 152 DECL_TEMPLATE(darwin, fcntl); // 92 153 // GEN select 93 154 // old setdopt 155 // GEN fsync 95 156 // GEN setpriority 96 157 DECL_TEMPLATE(darwin, socket); // 97 158 DECL_TEMPLATE(darwin, connect); // 98 159 // old accept 160 // GEN getpriority 100 161 // old send 162 // old recv 163 // old sigreturn 164 DECL_TEMPLATE(darwin, bind); // 104 165 DECL_TEMPLATE(darwin, setsockopt); // 105 166 DECL_TEMPLATE(darwin, listen); // 106 167 // old vtimes 168 // old sigvec 169 // old sigblock 170 // old sigsetmask 171 DECL_TEMPLATE(darwin, sigsuspend); // 111 172 // old sigstack 173 // old recvmsg 174 // old sendmsg 175 // old vtrace 176 // GEN gettimeofday 116 177 // GEN getrusage 117 178 DECL_TEMPLATE(darwin, getsockopt); // 118 179 // old resuba 180 // GEN readv 120 181 // GEN writev 121 182 // NYI settimeofday 122 183 // GEN fchown 123 184 // GEN fchmod 124 185 // old recvfrom 186 // NYI setreuid 126 187 // NYI setregid 127 188 // GEN rename 128 189 // old truncate 190 // old ftruncate 191 // GEN flock 131 192 DECL_TEMPLATE(darwin, mkfifo); // 132 193 DECL_TEMPLATE(darwin, sendto); // 133 194 DECL_TEMPLATE(darwin, shutdown); // 134 195 DECL_TEMPLATE(darwin, socketpair); // 135 196 // GEN mkdir 136 197 // GEN rmdir 137 198 // GEN utimes 138 199 DECL_TEMPLATE(darwin, futimes); // 139 200 // NYI adjtime 140 201 // old getpeername 202 DECL_TEMPLATE(darwin, gethostuuid); // 142 203 // old sethostid 204 // old getrlimit 205 // old setrlimit 206 // old killpg 207 // GEN setsid 147 208 // old setquota 209 // old qquota 210 // old getsockname 211 // NYI getpgid 151 212 // NYI setprivexec 152 213 // GEN pread 153 214 // GEN pwrite 154 215 // NYI nfssvc 155 216 // old getdirentries 217 // GEN statfs 157 218 // GEN fstatfs 158 219 // NYI unmount 159 220 // old async_daemon 221 // NYI getfh 161 222 // old getdomainname 223 // old setdomainname 224 // 164 225 // NYI quotactl 165 226 // old exportfs 227 DECL_TEMPLATE(darwin, mount); // 167 228 // old ustat 229 DECL_TEMPLATE(darwin, csops); // 169 230 // old table 231 // old wait3 232 // old rpause 233 // NYI waitid 173 234 // old getdents 235 // old gc_control 236 // NYI add_profil 176 237 // 177 238 // 178 239 // 179 240 DECL_TEMPLATE(darwin, kdebug_trace); // 180 241 // GEN setgid 181 242 DECL_TEMPLATE(darwin, setegid); // 182 243 DECL_TEMPLATE(darwin, seteuid); // 183 244 DECL_TEMPLATE(darwin, sigreturn); // 184 245 DECL_TEMPLATE(darwin, FAKE_SIGRETURN); 246 // NYI chud 185 247 // 186 248 // 187 249 // GEN stat 188 250 // GEN fstat 189 251 // GEN lstat 190 252 DECL_TEMPLATE(darwin, pathconf); // 191 253 DECL_TEMPLATE(darwin, fpathconf); // 192 254 // 193 255 // GEN getrlimit 194 256 // GEN setrlimit 195 257 DECL_TEMPLATE(darwin, getdirentries); // 196 258 DECL_TEMPLATE(darwin, mmap); // 197 259 // 198 __syscall 260 DECL_TEMPLATE(darwin, lseek); // 199 (was UX64) 261 // GEN truncate 200 262 // GEN ftruncate 201 263 DECL_TEMPLATE(darwin, __sysctl); // 202 264 // GEN mlock 203 265 // GEN munlock 204 266 // NYI undelete 205 267 // NYI ATsocket 206 268 // NYI ATgetmsg 207 269 // NYI ATputmsg 208 270 // NYI ATPsndreq 209 271 // NYI ATPsndrsp 210 272 // NYI ATPgetreq 211 273 // NYI ATPgetrsp 212 274 // 213 Reserved for AppleTalk 275 // NYI kqueue_from_portset_np 214 276 // NYI kqueue_portset_np 215 277 // NYI mkcomplex 216 278 // NYI statv 217 279 // NYI lstatv 218 280 // NYI fstatv 219 281 DECL_TEMPLATE(darwin, getattrlist); // 220 282 DECL_TEMPLATE(darwin, setattrlist); // 221 283 DECL_TEMPLATE(darwin, getdirentriesattr); // 222 284 DECL_TEMPLATE(darwin, exchangedata); // 223 285 // 224 checkuseraccess 286 // NYI searchfs 225 287 // GEN delete 226 288 // NYI copyfile 226 289 // 228 290 // 229 291 // GEN poll 230 292 DECL_TEMPLATE(darwin, watchevent); // 231 293 DECL_TEMPLATE(darwin, waitevent); // 232 294 DECL_TEMPLATE(darwin, modwatch); // 233 295 DECL_TEMPLATE(darwin, getxattr); // 234 296 DECL_TEMPLATE(darwin, fgetxattr); // 235 297 DECL_TEMPLATE(darwin, setxattr); // 236 298 DECL_TEMPLATE(darwin, fsetxattr); // 237 299 DECL_TEMPLATE(darwin, removexattr); // 238 300 DECL_TEMPLATE(darwin, fremovexattr); // 239 301 DECL_TEMPLATE(darwin, listxattr); // 240 302 DECL_TEMPLATE(darwin, flistxattr); // 241 303 DECL_TEMPLATE(darwin, fsctl); // 242 304 DECL_TEMPLATE(darwin, initgroups); // 243 305 DECL_TEMPLATE(darwin, posix_spawn); // 244 306 // 245 307 // 246 308 // NYI nfsclnt 247 309 // NYI fhopen 248 310 // 249 311 // NYI minherit 250 312 // NYI semsys 251 313 // NYI msgsys 252 314 // NYI shmsys 253 315 DECL_TEMPLATE(darwin, semctl); // 254 316 DECL_TEMPLATE(darwin, semget); // 255 317 DECL_TEMPLATE(darwin, semop); // 256 318 // 257 319 // NYI msgctl 258 320 // NYI msgget 259 321 // NYI msgsnd 260 322 // NYI msgrcv 261 323 DECL_TEMPLATE(darwin, shmat); // 262 324 DECL_TEMPLATE(darwin, shmctl); // 263 325 DECL_TEMPLATE(darwin, shmdt); // 264 326 DECL_TEMPLATE(darwin, shmget); // 265 327 DECL_TEMPLATE(darwin, shm_open); // 266 328 DECL_TEMPLATE(darwin, shm_unlink); // 267 329 DECL_TEMPLATE(darwin, sem_open); // 268 330 DECL_TEMPLATE(darwin, sem_close); // 269 331 DECL_TEMPLATE(darwin, sem_unlink); // 270 332 DECL_TEMPLATE(darwin, sem_wait); // 271 333 DECL_TEMPLATE(darwin, sem_trywait); // 272 334 DECL_TEMPLATE(darwin, sem_post); // 273 335 336 #if DARWIN_VERS < DARWIN_10_10 337 // NYI sem_getvalue 274 338 #elif DARWIN_VERS >= DARWIN_10_10 339 DECL_TEMPLATE(darwin, sysctlbyname); // 274 340 #endif 341 342 DECL_TEMPLATE(darwin, sem_init); // 275 343 DECL_TEMPLATE(darwin, sem_destroy); // 276 344 DECL_TEMPLATE(darwin, open_extended) // 277 345 // NYI umask_extended 278 346 DECL_TEMPLATE(darwin, stat_extended); // 279 347 DECL_TEMPLATE(darwin, lstat_extended); // 280 348 DECL_TEMPLATE(darwin, fstat_extended); // 281 349 DECL_TEMPLATE(darwin, chmod_extended); // 282 350 DECL_TEMPLATE(darwin, fchmod_extended); // 283 351 DECL_TEMPLATE(darwin, access_extended); // 284 352 DECL_TEMPLATE(darwin, settid); // 285 353 #if DARWIN_VERS >= DARWIN_10_6 354 DECL_TEMPLATE(darwin, gettid); // 286 355 #endif 356 // NYI setsgroups 287 357 // NYI getsgroups 288 358 // NYI setwgroups 289 359 // NYI getwgroups 290 360 // NYI mkfifo_extended 291 361 // NYI mkdir_extended 292 362 // NYI identitysvc 293 363 // NYI shared_region_check_np 294 364 // NYI shared_region_map_np 295 365 #if DARWIN_VERS >= DARWIN_10_6 366 // NYI vm_pressure_monitor 296 367 // NYI psynch_rw_longrdlock 297 368 // NYI psynch_rw_yieldwrlock 298 369 // NYI psynch_rw_downgrade 299 370 // NYI psynch_rw_upgrade 300 371 DECL_TEMPLATE(darwin, psynch_mutexwait); // 301 372 DECL_TEMPLATE(darwin, psynch_mutexdrop); // 302 373 DECL_TEMPLATE(darwin, psynch_cvbroad); // 303 374 DECL_TEMPLATE(darwin, psynch_cvsignal); // 304 375 DECL_TEMPLATE(darwin, psynch_cvwait); // 305 376 DECL_TEMPLATE(darwin, psynch_rw_rdlock); // 306 377 DECL_TEMPLATE(darwin, psynch_rw_wrlock); // 307 378 DECL_TEMPLATE(darwin, psynch_rw_unlock); // 308 379 // NYI psynch_rw_unlock2 309 380 #else 381 // old load_shared_file 382 // old reset_shared_file 383 // old new_system_shared_regions 384 // old shared_region_map_file_np 385 // old shared_region_make_private_np 386 // NYI __pthread_mutex_destroy 301 387 // NYI __pthread_mutex_init 302 388 // NYI __pthread_mutex_lock 303 389 // NYI __pthread_mutex_trylock 304 390 // NYI __pthread_mutex_unlock 305 391 // NYI __pthread_cond_init 306 392 // NYI __pthread_cond_destroy 307 393 // NYI __pthread_cond_broadcast 308 394 // NYI __pthread_cond_signal 309 395 #endif 396 // NYI getsid 310 397 // NYI settid_with_pid 311 398 #if DARWIN_VERS >= DARWIN_10_7 399 DECL_TEMPLATE(darwin, psynch_cvclrprepost); // 312 400 #else 401 // NYI __pthread_cond_timedwait 312 402 #endif 403 // NYI aio_fsync 313 404 DECL_TEMPLATE(darwin, aio_return); // 314 405 DECL_TEMPLATE(darwin, aio_suspend); // 315 406 // NYI aio_cancel 316 407 DECL_TEMPLATE(darwin, aio_error); // 317 408 DECL_TEMPLATE(darwin, aio_read); // 318 409 DECL_TEMPLATE(darwin, aio_write); // 319 410 // NYI lio_listio 320 411 // NYI __pthread_cond_wait 321 412 // NYI iopolicysys 322 413 // NYI process_policy 323 414 // NYI mlockall 324 415 // NYI munlockall 325 416 // 326 417 DECL_TEMPLATE(darwin, issetugid); // 327 418 DECL_TEMPLATE(darwin, __pthread_kill); // 328 419 DECL_TEMPLATE(darwin, __pthread_sigmask); // 329 420 // NYI __sigwait 330 421 DECL_TEMPLATE(darwin, __disable_threadsignal); // 331 422 DECL_TEMPLATE(darwin, __pthread_markcancel); // 332 423 DECL_TEMPLATE(darwin, __pthread_canceled); // 333 424 DECL_TEMPLATE(darwin, __semwait_signal); // 334 425 // old utrace 426 DECL_TEMPLATE(darwin, proc_info); // 336 427 DECL_TEMPLATE(darwin, sendfile); // 337 428 DECL_TEMPLATE(darwin, stat64); // 338 429 DECL_TEMPLATE(darwin, fstat64); // 339 430 DECL_TEMPLATE(darwin, lstat64); // 340 431 DECL_TEMPLATE(darwin, stat64_extended); // 341 432 DECL_TEMPLATE(darwin, lstat64_extended); // 342 433 DECL_TEMPLATE(darwin, fstat64_extended); // 343 434 DECL_TEMPLATE(darwin, getdirentries64); // 344 435 DECL_TEMPLATE(darwin, statfs64); // 345 436 DECL_TEMPLATE(darwin, fstatfs64); // 346 437 DECL_TEMPLATE(darwin, getfsstat64); // 347 438 DECL_TEMPLATE(darwin, __pthread_chdir); // 348 439 DECL_TEMPLATE(darwin, __pthread_fchdir); // 349 440 // NYI audit 350 441 DECL_TEMPLATE(darwin, auditon); // 351 442 // 352 443 // NYI getauid 353 444 // NYI setauid 354 445 // NYI getaudit 355 446 // NYI setaudit 356 447 DECL_TEMPLATE(darwin, getaudit_addr) // 357 448 // NYI setaudit_addr 358 449 // NYI auditctl 359 450 DECL_TEMPLATE(darwin, bsdthread_create); // 360 451 DECL_TEMPLATE(darwin, bsdthread_terminate); // 361 452 DECL_TEMPLATE(darwin, kqueue); // 362 453 DECL_TEMPLATE(darwin, kevent); // 363 454 // NYI lchown 364 455 // NYI stack_snapshot 365 456 DECL_TEMPLATE(darwin, bsdthread_register); // 366 457 DECL_TEMPLATE(darwin, workq_open); // 367 458 DECL_TEMPLATE(darwin, workq_ops); // 368 459 DECL_TEMPLATE(darwin, kevent64); // 369 460 // 370 461 // 371 462 #if DARWIN_VERS >= DARWIN_10_6 463 DECL_TEMPLATE(darwin, __thread_selfid); // 372 464 #endif 465 // 373 466 // 374 467 // 375 468 // 376 469 // 377 470 // 378 471 // 379 472 // NYI __mac_execve 380 473 DECL_TEMPLATE(darwin, __mac_syscall); // 381 474 // NYI __mac_get_file 382 475 // NYI __mac_set_file 383 476 // NYI __mac_get_link 384 477 // NYI __mac_set_link 385 478 // NYI __mac_get_proc 386 479 // NYI __mac_set_proc 387 480 // NYI __mac_get_fd 388 481 // NYI __mac_set_fd 389 482 // NYI __mac_get_pid 390 483 // NYI __mac_get_lcid 391 484 // NYI __mac_get_lctx 392 485 // NYI __mac_set_lctx 393 486 // NYI setlcid 394 487 // NYI getlcid 395 488 // GEN read_nocancel 396 489 // GEN write_nocancel 397 490 // GEN open_nocancel 398 491 // GEN close_nocancel 399 492 // GEN wait4_nocancel 400 493 // NOC recvmsg_nocancel 401 494 // NOC sendmsg_nocancel 402 495 // NOC recvfrom_nocancel 403 496 // NOC accept_nocancel 404 497 // GEN msync_nocancel 405 498 // NOC fcntl_nocancel 406 499 // GEN select_nocancel 407 500 // GEN fsync_nocancel 408 501 // NOC connect_nocancel 409 502 // NYI sigsuspend_nocancel 410 503 // GEN readv_nocancel 411 504 // GEN writev_nocancel 412 505 // NOC sendto_nocancel 413 506 // GEN pread_nocancel 414 507 // GEN pwrite_nocancel 415 508 // NYI waitid_nocancel 416 509 // GEN poll_nocancel 417 510 // NYI msgsnd_nocancel 418 511 // NYI msgrcv_nocancel 419 512 // NOC sem_wait_nocancel 420 513 // NYI aio_suspend_nocancel 421 514 // NYI __sigwait_nocancel 422 515 // NOC __semwait_signal_nocancel 423 516 // NYI __mac_mount 424 517 // NYI __mac_get_mount 425 518 // NYI __mac_getfsstat 426 519 DECL_TEMPLATE(darwin, fsgetpath); // 427 520 DECL_TEMPLATE(darwin, audit_session_self); // 428 521 // NYI audit_session_join 429 522 DECL_TEMPLATE(darwin, fileport_makeport); // 430 523 524 // NYI fileport_makefd 431 525 // NYI audit_session_port 432 526 // NYI pid_suspend 433 527 // NYI pid_resume 434 528 #if DARWIN_VERS >= DARWIN_10_10 529 // NYI pid_hibernate 435 530 // NYI pid_shutdown_sockets 436 531 #endif /* DARWIN_VERS >= DARWIN_10_10 */ 532 // old old shared_region_slide_np 437 533 // NYI shared_region_map_and_slide_np // 438 534 // NYI kas_info // 439 535 // NYI memorystatus_control // 440 536 DECL_TEMPLATE(darwin, guarded_open_np); // 441 537 DECL_TEMPLATE(darwin, guarded_close_np); // 442 538 DECL_TEMPLATE(darwin, guarded_kqueue_np); // 443 539 DECL_TEMPLATE(darwin, change_fdguard_np); // 444 540 // old __proc_suppress 445 541 // NYI proc_rlimit_control // 446 542 DECL_TEMPLATE(darwin, connectx); // 447 543 DECL_TEMPLATE(darwin, disconnectx); // 448 544 // NYI peeloff // 449 545 // NYI socket_delegate // 450 546 // NYI telemetry // 451 547 // NYI proc_uuid_policy // 452 548 // NYI memorystatus_get_level // 453 549 // NYI system_override // 454 550 // NYI vfs_purge // 455 551 #if DARWIN_VERS >= DARWIN_10_10 552 // NYI sfi_ctl // 456 553 // NYI sfi_pidctl // 457 554 // NYI coalition // 458 555 // NYI coalition_info // 459 556 DECL_TEMPLATE(darwin, necp_match_policy); // 460 557 DECL_TEMPLATE(darwin, getattrlistbulk); // 461 558 // 462 559 // NYI openat // 463 560 // NYI openat_nocancel // 464 561 // NYI renameat // 465 562 // NYI faccessat // 466 563 // NYI fchmodat // 467 564 // NYI fchownat // 468 565 // NYI fstatat // 469 566 // NYI fstatat64 // 470 567 // NYI linkat // 471 568 // NYI unlinkat // 472 569 DECL_TEMPLATE(darwin, readlinkat); // 473 570 // NYI symlinkat // 474 571 // NYI mkdirat // 475 572 // NYI getattrlistat // 476 573 // NYI proc_trace_log // 477 574 DECL_TEMPLATE(darwin, bsdthread_ctl); // 478 575 // NYI openbyid_np // 479 576 // NYI recvmsg_x // 480 577 // NYI sendmsg_x // 481 578 // NYI thread_selfusage // 482 579 // NYI csrctl // 483 580 DECL_TEMPLATE(darwin, guarded_open_dprotected_np); // 484 581 DECL_TEMPLATE(darwin, guarded_write_np); // 485 582 DECL_TEMPLATE(darwin, guarded_pwrite_np); // 486 583 DECL_TEMPLATE(darwin, guarded_writev_np); // 487 584 // NYI rename_ext // 488 585 // NYI mremap_encrypted // 489 586 #endif /* DARWIN_VERS >= DARWIN_10_10 */ 587 588 // Mach message helpers 589 DECL_TEMPLATE(darwin, mach_port_set_context); 590 DECL_TEMPLATE(darwin, host_info); 591 DECL_TEMPLATE(darwin, host_page_size); 592 DECL_TEMPLATE(darwin, host_get_io_master); 593 DECL_TEMPLATE(darwin, host_get_clock_service); 594 DECL_TEMPLATE(darwin, host_request_notification); 595 DECL_TEMPLATE(darwin, host_create_mach_voucher); 596 DECL_TEMPLATE(darwin, host_get_special_port); 597 DECL_TEMPLATE(darwin, mach_port_type); 598 DECL_TEMPLATE(darwin, mach_port_extract_member); 599 DECL_TEMPLATE(darwin, mach_port_allocate); 600 DECL_TEMPLATE(darwin, mach_port_deallocate); 601 DECL_TEMPLATE(darwin, mach_port_get_refs); 602 DECL_TEMPLATE(darwin, mach_port_mod_refs); 603 DECL_TEMPLATE(darwin, mach_port_get_set_status); 604 DECL_TEMPLATE(darwin, mach_port_move_member); 605 DECL_TEMPLATE(darwin, mach_port_destroy); 606 DECL_TEMPLATE(darwin, mach_port_request_notification); 607 DECL_TEMPLATE(darwin, mach_port_insert_right); 608 DECL_TEMPLATE(darwin, mach_port_extract_right); 609 DECL_TEMPLATE(darwin, mach_port_get_attributes); 610 DECL_TEMPLATE(darwin, mach_port_set_attributes); 611 DECL_TEMPLATE(darwin, mach_port_insert_member); 612 DECL_TEMPLATE(darwin, task_get_special_port); 613 DECL_TEMPLATE(darwin, task_set_special_port); 614 DECL_TEMPLATE(darwin, task_get_exception_ports); 615 DECL_TEMPLATE(darwin, semaphore_create); 616 DECL_TEMPLATE(darwin, semaphore_destroy); 617 DECL_TEMPLATE(darwin, task_policy_set); 618 DECL_TEMPLATE(darwin, mach_ports_register); 619 DECL_TEMPLATE(darwin, mach_ports_lookup); 620 DECL_TEMPLATE(darwin, task_info); 621 DECL_TEMPLATE(darwin, task_set_info); 622 DECL_TEMPLATE(darwin, task_threads); 623 DECL_TEMPLATE(darwin, task_suspend); 624 DECL_TEMPLATE(darwin, task_resume); 625 DECL_TEMPLATE(darwin, vm_allocate); 626 DECL_TEMPLATE(darwin, vm_deallocate); 627 DECL_TEMPLATE(darwin, vm_protect); 628 DECL_TEMPLATE(darwin, vm_inherit); 629 DECL_TEMPLATE(darwin, vm_read); 630 DECL_TEMPLATE(darwin, mach_vm_read); 631 DECL_TEMPLATE(darwin, vm_copy); 632 DECL_TEMPLATE(darwin, vm_read_overwrite); 633 DECL_TEMPLATE(darwin, vm_map); 634 DECL_TEMPLATE(darwin, vm_remap); 635 DECL_TEMPLATE(darwin, mach_make_memory_entry_64); 636 DECL_TEMPLATE(darwin, vm_purgable_control); 637 DECL_TEMPLATE(darwin, mach_vm_purgable_control); 638 DECL_TEMPLATE(darwin, mach_vm_allocate); 639 DECL_TEMPLATE(darwin, mach_vm_deallocate); 640 DECL_TEMPLATE(darwin, mach_vm_protect); 641 DECL_TEMPLATE(darwin, mach_vm_copy); 642 DECL_TEMPLATE(darwin, mach_vm_read_overwrite); 643 DECL_TEMPLATE(darwin, mach_vm_inherit); 644 DECL_TEMPLATE(darwin, mach_vm_map); 645 DECL_TEMPLATE(darwin, mach_vm_remap); 646 DECL_TEMPLATE(darwin, mach_vm_region_recurse); 647 DECL_TEMPLATE(darwin, thread_terminate); 648 DECL_TEMPLATE(darwin, thread_create); 649 DECL_TEMPLATE(darwin, thread_create_running); 650 DECL_TEMPLATE(darwin, thread_suspend); 651 DECL_TEMPLATE(darwin, thread_resume); 652 DECL_TEMPLATE(darwin, thread_get_state); 653 DECL_TEMPLATE(darwin, thread_policy); 654 DECL_TEMPLATE(darwin, thread_policy_set); 655 DECL_TEMPLATE(darwin, thread_info); 656 DECL_TEMPLATE(darwin, bootstrap_register); 657 DECL_TEMPLATE(darwin, bootstrap_look_up); 658 DECL_TEMPLATE(darwin, mach_msg_receive); 659 DECL_TEMPLATE(darwin, mach_msg_bootstrap); 660 DECL_TEMPLATE(darwin, mach_msg_host); 661 DECL_TEMPLATE(darwin, mach_msg_task); 662 DECL_TEMPLATE(darwin, mach_msg_thread); 663 664 // Mach traps 665 #if DARWIN_VERS >= DARWIN_10_8 666 DECL_TEMPLATE(darwin, kernelrpc_mach_vm_allocate_trap); 667 DECL_TEMPLATE(darwin, kernelrpc_mach_vm_deallocate_trap); 668 DECL_TEMPLATE(darwin, kernelrpc_mach_vm_protect_trap); 669 DECL_TEMPLATE(darwin, kernelrpc_mach_vm_map_trap); 670 DECL_TEMPLATE(darwin, kernelrpc_mach_port_allocate_trap); 671 DECL_TEMPLATE(darwin, kernelrpc_mach_port_destroy_trap); 672 DECL_TEMPLATE(darwin, kernelrpc_mach_port_deallocate_trap); 673 DECL_TEMPLATE(darwin, kernelrpc_mach_port_mod_refs_trap); 674 DECL_TEMPLATE(darwin, kernelrpc_mach_port_move_member_trap); 675 DECL_TEMPLATE(darwin, kernelrpc_mach_port_insert_right_trap); 676 DECL_TEMPLATE(darwin, kernelrpc_mach_port_insert_member_trap); 677 DECL_TEMPLATE(darwin, kernelrpc_mach_port_extract_member_trap); 678 DECL_TEMPLATE(darwin, kernelrpc_mach_port_construct_trap); 679 DECL_TEMPLATE(darwin, kernelrpc_mach_port_destruct_trap); 680 DECL_TEMPLATE(darwin, kernelrpc_mach_port_guard_trap); 681 DECL_TEMPLATE(darwin, kernelrpc_mach_port_unguard_trap); 682 DECL_TEMPLATE(darwin, iopolicysys); 683 DECL_TEMPLATE(darwin, process_policy); 684 #endif /* DARWIN_VERS >= DARWIN_10_8 */ 685 DECL_TEMPLATE(darwin, mach_msg_unhandled); 686 DECL_TEMPLATE(darwin, mach_msg_unhandled_check); 687 DECL_TEMPLATE(darwin, mach_msg); 688 DECL_TEMPLATE(darwin, mach_reply_port); 689 DECL_TEMPLATE(darwin, mach_thread_self); 690 DECL_TEMPLATE(darwin, mach_host_self); 691 DECL_TEMPLATE(darwin, mach_task_self); 692 DECL_TEMPLATE(darwin, syscall_thread_switch); 693 DECL_TEMPLATE(darwin, semaphore_signal); 694 DECL_TEMPLATE(darwin, semaphore_signal_all); 695 DECL_TEMPLATE(darwin, semaphore_signal_thread); 696 DECL_TEMPLATE(darwin, semaphore_wait); 697 DECL_TEMPLATE(darwin, semaphore_wait_signal); 698 DECL_TEMPLATE(darwin, semaphore_timedwait); 699 DECL_TEMPLATE(darwin, semaphore_timedwait_signal); 700 DECL_TEMPLATE(darwin, task_for_pid); 701 DECL_TEMPLATE(darwin, pid_for_task); 702 DECL_TEMPLATE(darwin, mach_timebase_info); 703 DECL_TEMPLATE(darwin, mach_wait_until); 704 DECL_TEMPLATE(darwin, mk_timer_create); 705 DECL_TEMPLATE(darwin, mk_timer_destroy); 706 DECL_TEMPLATE(darwin, mk_timer_arm); 707 DECL_TEMPLATE(darwin, mk_timer_cancel); 708 DECL_TEMPLATE(darwin, iokit_user_client_trap); 709 DECL_TEMPLATE(darwin, swtch); 710 DECL_TEMPLATE(darwin, swtch_pri); 711 712 // Machine-dependent traps 713 DECL_TEMPLATE(darwin, thread_fast_set_cthread_self); 714 715 // syswrap-<arch>-darwin.c 716 #include <mach/mach.h> 717 extern 718 void thread_state_from_vex(thread_state_t mach_generic, 719 thread_state_flavor_t flavor, 720 mach_msg_type_number_t count, 721 VexGuestArchState *vex_generic); 722 extern 723 void thread_state_to_vex(const thread_state_t mach_generic, 724 thread_state_flavor_t flavor, 725 mach_msg_type_number_t count, 726 VexGuestArchState *vex_generic); 727 extern 728 ThreadState *build_thread(const thread_state_t state, 729 thread_state_flavor_t flavor, 730 mach_msg_type_number_t count); 731 extern 732 void hijack_thread_state(thread_state_t mach_generic, 733 thread_state_flavor_t flavor, 734 mach_msg_type_number_t count, 735 ThreadState *tst); 736 extern 737 __attribute__((noreturn)) 738 void call_on_new_stack_0_1 ( Addr stack, 739 Addr retaddr, 740 void (*f)(Word), 741 Word arg1 ); 742 743 extern void pthread_hijack_asm(void); 744 extern void pthread_hijack(Addr self, Addr kport, Addr func, Addr func_arg, 745 Addr stacksize, Addr flags, Addr sp); 746 extern void wqthread_hijack_asm(void); 747 extern void wqthread_hijack(Addr self, Addr kport, Addr stackaddr, Addr workitem, Int reuse, Addr sp); 748 749 extern Addr pthread_starter; 750 extern Addr wqthread_starter; 751 extern SizeT pthread_structsize; 752 753 754 #endif 755 756 /*--------------------------------------------------------------------*/ 757 /*--- end ---*/ 758 /*--------------------------------------------------------------------*/ 759