Upx_Doxygen
https://github.com/upx/upx
p_mach_enum.h
1 /* p_mach_enum.h --
2 
3  This file is part of the UPX executable compressor.
4 
5  Copyright (C) 2007-2016 John F. Reiser
6  All Rights Reserved.
7 
8  UPX and the UCL library are free software; you can redistribute them
9  and/or modify them under the terms of the GNU General Public License as
10  published by the Free Software Foundation; either version 2 of
11  the License, or (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program; see the file COPYING.
20  If not, write to the Free Software Foundation, Inc.,
21  59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 
23  John F. Reiser
24  <jreiser@users.sourceforge.net>
25  */
26 
27 
28 /*************************************************************************
29 // Use the preprocessor to work around
30 // - that the types embedding these enums have to be PODs, and
31 // deriving from an empty base class (which is the usual C++ way
32 // of "importing" enums) does not yield a POD any more
33 // - that older compilers do not correctly perform EBCO
34 **************************************************************************/
35 
36 #ifdef WANT_MACH_HEADER_ENUM /*{*/
37 #undef WANT_MACH_HEADER_ENUM
38  enum { // magic
39  MH_MAGIC = 0xfeedface
40  };
41  enum { // cputype
42  CPU_TYPE_I386 = 7,
43  CPU_TYPE_X86_64 = 0x01000007,
44  CPU_TYPE_ARM = 12,
45  CPU_TYPE_POWERPC = 0x00000012,
46  CPU_TYPE_POWERPC64 = 0x01000012,
47  CPU_TYPE_POWERPC64LE = 0x01000021
48  };
49  enum { // cpusubtype
50  CPU_SUBTYPE_ARM_ALL = 0,
51  CPU_SUBTYPE_ARM_V4T = 5,
52  CPU_SUBTYPE_ARM_V6 = 6
53  };
54  enum { // filetype
55  MH_EXECUTE = 2,
56  MH_DYLIB = 6,
57  MH_BUNDLE = 8 /* dynamically bound bundle file */
58  };
59  enum { // flags
60  MH_NOUNDEFS = 1,
61  MH_DYLDLINK = 4, /* code signing demands this */
62  MH_BINDATLOAD = 0x8, // DT_BIND_NOW
63  MH_TWOLEVEL = 0x80,
64  MH_PIE = 0x200000 // ASLR
65  };
66 #endif /*}*/
67 
68 #ifdef WANT_MACH_SEGMENT_ENUM /*{*/
69 #undef WANT_MACH_SEGMENT_ENUM
70  enum { // cmd
71  LC_REQ_DYLD = 0x80000000, // OR'ed ==> must not ignore
72  LC_SEGMENT = 0x1,
73  LC_SYMTAB = 0x2,
74  LC_THREAD = 0x4,
75  LC_UNIXTHREAD = 0x5,
76  LC_DYSYMTAB = 0xb,
77  LC_LOAD_DYLIB = 0xc,
78  LC_ID_DYLIB = 0xd,
79  LC_LOAD_DYLINKER = 0xe,
80  LC_ROUTINES = 0x11,
81  LC_TWOLEVEL_HINTS= 0x16,
82  LC_SEGMENT_64 = 0x19,
83  LC_ROUTINES_64 = 0x1a,
84  LC_UUID = 0x1b,
85  LC_RPATH = 0x1c,
86  LC_CODE_SIGNATURE = 0x1d,
87  LC_SEGMENT_SPLIT_INFO = 0x1e,
88  LC_REEXPORT_DYLIB = 0x1f,
89  LC_LAZY_LOAD_DYLIB= 0x20,
90  LC_ENCRYPTION_INFO= 0x21,
91  LC_DYLD_INFO = 0x22, // compressed dyld information (10.6.x)
92  LC_DYLD_INFO_ONLY = (0x22|LC_REQ_DYLD),
93  LC_VERSION_MIN_MACOSX= 0x24,
94  LC_FUNCTION_STARTS= 0x26,
95  LC_MAIN = (0x28|LC_REQ_DYLD),
96  LC_DATA_IN_CODE = 0x29,
97  LC_SOURCE_VERSION = 0x2a,
98  };
99  enum { // maxprot
100  VM_PROT_READ = 1,
101  VM_PROT_WRITE = 2,
102  VM_PROT_EXECUTE = 4
103  };
104 #endif /*}*/
105 
106 #ifdef WANT_MACH_SECTION_ENUM /*{*/
107 #undef WANT_MACH_SECTION_ENUM
108  enum { // section type (low byte only)
109  S_REGULAR = 0,
110  S_ZEROFILL,
111  S_CSTRING_LITERALS,
112  S_4BYTE_LITERALS,
113  S_8BYTE_LITERALS,
114  S_LITERAL_POINTERS,
115  S_NON_LAZY_SYMBOL_POINTERS, // sectname __nl_symbol_ptr
116  S_LAZY_SYMBOL_POINTERS, // sectname __la_symbol_ptr
117  S_SYMBOL_STUBS,
118  S_MOD_INIT_FUNC_POINTERS, // sectname __mod_init_func
119  S_MOD_TERM_FUNC_POINTERS,
120  S_COALESCED,
121  S_GB_ZEROFILL,
122  S_INTERPOSING,
123  S_16BYTE_LITERALS,
124  S_DTRACE_DOF
125  };
126  enum { // section flags (high 24 bits)
127  S_ATTR_PURE_INSTRUCTIONS = 0x80000000,
128  S_ATTR_NO_TOC = 0x40000000,
129  S_ATTR_STRIP_STATIC_SYMS = 0x20000000,
130  S_ATTR_NO_DEAD_STRIP = 0x10000000,
131  S_ATTR_LIVE_SUPPORT = 0x08000000,
132  S_ATTR_SELF_MODIFYING_CODE = 0x04000000,
133  S_ATTR_DEBUG = 0x02000000,
134  S_ATTR_SOME_INSTRUCTIONS = 0x00000400,
135  S_ATTR_EXT_RELOC = 0x00000200,
136  S_ATTR_LOC_RELOC = 0x00000100
137  };
138 #endif /*}*/
139 
140 #ifdef WANT_MACH_THREAD_ENUM /*{*/
141 #undef WANT_MACH_THREAD_ENUM
142  enum { // thread flavor
143  PPC_THREAD_STATE = 1,
144  PPC_THREAD_STATE64 = 5,
145  x86_THREAD_STATE32 = 1,
146  x86_THREAD_STATE64 = 4,
147  i386_OLD_THREAD_STATE = -1,
148  ARM_THREAD_STATE = 1
149  };
150 #endif /*}*/
151 
152 /* vim:set ts=4 sw=4 et: */