]>
git.saurik.com Git - apple/system_cmds.git/blob - gcore.tproj/loader_additions.h
2 * Copyright (c) 2015 Apple Inc. All rights reserved.
5 #include <mach-o/loader.h>
7 #ifndef _LOADER_ADDITIONS_H
8 #define _LOADER_ADDITIONS_H
11 * Something like this should end up in <mach-o/loader.h>
13 #define proto_LC_COREINFO 0x40 /* unofficial value!! */
15 #define proto_CORETYPE_KERNEL 1
16 #define proto_CORETYPE_USER 2
17 #define proto_CORETYPE_IBOOT 3
19 struct proto_coreinfo_command
{
20 uint32_t cmd
; /* LC_COREINFO */
21 uint32_t cmdsize
; /* total size of this command */
22 uint32_t version
; /* currently 1 */
24 * 'type' determines the content of the corefile; interpretation
25 * of the address and uuid fields are specific to the type.
27 uint32_t type
; /* CORETYPE_KERNEL, CORETYPE_USER etc. */
28 uint64_t address
; /* load address of "main binary" */
29 uint8_t uuid
[16]; /* uuid of "main binary" */
30 uint64_t dyninfo
; /* dynamic modules info */
34 * These are flag bits for the segment_command 'flags' field.
37 #define proto_SG_COMP_ALG_MASK 0x7
38 /* carve out 3 bits for an enum i.e. allow for 7 flavors */
39 #define proto_SG_COMP_ALG_SHIFT 4 /* (bottom 4 bits taken) */
41 /* zero -> no compression */
42 #define proto_SG_COMP_LZ4 1 /* 0x100 */
43 #define proto_SG_COMP_ZLIB 2 /* 0x205 */
44 #define proto_SG_COMP_LZMA 3 /* 0x306 */
45 #define proto_SG_COMP_LZFSE 4 /* 0x801 */
47 #define proto_SG_COMP_ALG_TYPE(flags) (((flags) >> proto_SG_COMP_ALG_SHIFT) & proto_SG_COMP_ALG_MASK)
48 #define proto_SG_COMP_MAKE_FLAGS(type) (((type) & proto_SG_COMP_ALG_MASK) << proto_SG_COMP_ALG_SHIFT)
50 #define proto_LC_FILEREF 0x41 /* unofficial value! */
52 struct proto_fileref_command
{
53 uint32_t cmd
; /* LC_FILEREF */
55 union lc_str filename
; /* filename these bits come from */
56 uint8_t uuid
[16]; /* uuid if known */
57 uint64_t vmaddr
; /* memory address of this segment */
58 uint64_t vmsize
; /* memory size of this segment */
59 uint64_t fileoff
; /* file offset of this segment */
60 uint64_t filesize
; /* amount to map from the file */
61 vm_prot_t maxprot
; /* maximum VM protection */
62 vm_prot_t initprot
; /* initial VM protection */
65 #endif /* _LOADER_ADDITIONS_H */