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