1#![allow(non_snake_case)]
4
5use crate::ffi::{
6 c_uint, c_ulong,
7 c_int,
8 c_uchar, c_char,
9 c_void,
10};
11use crate::ffi::uintptr_t;
12
13use crate::mach_types::uuid_t;
14use crate::port::mach_port_t;
15
16#[repr(C)]
17#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
18pub struct mach_header {
19 pub magic: c_uint,
20 pub cputype: c_int,
21 pub cpusubtype: c_int,
22 pub filetype: c_uint,
23 pub ncmds: c_uint,
24 pub sizeofcmds: c_uint,
25 pub flags: c_uint,
26}
27
28#[repr(C)]
29#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
30pub struct mach_header_64 {
31 pub magic: c_uint,
32 pub cputype: c_int,
33 pub cpusubtype: c_int,
34 pub filetype: c_uint,
35 pub ncmds: c_uint,
36 pub sizeofcmds: c_uint,
37 pub flags: c_uint,
38 pub reserved: c_uint,
39}
40
41#[repr(C)]
42#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
43pub struct segment_command_64 {
44 pub cmd: c_uint,
45 pub cmdsize: c_uint,
46 pub segname: [c_char; 16],
47 pub vmaddr: c_ulong,
48 pub vmsize: c_ulong,
49 pub fileoff: c_ulong,
50 pub filesize: c_ulong,
51 pub maxprot: c_int,
52 pub initprot: c_int,
53 pub nsects: c_uint,
54 pub flags: c_uint,
55}
56
57#[repr(C)]
58#[derive(Copy, Clone, Debug, Hash, PartialOrd, PartialEq, Eq, Ord)]
59pub struct dyld_uuid_info {
60 pub imageLoadAddress: *const mach_header,
61 pub imageUUID: uuid_t,
62}
63
64#[repr(C)]
65#[derive(Copy, Clone, Debug, Hash, PartialOrd, PartialEq, Eq, Ord)]
66pub struct dyld_aot_image_info {
67 pub x86LoadAddress: *const mach_header,
68 pub aotLoadAddress: *const mach_header,
69 pub aotImageSize: c_ulong,
70 pub aotImageKey: [c_uchar; 32],
71}
72
73#[repr(C)]
74#[derive(Copy, Clone, Debug, Hash, PartialOrd, PartialEq, Eq, Ord)]
75pub struct dyld_image_info {
76 pub imageLoadAddress: *mut mach_header,
77 pub imageFilePath: *const c_char,
78 pub imageFileModDate: uintptr_t,
79}
80
81pub type dyld_image_mode = c_uint;
82
83pub type dyld_image_notifier = ::core::option::Option<
84 unsafe extern "C" fn(mode: dyld_image_mode, infoCount: c_uint, info: *const dyld_image_info),
85>;
86
87#[repr(C, align(16))]
88#[derive(Copy, Clone, Debug, Hash, PartialOrd, PartialEq, Eq, Ord)]
89pub struct dyld_all_image_infos {
90 pub version: c_uint,
91 pub infoArrayCount: c_uint,
92 pub infoArray: *const dyld_image_info,
93 pub notification: dyld_image_notifier,
94 pub processDetachedFromSharedRegion: bool,
95 pub libSystemInitialized: bool,
96 pub dyldImageLoadAddress: *const mach_header,
97 pub jitInfo: *mut c_void,
98 pub dyldVersion: *const c_char,
99 pub errorMessage: *const c_char,
100 pub terminationFlags: uintptr_t,
101 pub coreSymbolicationShmPage: *mut c_void,
102 pub systemOrderFlag: uintptr_t,
103 pub uuidArrayCount: uintptr_t,
104 pub uuidArray: *const dyld_uuid_info,
105 pub dyldAllImageInfosAddress: *mut dyld_all_image_infos,
106 pub initialImageCount: uintptr_t,
107 pub errorKind: uintptr_t,
108 pub errorClientOfDylibPath: *const c_char,
109 pub errorTargetDylibPath: *const c_char,
110 pub errorSymbol: *const c_char,
111 pub sharedCacheSlide: uintptr_t,
112 pub sharedCacheUUID: [c_uchar; 16],
113 pub sharedCacheBaseAddress: uintptr_t,
114 pub infoArrayChangeTimestamp: c_ulong,
115 pub dyldPath: *const c_char,
116 pub notifyPorts: [mach_port_t; 8],
117 pub reserved: [uintptr_t; 7],
118 pub sharedCacheFSID: c_ulong,
119 pub sharedCacheFSObjID: c_ulong,
120 pub compact_dyld_image_info_addr: uintptr_t,
121 pub compact_dyld_image_info_size: uintptr_t,
122 pub platform: c_uint,
123 pub aotInfoCount: c_uint,
124 pub aotInfoArray: *const dyld_aot_image_info,
125 pub aotInfoArrayChangeTimestamp: c_ulong,
126 pub aotSharedCacheBaseAddress: uintptr_t,
127 pub aotSharedCacheUUID: [c_uchar; 16],
128}