Add DRD suppression patterns for races triggered by std::ostream
[valgrind.git] / coregrind / m_syswrap / priv_syswrap-darwin.h
blobd344f078221cf38f91057a5567dc6e23e9e4398e
2 /*--------------------------------------------------------------------*/
3 /*--- Private syscalls header for Darwin. priv_syswrap-darwin.h ---*/
4 /*--------------------------------------------------------------------*/
6 /*
7 This file is part of Valgrind, a dynamic binary instrumentation
8 framework.
10 Copyright (C) 2005-2017 Apple Inc.
11 Greg Parker gparker@apple.com
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.
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.
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.
28 The GNU General Public License is contained in the file COPYING.
31 #ifndef __PRIV_SYSWRAP_DARWIN_H
32 #define __PRIV_SYSWRAP_DARWIN_H
34 #include "pub_core_basics.h" // ThreadId
35 #include "priv_types_n_macros.h" // DECL_TEMPLATE
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);
44 extern const SyscallTableEntry ML_(mach_trap_table)[];
45 extern const SyscallTableEntry ML_(syscall_table)[];
46 extern const SyscallTableEntry ML_(mdep_trap_table)[];
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);
52 void VG_(show_open_ports)(void);
54 Bool ML_(sync_mappings)(const HChar *when, const HChar *where, UWord num);
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 #if DARWIN_VERS >= DARWIN_10_12
238 // NYI kdebug_typefilter // 177
239 #endif /* DARWIN_VERS >= DARWIN_10_12 */
240 #if DARWIN_VERS >= DARWIN_10_11
241 // NYI kdebug_trace_string // 178
242 #endif /* DARWIN_VERS >= DARWIN_10_11 */
243 // 179
244 DECL_TEMPLATE(darwin, kdebug_trace); // 180
245 // GEN setgid 181
246 DECL_TEMPLATE(darwin, setegid); // 182
247 DECL_TEMPLATE(darwin, seteuid); // 183
248 DECL_TEMPLATE(darwin, sigreturn); // 184
249 DECL_TEMPLATE(darwin, FAKE_SIGRETURN);
250 // NYI chud 185
251 #if DARWIN_VERS >= DARWIN_10_13
252 // NYI thread_selfcounts // 186
253 #endif /* DARWIN_VERS >= DARWIN_10_13 */
254 // 187
255 // GEN stat 188
256 // GEN fstat 189
257 // GEN lstat 190
258 DECL_TEMPLATE(darwin, pathconf); // 191
259 DECL_TEMPLATE(darwin, fpathconf); // 192
260 // 193
261 // GEN getrlimit 194
262 // GEN setrlimit 195
263 DECL_TEMPLATE(darwin, getdirentries); // 196
264 DECL_TEMPLATE(darwin, mmap); // 197
265 // 198 __syscall
266 DECL_TEMPLATE(darwin, lseek); // 199 (was UX64)
267 // GEN truncate 200
268 // GEN ftruncate 201
269 DECL_TEMPLATE(darwin, __sysctl); // 202
270 // GEN mlock 203
271 // GEN munlock 204
272 // NYI undelete 205
273 // NYI ATsocket 206
274 // NYI ATgetmsg 207
275 // NYI ATputmsg 208
276 // NYI ATPsndreq 209
277 // NYI ATPsndrsp 210
278 // NYI ATPgetreq 211
279 // NYI ATPgetrsp 212
280 // 213 Reserved for AppleTalk
281 // NYI kqueue_from_portset_np 214
282 // NYI kqueue_portset_np 215
283 // NYI mkcomplex 216
284 // NYI statv 217
285 // NYI lstatv 218
286 // NYI fstatv 219
287 DECL_TEMPLATE(darwin, getattrlist); // 220
288 DECL_TEMPLATE(darwin, setattrlist); // 221
289 DECL_TEMPLATE(darwin, getdirentriesattr); // 222
290 DECL_TEMPLATE(darwin, exchangedata); // 223
291 // 224 checkuseraccess
292 // NYI searchfs 225
293 // GEN delete 226
294 // NYI copyfile 226
295 // 228
296 // 229
297 // GEN poll 230
298 DECL_TEMPLATE(darwin, watchevent); // 231
299 DECL_TEMPLATE(darwin, waitevent); // 232
300 DECL_TEMPLATE(darwin, modwatch); // 233
301 DECL_TEMPLATE(darwin, getxattr); // 234
302 DECL_TEMPLATE(darwin, fgetxattr); // 235
303 DECL_TEMPLATE(darwin, setxattr); // 236
304 DECL_TEMPLATE(darwin, fsetxattr); // 237
305 DECL_TEMPLATE(darwin, removexattr); // 238
306 DECL_TEMPLATE(darwin, fremovexattr); // 239
307 DECL_TEMPLATE(darwin, listxattr); // 240
308 DECL_TEMPLATE(darwin, flistxattr); // 241
309 DECL_TEMPLATE(darwin, fsctl); // 242
310 DECL_TEMPLATE(darwin, initgroups); // 243
311 DECL_TEMPLATE(darwin, posix_spawn); // 244
312 // 245
313 // 246
314 // NYI nfsclnt 247
315 // NYI fhopen 248
316 // 249
317 // NYI minherit 250
318 // NYI semsys 251
319 // NYI msgsys 252
320 // NYI shmsys 253
321 DECL_TEMPLATE(darwin, semctl); // 254
322 DECL_TEMPLATE(darwin, semget); // 255
323 DECL_TEMPLATE(darwin, semop); // 256
324 // 257
325 // NYI msgctl 258
326 // NYI msgget 259
327 // NYI msgsnd 260
328 // NYI msgrcv 261
329 DECL_TEMPLATE(darwin, shmat); // 262
330 DECL_TEMPLATE(darwin, shmctl); // 263
331 DECL_TEMPLATE(darwin, shmdt); // 264
332 DECL_TEMPLATE(darwin, shmget); // 265
333 DECL_TEMPLATE(darwin, shm_open); // 266
334 DECL_TEMPLATE(darwin, shm_unlink); // 267
335 DECL_TEMPLATE(darwin, sem_open); // 268
336 DECL_TEMPLATE(darwin, sem_close); // 269
337 DECL_TEMPLATE(darwin, sem_unlink); // 270
338 DECL_TEMPLATE(darwin, sem_wait); // 271
339 DECL_TEMPLATE(darwin, sem_trywait); // 272
340 DECL_TEMPLATE(darwin, sem_post); // 273
342 #if DARWIN_VERS < DARWIN_10_10
343 // NYI sem_getvalue 274
344 #elif DARWIN_VERS >= DARWIN_10_10
345 DECL_TEMPLATE(darwin, sysctlbyname); // 274
346 #endif
348 DECL_TEMPLATE(darwin, sem_init); // 275
349 DECL_TEMPLATE(darwin, sem_destroy); // 276
350 DECL_TEMPLATE(darwin, open_extended) // 277
351 // NYI umask_extended 278
352 DECL_TEMPLATE(darwin, stat_extended); // 279
353 DECL_TEMPLATE(darwin, lstat_extended); // 280
354 DECL_TEMPLATE(darwin, fstat_extended); // 281
355 DECL_TEMPLATE(darwin, chmod_extended); // 282
356 DECL_TEMPLATE(darwin, fchmod_extended); // 283
357 DECL_TEMPLATE(darwin, access_extended); // 284
358 DECL_TEMPLATE(darwin, settid); // 285
359 #if DARWIN_VERS >= DARWIN_10_6
360 DECL_TEMPLATE(darwin, gettid); // 286
361 #endif
362 // NYI setsgroups 287
363 // NYI getsgroups 288
364 // NYI setwgroups 289
365 // NYI getwgroups 290
366 // NYI mkfifo_extended 291
367 // NYI mkdir_extended 292
368 // NYI identitysvc 293
369 // NYI shared_region_check_np 294
370 // NYI shared_region_map_np 295
371 #if DARWIN_VERS >= DARWIN_10_6
372 // NYI vm_pressure_monitor 296
373 // NYI psynch_rw_longrdlock 297
374 // NYI psynch_rw_yieldwrlock 298
375 // NYI psynch_rw_downgrade 299
376 // NYI psynch_rw_upgrade 300
377 DECL_TEMPLATE(darwin, psynch_mutexwait); // 301
378 DECL_TEMPLATE(darwin, psynch_mutexdrop); // 302
379 DECL_TEMPLATE(darwin, psynch_cvbroad); // 303
380 DECL_TEMPLATE(darwin, psynch_cvsignal); // 304
381 DECL_TEMPLATE(darwin, psynch_cvwait); // 305
382 DECL_TEMPLATE(darwin, psynch_rw_rdlock); // 306
383 DECL_TEMPLATE(darwin, psynch_rw_wrlock); // 307
384 DECL_TEMPLATE(darwin, psynch_rw_unlock); // 308
385 // NYI psynch_rw_unlock2 309
386 #else
387 // old load_shared_file
388 // old reset_shared_file
389 // old new_system_shared_regions
390 // old shared_region_map_file_np
391 // old shared_region_make_private_np
392 // NYI __pthread_mutex_destroy 301
393 // NYI __pthread_mutex_init 302
394 // NYI __pthread_mutex_lock 303
395 // NYI __pthread_mutex_trylock 304
396 // NYI __pthread_mutex_unlock 305
397 // NYI __pthread_cond_init 306
398 // NYI __pthread_cond_destroy 307
399 // NYI __pthread_cond_broadcast 308
400 // NYI __pthread_cond_signal 309
401 #endif
402 // NYI getsid 310
403 // NYI settid_with_pid 311
404 #if DARWIN_VERS >= DARWIN_10_7
405 DECL_TEMPLATE(darwin, psynch_cvclrprepost); // 312
406 #else
407 // NYI __pthread_cond_timedwait 312
408 #endif
409 // NYI aio_fsync 313
410 DECL_TEMPLATE(darwin, aio_return); // 314
411 DECL_TEMPLATE(darwin, aio_suspend); // 315
412 // NYI aio_cancel 316
413 DECL_TEMPLATE(darwin, aio_error); // 317
414 DECL_TEMPLATE(darwin, aio_read); // 318
415 DECL_TEMPLATE(darwin, aio_write); // 319
416 // NYI lio_listio 320
417 // NYI __pthread_cond_wait 321
418 // NYI iopolicysys 322
419 // NYI process_policy 323
420 // NYI mlockall 324
421 // NYI munlockall 325
422 // 326
423 DECL_TEMPLATE(darwin, issetugid); // 327
424 DECL_TEMPLATE(darwin, __pthread_kill); // 328
425 DECL_TEMPLATE(darwin, __pthread_sigmask); // 329
426 // NYI __sigwait 330
427 DECL_TEMPLATE(darwin, __disable_threadsignal); // 331
428 DECL_TEMPLATE(darwin, __pthread_markcancel); // 332
429 DECL_TEMPLATE(darwin, __pthread_canceled); // 333
430 DECL_TEMPLATE(darwin, __semwait_signal); // 334
431 // old utrace
432 DECL_TEMPLATE(darwin, proc_info); // 336
433 DECL_TEMPLATE(darwin, sendfile); // 337
434 DECL_TEMPLATE(darwin, stat64); // 338
435 DECL_TEMPLATE(darwin, fstat64); // 339
436 DECL_TEMPLATE(darwin, lstat64); // 340
437 DECL_TEMPLATE(darwin, stat64_extended); // 341
438 DECL_TEMPLATE(darwin, lstat64_extended); // 342
439 DECL_TEMPLATE(darwin, fstat64_extended); // 343
440 DECL_TEMPLATE(darwin, getdirentries64); // 344
441 DECL_TEMPLATE(darwin, statfs64); // 345
442 DECL_TEMPLATE(darwin, fstatfs64); // 346
443 DECL_TEMPLATE(darwin, getfsstat64); // 347
444 DECL_TEMPLATE(darwin, __pthread_chdir); // 348
445 DECL_TEMPLATE(darwin, __pthread_fchdir); // 349
446 // NYI audit 350
447 DECL_TEMPLATE(darwin, auditon); // 351
448 // 352
449 // NYI getauid 353
450 // NYI setauid 354
451 // NYI getaudit 355
452 // NYI setaudit 356
453 DECL_TEMPLATE(darwin, getaudit_addr) // 357
454 // NYI setaudit_addr 358
455 // NYI auditctl 359
456 DECL_TEMPLATE(darwin, bsdthread_create); // 360
457 DECL_TEMPLATE(darwin, bsdthread_terminate); // 361
458 DECL_TEMPLATE(darwin, kqueue); // 362
459 DECL_TEMPLATE(darwin, kevent); // 363
460 // NYI lchown 364
461 // NYI stack_snapshot 365
462 DECL_TEMPLATE(darwin, bsdthread_register); // 366
463 DECL_TEMPLATE(darwin, workq_open); // 367
464 DECL_TEMPLATE(darwin, workq_ops); // 368
465 DECL_TEMPLATE(darwin, kevent64); // 369
466 // 370
467 // 371
468 #if DARWIN_VERS >= DARWIN_10_6
469 DECL_TEMPLATE(darwin, __thread_selfid); // 372
470 #endif
471 // 373
472 #if DARWIN_VERS >= DARWIN_10_11
473 // NYI kevent_qos // 374
474 #endif /* DARWIN_VERS >= DARWIN_10_11 */
475 #if DARWIN_VERS >= DARWIN_10_13
476 // NYI kevent_id // 375
477 #endif /* DARWIN_VERS >= DARWIN_10_13 */
478 // 376
479 // 377
480 // 378
481 // 379
482 // NYI __mac_execve 380
483 DECL_TEMPLATE(darwin, __mac_syscall); // 381
484 // NYI __mac_get_file 382
485 // NYI __mac_set_file 383
486 // NYI __mac_get_link 384
487 // NYI __mac_set_link 385
488 // NYI __mac_get_proc 386
489 // NYI __mac_set_proc 387
490 // NYI __mac_get_fd 388
491 // NYI __mac_set_fd 389
492 // NYI __mac_get_pid 390
493 // NYI __mac_get_lcid 391
494 // NYI __mac_get_lctx 392
495 // NYI __mac_set_lctx 393
496 #if DARWIN_VERS >= DARWIN_10_11
497 DECL_TEMPLATE(darwin, pselect); // 394
498 #else
499 // NYI setlcid 394
500 #endif /* DARWIN_VERS >= DARWIN_10_11 */
501 // NYI getlcid 395
502 // GEN read_nocancel 396
503 // GEN write_nocancel 397
504 // GEN open_nocancel 398
505 // GEN close_nocancel 399
506 // GEN wait4_nocancel 400
507 // NOC recvmsg_nocancel 401
508 // NOC sendmsg_nocancel 402
509 // NOC recvfrom_nocancel 403
510 // NOC accept_nocancel 404
511 // GEN msync_nocancel 405
512 // NOC fcntl_nocancel 406
513 // GEN select_nocancel 407
514 // GEN fsync_nocancel 408
515 // NOC connect_nocancel 409
516 // NYI sigsuspend_nocancel 410
517 // GEN readv_nocancel 411
518 // GEN writev_nocancel 412
519 // NOC sendto_nocancel 413
520 // GEN pread_nocancel 414
521 // GEN pwrite_nocancel 415
522 // NYI waitid_nocancel 416
523 // GEN poll_nocancel 417
524 // NYI msgsnd_nocancel 418
525 // NYI msgrcv_nocancel 419
526 // NOC sem_wait_nocancel 420
527 // NYI aio_suspend_nocancel 421
528 // NYI __sigwait_nocancel 422
529 // NOC __semwait_signal_nocancel 423
530 // NYI __mac_mount 424
531 // NYI __mac_get_mount 425
532 // NYI __mac_getfsstat 426
533 DECL_TEMPLATE(darwin, fsgetpath); // 427
534 DECL_TEMPLATE(darwin, audit_session_self); // 428
535 // NYI audit_session_join 429
536 DECL_TEMPLATE(darwin, fileport_makeport); // 430
538 // NYI fileport_makefd 431
539 // NYI audit_session_port 432
540 // NYI pid_suspend 433
541 // NYI pid_resume 434
542 #if DARWIN_VERS >= DARWIN_10_10
543 // NYI pid_hibernate 435
544 // NYI pid_shutdown_sockets 436
545 #endif /* DARWIN_VERS >= DARWIN_10_10 */
546 // old old shared_region_slide_np 437
547 // NYI shared_region_map_and_slide_np // 438
548 // NYI kas_info // 439
549 // NYI memorystatus_control // 440
550 DECL_TEMPLATE(darwin, guarded_open_np); // 441
551 DECL_TEMPLATE(darwin, guarded_close_np); // 442
552 DECL_TEMPLATE(darwin, guarded_kqueue_np); // 443
553 DECL_TEMPLATE(darwin, change_fdguard_np); // 444
554 // old __proc_suppress 445
555 // NYI proc_rlimit_control // 446
556 DECL_TEMPLATE(darwin, connectx); // 447
557 DECL_TEMPLATE(darwin, disconnectx); // 448
558 // NYI peeloff // 449
559 // NYI socket_delegate // 450
560 // NYI telemetry // 451
561 // NYI proc_uuid_policy // 452
562 // NYI memorystatus_get_level // 453
563 // NYI system_override // 454
564 // NYI vfs_purge // 455
565 #if DARWIN_VERS >= DARWIN_10_10
566 // NYI sfi_ctl // 456
567 // NYI sfi_pidctl // 457
568 // NYI coalition // 458
569 // NYI coalition_info // 459
570 DECL_TEMPLATE(darwin, necp_match_policy); // 460
571 DECL_TEMPLATE(darwin, getattrlistbulk); // 461
572 #endif /* DARWIN_VERS >= DARWIN_10_10 */
573 #if DARWIN_VERS >= DARWIN_10_12
574 // NYI clonefileat // 462
575 #endif /* DARWIN_VERS >= DARWIN_10_12 */
576 #if DARWIN_VERS >= DARWIN_10_10
577 // NYI openat // 463
578 // NYI openat_nocancel // 464
579 // NYI renameat // 465
580 DECL_TEMPLATE(darwin, faccessat); // 466
581 // NYI fchmodat // 467
582 // NYI fchownat // 468
583 // NYI fstatat // 469
584 DECL_TEMPLATE(darwin, fstatat64); // 470
585 // NYI linkat // 471
586 // NYI unlinkat // 472
587 DECL_TEMPLATE(darwin, readlinkat); // 473
588 // NYI symlinkat // 474
589 // NYI mkdirat // 475
590 // NYI getattrlistat // 476
591 // NYI proc_trace_log // 477
592 DECL_TEMPLATE(darwin, bsdthread_ctl); // 478
593 // NYI openbyid_np // 479
594 // NYI recvmsg_x // 480
595 // NYI sendmsg_x // 481
596 // NYI thread_selfusage // 482
597 DECL_TEMPLATE(darwin, csrctl); // 483
598 DECL_TEMPLATE(darwin, guarded_open_dprotected_np); // 484
599 DECL_TEMPLATE(darwin, guarded_write_np); // 485
600 DECL_TEMPLATE(darwin, guarded_pwrite_np); // 486
601 DECL_TEMPLATE(darwin, guarded_writev_np); // 487
602 // NYI renameatx_np // 488
603 // NYI mremap_encrypted // 489
604 #endif /* DARWIN_VERS >= DARWIN_10_10 */
605 #if DARWIN_VERS >= DARWIN_10_11
606 // NYI netagent_trigger // 490
607 // NYI stack_snapshot_with_config // 491
608 // NYI microstackshot // 492
609 // NYI grab_pgo_data // 493
610 // NYI persona // 494
611 // 495
612 // 496
613 // 497
614 // 498
615 // NYI work_interval_ctl // 499
616 #endif /* DARWIN_VERS >= DARWIN_10_11 */
617 #if DARWIN_VERS >= DARWIN_10_12
618 DECL_TEMPLATE(darwin, getentropy); // 500
619 // NYI necp_open // 501
620 // NYI necp_client_action // 502
621 // 503
622 // 504
623 // 505
624 // 506
625 // 507
626 // 508
627 // 509
628 // 510
629 // 511
630 // 512
631 // 513
632 // 514
633 // NYI ulock_wait // 515
634 DECL_TEMPLATE(darwin, ulock_wake); // 516
635 // NYI fclonefileat // 517
636 // NYI fs_snapshot // 518
637 // 519
638 // NYI terminate_with_payload // 520
639 // NYI abort_with_payload // 521
640 #endif /* DARWIN_VERS >= DARWIN_10_12 */
641 #if DARWIN_VERS >= DARWIN_10_13
642 // NYI necp_session_open // 522
643 // NYI necp_session_action // 523
644 // NYI setattrlistat // 524
645 // NYI net_qos_guideline // 525
646 // NYI fmount // 526
647 // NYI ntp_adjtime // 527
648 // NYI ntp_gettime // 528
649 // NYI os_fault_with_payload // 529
650 #endif /* DARWIN_VERS >= DARWIN_10_13 */
652 // Mach message helpers
653 DECL_TEMPLATE(darwin, mach_port_set_context);
654 DECL_TEMPLATE(darwin, host_info);
655 DECL_TEMPLATE(darwin, host_page_size);
656 DECL_TEMPLATE(darwin, host_get_io_master);
657 DECL_TEMPLATE(darwin, host_get_clock_service);
658 DECL_TEMPLATE(darwin, host_request_notification);
659 DECL_TEMPLATE(darwin, host_create_mach_voucher);
660 DECL_TEMPLATE(darwin, host_get_special_port);
661 DECL_TEMPLATE(darwin, mach_port_type);
662 DECL_TEMPLATE(darwin, mach_port_extract_member);
663 DECL_TEMPLATE(darwin, mach_port_allocate);
664 DECL_TEMPLATE(darwin, mach_port_deallocate);
665 DECL_TEMPLATE(darwin, mach_port_get_refs);
666 DECL_TEMPLATE(darwin, mach_port_mod_refs);
667 DECL_TEMPLATE(darwin, mach_port_get_set_status);
668 DECL_TEMPLATE(darwin, mach_port_move_member);
669 DECL_TEMPLATE(darwin, mach_port_destroy);
670 DECL_TEMPLATE(darwin, mach_port_request_notification);
671 DECL_TEMPLATE(darwin, mach_port_insert_right);
672 DECL_TEMPLATE(darwin, mach_port_extract_right);
673 DECL_TEMPLATE(darwin, mach_port_get_attributes);
674 DECL_TEMPLATE(darwin, mach_port_set_attributes);
675 DECL_TEMPLATE(darwin, mach_port_insert_member);
676 DECL_TEMPLATE(darwin, task_get_special_port);
677 DECL_TEMPLATE(darwin, task_set_special_port);
678 DECL_TEMPLATE(darwin, task_get_exception_ports);
679 DECL_TEMPLATE(darwin, semaphore_create);
680 DECL_TEMPLATE(darwin, semaphore_destroy);
681 DECL_TEMPLATE(darwin, task_policy_set);
682 DECL_TEMPLATE(darwin, mach_ports_register);
683 DECL_TEMPLATE(darwin, mach_ports_lookup);
684 DECL_TEMPLATE(darwin, task_info);
685 DECL_TEMPLATE(darwin, task_set_info);
686 DECL_TEMPLATE(darwin, task_threads);
687 DECL_TEMPLATE(darwin, task_suspend);
688 DECL_TEMPLATE(darwin, task_resume);
689 DECL_TEMPLATE(darwin, vm_allocate);
690 DECL_TEMPLATE(darwin, vm_deallocate);
691 DECL_TEMPLATE(darwin, vm_protect);
692 DECL_TEMPLATE(darwin, vm_inherit);
693 DECL_TEMPLATE(darwin, vm_read);
694 DECL_TEMPLATE(darwin, mach_vm_read);
695 DECL_TEMPLATE(darwin, vm_copy);
696 DECL_TEMPLATE(darwin, vm_read_overwrite);
697 DECL_TEMPLATE(darwin, vm_map);
698 DECL_TEMPLATE(darwin, vm_remap);
699 DECL_TEMPLATE(darwin, mach_make_memory_entry_64);
700 DECL_TEMPLATE(darwin, vm_purgable_control);
701 DECL_TEMPLATE(darwin, mach_vm_purgable_control);
702 DECL_TEMPLATE(darwin, mach_vm_allocate);
703 DECL_TEMPLATE(darwin, mach_vm_deallocate);
704 DECL_TEMPLATE(darwin, mach_vm_protect);
705 DECL_TEMPLATE(darwin, mach_vm_copy);
706 DECL_TEMPLATE(darwin, mach_vm_read_overwrite);
707 DECL_TEMPLATE(darwin, mach_vm_inherit);
708 DECL_TEMPLATE(darwin, mach_vm_map);
709 DECL_TEMPLATE(darwin, mach_vm_remap);
710 DECL_TEMPLATE(darwin, mach_vm_region_recurse);
711 DECL_TEMPLATE(darwin, thread_terminate);
712 DECL_TEMPLATE(darwin, thread_create);
713 DECL_TEMPLATE(darwin, thread_create_running);
714 DECL_TEMPLATE(darwin, thread_suspend);
715 DECL_TEMPLATE(darwin, thread_resume);
716 DECL_TEMPLATE(darwin, thread_get_state);
717 DECL_TEMPLATE(darwin, thread_policy);
718 DECL_TEMPLATE(darwin, thread_policy_set);
719 DECL_TEMPLATE(darwin, thread_info);
720 DECL_TEMPLATE(darwin, bootstrap_register);
721 DECL_TEMPLATE(darwin, bootstrap_look_up);
722 DECL_TEMPLATE(darwin, mach_msg_receive);
723 DECL_TEMPLATE(darwin, mach_msg_bootstrap);
724 DECL_TEMPLATE(darwin, mach_msg_host);
725 DECL_TEMPLATE(darwin, mach_msg_task);
726 DECL_TEMPLATE(darwin, mach_msg_thread);
728 // Mach traps
729 #if DARWIN_VERS >= DARWIN_10_8
730 DECL_TEMPLATE(darwin, kernelrpc_mach_vm_allocate_trap);
731 DECL_TEMPLATE(darwin, kernelrpc_mach_vm_deallocate_trap);
732 DECL_TEMPLATE(darwin, kernelrpc_mach_vm_protect_trap);
733 DECL_TEMPLATE(darwin, kernelrpc_mach_vm_map_trap);
734 DECL_TEMPLATE(darwin, kernelrpc_mach_port_allocate_trap);
735 DECL_TEMPLATE(darwin, kernelrpc_mach_port_destroy_trap);
736 DECL_TEMPLATE(darwin, kernelrpc_mach_port_deallocate_trap);
737 DECL_TEMPLATE(darwin, kernelrpc_mach_port_mod_refs_trap);
738 DECL_TEMPLATE(darwin, kernelrpc_mach_port_move_member_trap);
739 DECL_TEMPLATE(darwin, kernelrpc_mach_port_insert_right_trap);
740 DECL_TEMPLATE(darwin, kernelrpc_mach_port_insert_member_trap);
741 DECL_TEMPLATE(darwin, kernelrpc_mach_port_extract_member_trap);
742 DECL_TEMPLATE(darwin, kernelrpc_mach_port_construct_trap);
743 DECL_TEMPLATE(darwin, kernelrpc_mach_port_destruct_trap);
744 DECL_TEMPLATE(darwin, kernelrpc_mach_port_guard_trap);
745 DECL_TEMPLATE(darwin, kernelrpc_mach_port_unguard_trap);
746 DECL_TEMPLATE(darwin, iopolicysys);
747 DECL_TEMPLATE(darwin, process_policy);
748 #endif /* DARWIN_VERS >= DARWIN_10_8 */
749 DECL_TEMPLATE(darwin, mach_msg_unhandled);
750 DECL_TEMPLATE(darwin, mach_msg_unhandled_check);
751 DECL_TEMPLATE(darwin, mach_msg);
752 DECL_TEMPLATE(darwin, mach_reply_port);
753 DECL_TEMPLATE(darwin, mach_thread_self);
754 DECL_TEMPLATE(darwin, mach_host_self);
755 DECL_TEMPLATE(darwin, mach_task_self);
756 DECL_TEMPLATE(darwin, syscall_thread_switch);
757 DECL_TEMPLATE(darwin, semaphore_signal);
758 DECL_TEMPLATE(darwin, semaphore_signal_all);
759 DECL_TEMPLATE(darwin, semaphore_signal_thread);
760 DECL_TEMPLATE(darwin, semaphore_wait);
761 DECL_TEMPLATE(darwin, semaphore_wait_signal);
762 DECL_TEMPLATE(darwin, semaphore_timedwait);
763 DECL_TEMPLATE(darwin, semaphore_timedwait_signal);
764 DECL_TEMPLATE(darwin, task_for_pid);
765 DECL_TEMPLATE(darwin, pid_for_task);
767 #if DARWIN_VERS >= DARWIN_10_13
768 // NYI thread_get_special_reply_port // 50
769 #endif /* DARWIN_VERS >= DARWIN_10_13 */
771 #if DARWIN_VERS >= DARWIN_10_12
772 DECL_TEMPLATE(darwin, host_create_mach_voucher_trap);
773 DECL_TEMPLATE(darwin, task_register_dyld_image_infos);
774 DECL_TEMPLATE(darwin, task_register_dyld_shared_cache_image_info);
775 DECL_TEMPLATE(darwin, mach_generate_activity_id);
776 #endif /* DARWIN_VERS >= DARWIN_10_12 */
778 DECL_TEMPLATE(darwin, mach_timebase_info);
779 DECL_TEMPLATE(darwin, mach_wait_until);
780 DECL_TEMPLATE(darwin, mk_timer_create);
781 DECL_TEMPLATE(darwin, mk_timer_destroy);
782 DECL_TEMPLATE(darwin, mk_timer_arm);
783 DECL_TEMPLATE(darwin, mk_timer_cancel);
784 DECL_TEMPLATE(darwin, iokit_user_client_trap);
785 DECL_TEMPLATE(darwin, swtch);
786 DECL_TEMPLATE(darwin, swtch_pri);
788 // Machine-dependent traps
789 DECL_TEMPLATE(darwin, thread_fast_set_cthread_self);
791 // syswrap-<arch>-darwin.c
792 #include <mach/mach.h>
793 extern
794 void thread_state_from_vex(thread_state_t mach_generic,
795 thread_state_flavor_t flavor,
796 mach_msg_type_number_t count,
797 VexGuestArchState *vex_generic);
798 extern
799 void thread_state_to_vex(const thread_state_t mach_generic,
800 thread_state_flavor_t flavor,
801 mach_msg_type_number_t count,
802 VexGuestArchState *vex_generic);
803 extern
804 ThreadState *build_thread(const thread_state_t state,
805 thread_state_flavor_t flavor,
806 mach_msg_type_number_t count);
807 extern
808 void hijack_thread_state(thread_state_t mach_generic,
809 thread_state_flavor_t flavor,
810 mach_msg_type_number_t count,
811 ThreadState *tst);
812 extern
813 __attribute__((noreturn))
814 void call_on_new_stack_0_1 ( Addr stack,
815 Addr retaddr,
816 void (*f)(Word),
817 Word arg1 );
819 extern void pthread_hijack_asm(void);
820 extern void pthread_hijack(Addr self, Addr kport, Addr func, Addr func_arg,
821 Addr stacksize, Addr flags, Addr sp);
822 extern void wqthread_hijack_asm(void);
823 extern void wqthread_hijack(Addr self, Addr kport, Addr stackaddr, Addr workitem, Int reuse, Addr sp);
825 extern Addr pthread_starter;
826 extern Addr wqthread_starter;
827 extern SizeT pthread_structsize;
830 #endif
832 /*--------------------------------------------------------------------*/
833 /*--- end ---*/
834 /*--------------------------------------------------------------------*/