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