Rizin
unix-like reverse engineering framework and cli tools
mach0_specs.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2010-2020 nibble <nibble.ds@gmail.com>
2 // SPDX-FileCopyrightText: 2010-2020 pancake <pancake@nopcode.org>
3 // SPDX-License-Identifier: LGPL-3.0-only
4 
5 #ifndef _INCLUDE_RZ_BIN_MACH0_SPECS_H_
6 #define _INCLUDE_RZ_BIN_MACH0_SPECS_H_
7 
8 typedef int integer_t;
9 
10 // NOTE(eddyb) the following have been slightly modified to work under rizin.
11 
12 #include "mach0_defines.h"
13 
14 // HACK(eddyb) everything below is from the old mach0_specs.h, should replace
15 // with proper original definitions.
16 
17 #undef MACH0_
18 
19 #if RZ_BIN_MACH064
20 #define MACH0_(name) name##_64
21 #else
22 #define MACH0_(name) name
23 #endif
24 
25 #define RZ_BIN_MACH0_SYMBOL_TYPE_EXT 0
26 #define RZ_BIN_MACH0_SYMBOL_TYPE_LOCAL 1
27 
45 };
46 
69 };
70 
71 #define X86_THREAD_STATE32 1
72 #define X86_THREAD_STATE64 4
73 
75  ut32 srr0; /* Instruction address register (PC) */
76  ut32 srr1; /* Machine state register (supervisor) */
109 
110  ut32 cr; /* Condition register */
111  ut32 xer; /* User's integer exception register */
112  ut32 lr; /* Link register */
113  ut32 ctr; /* Count register */
114  ut32 mq; /* MQ register (601 only) */
115 
116  ut32 vrsave; /* Vector Save Register */
117 };
118 
120  ut64 srr0; /* Instruction address register (PC) */
121  ut64 srr1; /* Machine state register (supervisor) */
154 
155  ut32 cr; /* Condition register */
156  ut64 xer; /* User's integer exception register */
157  ut64 lr; /* Link register */
158  ut64 ctr; /* Count register */
159 
160  ut32 vrsave; /* Vector Save Register */
161 };
162 
180  ut32 r16; /* Apple's thread_state has this 17th reg, bug?? */
181 };
182 
184  ut64 x[29];
190 };
191 
192 /* Cache header */
193 
194 struct cache_header {
195  char version[16];
196  ut32 baseaddroff; // mappingOffset
207 };
208 
209 // dupe?
210 typedef struct {
211  char magic[16];
223  uint8_t uuid[16];
231 } cache_hdr_t;
232 
233 typedef struct {
234  uint8_t uuid[16];
239 
240 typedef struct {
246 } cache_map_t;
247 
248 typedef struct {
254 } cache_img_t;
255 
256 typedef struct {
263 
264 typedef struct {
274 
275 typedef struct {
283 
284 typedef struct {
302 } cache_accel_t;
303 
304 typedef struct {
312 
313 typedef struct {
321 
322 typedef struct {
327 
328 typedef struct {
333 
334 typedef struct {
344 
345 typedef struct {
348 
349 #define DYLD_CACHE_SLIDE_PAGE_ATTRS 0xC000
350 #define DYLD_CACHE_SLIDE_PAGE_ATTR_EXTRA 0x8000
351 #define DYLD_CACHE_SLIDE_PAGE_ATTR_NO_REBASE 0x4000
352 #define DYLD_CACHE_SLIDE_PAGE_ATTR_END 0x8000
353 #define DYLD_CACHE_SLIDE_V3_PAGE_ATTR_NO_REBASE 0xFFFF
354 #endif
uint32_t ut32
int integer_t
Definition: mach0_specs.h:8
unsigned int uint32_t
Definition: sftypes.h:29
unsigned long uint64_t
Definition: sftypes.h:28
unsigned char uint8_t
Definition: sftypes.h:31
uint32_t dofSectionsCount
Definition: mach0_specs.h:294
uint32_t bottomUpListOffset
Definition: mach0_specs.h:288
uint32_t reExportCount
Definition: mach0_specs.h:296
uint32_t dofSectionsOffset
Definition: mach0_specs.h:293
uint64_t dyldSectionAddr
Definition: mach0_specs.h:301
uint32_t rangeTableCount
Definition: mach0_specs.h:300
uint32_t depListCount
Definition: mach0_specs.h:298
uint32_t imageExtrasCount
Definition: mach0_specs.h:286
uint32_t dylibTrieOffset
Definition: mach0_specs.h:289
uint32_t reExportListOffset
Definition: mach0_specs.h:295
uint32_t depListOffset
Definition: mach0_specs.h:297
uint32_t initializersCount
Definition: mach0_specs.h:292
uint32_t version
Definition: mach0_specs.h:285
uint32_t initializersOffset
Definition: mach0_specs.h:291
uint32_t rangeTableOffset
Definition: mach0_specs.h:299
uint32_t dylibTrieSize
Definition: mach0_specs.h:290
uint32_t imagesExtrasOffset
Definition: mach0_specs.h:287
uint64_t slideInfoOffset
Definition: mach0_specs.h:219
uint64_t accelerateInfoAddr
Definition: mach0_specs.h:227
uint64_t localSymbolsOffset
Definition: mach0_specs.h:221
uint64_t codeSignatureSize
Definition: mach0_specs.h:218
uint64_t imagesTextCount
Definition: mach0_specs.h:230
uint64_t cacheType
Definition: mach0_specs.h:224
uint64_t codeSignatureOffset
Definition: mach0_specs.h:217
uint32_t branchPoolsOffset
Definition: mach0_specs.h:225
uint64_t slideInfoSize
Definition: mach0_specs.h:220
uint64_t localSymbolsSize
Definition: mach0_specs.h:222
uint64_t dyldBaseAddress
Definition: mach0_specs.h:216
uint64_t accelerateInfoSize
Definition: mach0_specs.h:228
uint32_t imagesCount
Definition: mach0_specs.h:215
uint64_t imagesTextOffset
Definition: mach0_specs.h:229
uint32_t mappingOffset
Definition: mach0_specs.h:212
uint32_t mappingCount
Definition: mach0_specs.h:213
uint32_t imagesOffset
Definition: mach0_specs.h:214
uint32_t branchPoolsCount
Definition: mach0_specs.h:226
ut64 slideInfoSize
Definition: mach0_specs.h:204
ut64 slideInfoOffset
Definition: mach0_specs.h:203
ut64 codeSignatureSize
Definition: mach0_specs.h:202
ut32 mappingCount
Definition: mach0_specs.h:197
ut64 localSymbolsOffset
Definition: mach0_specs.h:205
ut64 codeSignatureOffset
Definition: mach0_specs.h:201
ut32 baseaddroff
Definition: mach0_specs.h:196
ut64 localSymbolsSize
Definition: mach0_specs.h:206
uint64_t address
Definition: mach0_specs.h:249
uint32_t pathFileOffset
Definition: mach0_specs.h:252
uint64_t inode
Definition: mach0_specs.h:251
uint32_t pad
Definition: mach0_specs.h:253
uint64_t modTime
Definition: mach0_specs.h:250
uint32_t dependentsStartArrayIndex
Definition: mach0_specs.h:309
uint64_t weakBindingsAddr
Definition: mach0_specs.h:306
uint32_t exportsTrieSize
Definition: mach0_specs.h:307
uint32_t reExportsStartArrayIndex
Definition: mach0_specs.h:310
uint64_t exportsTrieAddr
Definition: mach0_specs.h:305
uint32_t weakBindingsSize
Definition: mach0_specs.h:308
Definition: mach0_specs.h:328
uint32_t nlistCount
Definition: mach0_specs.h:331
uint64_t dylibOffset
Definition: mach0_specs.h:329
uint32_t nlistStartIndex
Definition: mach0_specs.h:330
Definition: mach0_specs.h:322
uint32_t dylibOffset
Definition: mach0_specs.h:323
uint32_t nlistStartIndex
Definition: mach0_specs.h:324
uint32_t nlistCount
Definition: mach0_specs.h:325
uint32_t stringsOffset
Definition: mach0_specs.h:316
uint32_t entriesOffset
Definition: mach0_specs.h:318
uint32_t maxProt
Definition: mach0_specs.h:244
uint64_t size
Definition: mach0_specs.h:242
uint32_t initProt
Definition: mach0_specs.h:245
uint64_t fileOffset
Definition: mach0_specs.h:243
uint64_t address
Definition: mach0_specs.h:241
uint64_t slideInfoOffset
Definition: mach0_specs.h:338
uint64_t slideInfoSize
Definition: mach0_specs.h:339
uint32_t entries_count
Definition: mach0_specs.h:280
uint32_t entries_size
Definition: mach0_specs.h:281
uint32_t toc_count
Definition: mach0_specs.h:278
uint32_t version
Definition: mach0_specs.h:276
uint32_t entries_offset
Definition: mach0_specs.h:279
uint32_t toc_offset
Definition: mach0_specs.h:277
uint32_t page_extras_count
Definition: mach0_specs.h:270
uint32_t page_extras_offset
Definition: mach0_specs.h:269
uint32_t page_starts_offset
Definition: mach0_specs.h:267
uint32_t version
Definition: mach0_specs.h:265
uint64_t delta_mask
Definition: mach0_specs.h:271
uint32_t page_starts_count
Definition: mach0_specs.h:268
uint64_t value_add
Definition: mach0_specs.h:272
uint32_t page_size
Definition: mach0_specs.h:266
uint32_t page_starts_count
Definition: mach0_specs.h:259
uint32_t version
Definition: mach0_specs.h:257
uint32_t page_size
Definition: mach0_specs.h:258
uint64_t auth_value_add
Definition: mach0_specs.h:261
uint32_t padding
Definition: mach0_specs.h:260
uint32_t pathOffset
Definition: mach0_specs.h:237
uint32_t textSegmentSize
Definition: mach0_specs.h:236
uint64_t loadAddress
Definition: mach0_specs.h:235
uint64_t sel_string_base
Definition: mach0_specs.h:346
ut64(WINAPI *w32_GetEnabledXStateFeatures)()