]>
Commit | Line | Data |
---|---|---|
2fd3f4e8 A |
1 | /* -*- mode: C++; c-basic-offset: 4; tab-width: 4 -*- |
2 | * | |
3 | * Copyright (c) 2004-2013 Apple Inc. All rights reserved. | |
4 | * | |
5 | * @APPLE_LICENSE_HEADER_START@ | |
6 | * | |
7 | * This file contains Original Code and/or Modifications of Original Code | |
8 | * as defined in and that are subject to the Apple Public Source License | |
9 | * Version 2.0 (the 'License'). You may not use this file except in | |
10 | * compliance with the License. Please obtain a copy of the License at | |
11 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
12 | * file. | |
13 | * | |
14 | * The Original Code and all software distributed under the License are | |
15 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
16 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
17 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
18 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
19 | * Please see the License for the specific language governing rights and | |
20 | * limitations under the License. | |
21 | * | |
22 | * @APPLE_LICENSE_HEADER_END@ | |
23 | */ | |
24 | ||
25 | ||
26 | #ifndef __DYLD_SYSCALL_HELPERS__ | |
27 | #define __DYLD_SYSCALL_HELPERS__ | |
28 | ||
19894a12 | 29 | #include <dirent.h> |
df9d6cf7 | 30 | #include <mach-o/loader.h> |
2fd3f4e8 A |
31 | |
32 | #if __cplusplus | |
33 | namespace dyld { | |
34 | #endif | |
35 | ||
36 | // | |
37 | // This file contains the table of function pointers the host dyld supplies | |
38 | // to the iOS simulator dyld. | |
39 | // | |
40 | struct SyscallHelpers | |
41 | { | |
42 | uintptr_t version; | |
43 | int (*open)(const char* path, int oflag, int extra); | |
44 | int (*close)(int fd); | |
45 | ssize_t (*pread)(int fd, void* buf, size_t nbyte, off_t offset); | |
46 | ssize_t (*write)(int fd, const void* buf, size_t nbyte); | |
47 | void* (*mmap)(void* addr, size_t len, int prot, int flags, int fd, off_t offset); | |
48 | int (*munmap)(void* addr, size_t len); | |
49 | int (*madvise)(void* addr, size_t len, int advice); | |
50 | int (*stat)(const char* path, struct stat* buf); | |
51 | int (*fcntl)(int fildes, int cmd, void* result); | |
52 | int (*ioctl)(int fildes, unsigned long request, void* result); | |
53 | int (*issetugid)(void); | |
54 | char* (*getcwd)(char* buf, size_t size); | |
55 | char* (*realpath)(const char* file_name, char* resolved_name); | |
56 | kern_return_t (*vm_allocate)(vm_map_t target_task, vm_address_t *address, vm_size_t size, int flags); | |
57 | kern_return_t (*vm_deallocate)(vm_map_t target_task, vm_address_t address, vm_size_t size); | |
58 | kern_return_t (*vm_protect)(vm_map_t target_task, vm_address_t address, vm_size_t size, boolean_t max, vm_prot_t prot); | |
59 | void (*vlog)(const char* format, va_list list); | |
60 | void (*vwarn)(const char* format, va_list list); | |
61 | int (*pthread_mutex_lock)(pthread_mutex_t* m); | |
62 | int (*pthread_mutex_unlock)(pthread_mutex_t* m); | |
63 | mach_port_t (*mach_thread_self)(void); | |
64 | kern_return_t (*mach_port_deallocate)(ipc_space_t task, mach_port_name_t name); | |
65 | mach_port_name_t(*task_self_trap)(void); | |
66 | kern_return_t (*mach_timebase_info)(mach_timebase_info_t info); | |
67 | bool (*OSAtomicCompareAndSwapPtrBarrier)(void* old, void* nw, void * volatile *value); | |
68 | void (*OSMemoryBarrier)(void); | |
69 | void* (*getProcessInfo)(void); // returns dyld_all_image_infos*; | |
70 | int* (*errnoAddress)(); | |
71 | uint64_t (*mach_absolute_time)(); | |
19894a12 A |
72 | // Added in version 2 |
73 | kern_return_t (*thread_switch)(mach_port_name_t, int, mach_msg_timeout_t); | |
74 | // Added in version 3 | |
75 | DIR* (*opendir)(const char* path); | |
76 | int (*readdir_r)(DIR* dirp, struct dirent* entry, struct dirent **result); | |
77 | int (*closedir)(DIR* dirp); | |
df9d6cf7 A |
78 | // Added in version 4 |
79 | void (*coresymbolication_load_notifier)(void *connection, uint64_t load_timestamp, const char *image_path, const struct mach_header *mach_header); | |
80 | void (*coresymbolication_unload_notifier)(void *connection, uint64_t unload_timestamp, const char *image_path, const struct mach_header *mach_header); | |
2fd3f4e8 A |
81 | }; |
82 | ||
83 | extern const struct SyscallHelpers* gSyscallHelpers; | |
84 | ||
85 | ||
86 | #if __cplusplus | |
87 | } | |
88 | #endif | |
89 | ||
90 | #endif |