forked from peterfillmore/removePIE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xnu-definitions.h
41 lines (34 loc) · 1.45 KB
/
xnu-definitions.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
These definitions are taken from the XNU kernel:
https://opensource.apple.com/source/xnu/
*/
#include <stdint.h>
#define MH_PIE 0x200000 /* When this bit is set, the OS will load the main executable at a random address. */
#define MH_MAGIC 0xFEEDFACE /* the mach magic number (little endian) */
#define MH_CIGAM 0xCEFAEDFE /* the mach magic number (big endian) --> NXSwapInt(MH_MAGIC), look at byte_order.h */
#define MH_MAGIC_64 0xFEEDFACF /* the 64-bit mach magic number (little endian) */
#define MH_CIGAM_64 0xCFFAEDFE /* the 64-bit mach magic number (big endian) --> NXSwapInt(MH_MAGIC), look at byte_order.h */
typedef int32_t integer_t;
typedef integer_t cpu_type_t;
typedef integer_t cpu_subtype_t;
struct mach_header
{
uint32_t magic; /* mach magic number identifier */
cpu_type_t cputype; /* cpu specifier */
cpu_subtype_t cpusubtype; /* machine specifier */
uint32_t filetype; /* type of file */
uint32_t ncmds; /* number of load commands */
uint32_t sizeofcmds; /* the size of all the load commands */
uint32_t flags; /* flags */
};
struct mach_header_64
{
uint32_t magic; /* mach magic number identifier */
cpu_type_t cputype; /* cpu specifier */
cpu_subtype_t cpusubtype; /* machine specifier */
uint32_t filetype; /* type of file */
uint32_t ncmds; /* number of load commands */
uint32_t sizeofcmds; /* the size of all the load commands */
uint32_t flags; /* flags */
uint32_t reserved; /* reserved */
};