Changeset 3567 for trunk/kStuff/kLdr/kLdrModMachO.h
- Timestamp:
- Aug 27, 2007, 9:54:05 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kStuff/kLdr/kLdrModMachO.h
r3537 r3567 16 16 #ifndef IMAGE_FAT_SIGNATURE 17 17 /** The FAT signature (universal binaries). */ 18 # define IMAGE_FAT_SIGNATURE UINT32_C(0xcafebabe)18 # define IMAGE_FAT_SIGNATURE KU32_C(0xcafebabe) 19 19 #endif 20 20 #ifndef IMAGE_FAT_SIGNATURE_OE 21 21 /** The FAT signature (universal binaries), other endian. */ 22 # define IMAGE_FAT_SIGNATURE_OE UINT32_C(0xbebafeca)22 # define IMAGE_FAT_SIGNATURE_OE KU32_C(0xbebafeca) 23 23 #endif 24 24 … … 29 29 typedef struct fat_header 30 30 { 31 uint32_tmagic;32 uint32_tnfat_arch;31 KU32 magic; 32 KU32 nfat_arch; 33 33 } fat_header_t; 34 34 … … 38 38 typedef struct fat_arch 39 39 { 40 int32_tcputype;41 int32_tcpusubtype;42 uint32_toffset;43 uint32_tsize;44 uint32_talign; /**< Power of 2. */40 KI32 cputype; 41 KI32 cpusubtype; 42 KU32 offset; 43 KU32 size; 44 KU32 align; /**< Power of 2. */ 45 45 } fat_arch_t; 46 46 … … 49 49 #ifndef IMAGE_MACHO32_SIGNATURE 50 50 /** The 32-bit Mach-O signature. */ 51 # define IMAGE_MACHO32_SIGNATURE UINT32_C(0xfeedface)51 # define IMAGE_MACHO32_SIGNATURE KU32_C(0xfeedface) 52 52 #endif 53 53 #ifndef IMAGE_MACHO32_SIGNATURE_OE 54 54 /** The 32-bit Mach-O signature, other endian. */ 55 # define IMAGE_MACHO32_SIGNATURE_OE UINT32_C(0xcefaedfe)55 # define IMAGE_MACHO32_SIGNATURE_OE KU32_C(0xcefaedfe) 56 56 #endif 57 57 #define MH_MAGIC IMAGE_MACHO32_SIGNATURE … … 65 65 typedef struct mach_header_32 66 66 { 67 uint32_tmagic;68 int32_tcputype;69 int32_tcpusubtype;70 uint32_tfiletype;71 uint32_tncmds;72 uint32_tsizeofcmds;73 uint32_tflags;67 KU32 magic; 68 KI32 cputype; 69 KI32 cpusubtype; 70 KU32 filetype; 71 KU32 ncmds; 72 KU32 sizeofcmds; 73 KU32 flags; 74 74 } mach_header_32_t; 75 75 … … 78 78 #ifndef IMAGE_MACHO64_SIGNATURE 79 79 /** The 64-bit Mach-O signature. */ 80 # define IMAGE_MACHO64_SIGNATURE UINT32_C(0xfeedfacf)80 # define IMAGE_MACHO64_SIGNATURE KU32_C(0xfeedfacf) 81 81 #endif 82 82 #ifndef IMAGE_MACHO64_SIGNATURE_OE 83 83 /** The 64-bit Mach-O signature, other endian. */ 84 # define IMAGE_MACHO64_SIGNATURE_OE UINT32_C(0xfefaedfe)84 # define IMAGE_MACHO64_SIGNATURE_OE KU32_C(0xfefaedfe) 85 85 #endif 86 86 #define MH_MAGIC_64 IMAGE_MACHO64_SIGNATURE … … 94 94 typedef struct mach_header_64 95 95 { 96 uint32_tmagic;97 int32_tcputype;98 int32_tcpusubtype;99 uint32_tfiletype;100 uint32_tncmds;101 uint32_tsizeofcmds;102 uint32_tflags;103 uint32_treserved; /**< (for proper struct and command alignment I guess) */96 KU32 magic; 97 KI32 cputype; 98 KI32 cpusubtype; 99 KU32 filetype; 100 KU32 ncmds; 101 KU32 sizeofcmds; 102 KU32 flags; 103 KU32 reserved; /**< (for proper struct and command alignment I guess) */ 104 104 } mach_header_64_t; 105 105 … … 108 108 * @{ 109 109 */ 110 #define MH_OBJECT UINT32_C(1) /**< Object (relocatable). */111 #define MH_EXECUTE UINT32_C(2) /**< Executable (demand paged). */112 #define MH_FVMLIB UINT32_C(3) /**< Fixed VM shared library. */113 #define MH_CORE UINT32_C(4) /**< Core file. */114 #define MH_PRELOAD UINT32_C(5) /**< Preloaded executable. */115 #define MH_DYLIB UINT32_C(6) /**< Dynamically bound shared library. */116 #define MH_DYLINKER UINT32_C(7) /**< Dynamic linker. */117 #define MH_BUNDLE UINT32_C(8) /**< Dymamically bound bundle. */118 #define MH_DYLIB_STUB UINT32_C(9) /**< Shared library stub for static linking. */119 #define MH_DSYM UINT32_C(10)/**< Debug symbols. */110 #define MH_OBJECT KU32_C(1) /**< Object (relocatable). */ 111 #define MH_EXECUTE KU32_C(2) /**< Executable (demand paged). */ 112 #define MH_FVMLIB KU32_C(3) /**< Fixed VM shared library. */ 113 #define MH_CORE KU32_C(4) /**< Core file. */ 114 #define MH_PRELOAD KU32_C(5) /**< Preloaded executable. */ 115 #define MH_DYLIB KU32_C(6) /**< Dynamically bound shared library. */ 116 #define MH_DYLINKER KU32_C(7) /**< Dynamic linker. */ 117 #define MH_BUNDLE KU32_C(8) /**< Dymamically bound bundle. */ 118 #define MH_DYLIB_STUB KU32_C(9) /**< Shared library stub for static linking. */ 119 #define MH_DSYM KU32_C(10)/**< Debug symbols. */ 120 120 121 121 /** @} */ … … 125 125 * @{ 126 126 */ 127 #define MH_NOUNDEFS UINT32_C(0x00000001) /**< No undefined symbols. */128 #define MH_INCRLINK UINT32_C(0x00000002) /**< Partial increment link output. */129 #define MH_DYLDLINK UINT32_C(0x00000004) /**< Food for the dynamic linker, not for ld. */130 #define MH_BINDATLOAD UINT32_C(0x00000008) /**< Bind all undefined symbols at load time. */131 #define MH_PREBOUND UINT32_C(0x00000010) /**< Contains prebound undefined symbols. */132 #define MH_SPLIT_SEGS UINT32_C(0x00000020) /**< Read-only and read-write segments are split. */133 #define MH_LAZY_INIT UINT32_C(0x00000040) /**< Obsolete flag for doing lazy init when data is written. */134 #define MH_TWOLEVEL UINT32_C(0x00000080) /**< Uses two-level name space bindings. */135 #define MH_FORCE_FLAT UINT32_C(0x00000100) /**< Task: The executable forces all images to use flat name space bindings. */136 #define MH_NOMULTIDEFS UINT32_C(0x00000200) /**< No multiple symbol definitions, safe to use two-level namespace hints. */137 #define MH_NOFIXPREBINDING UINT32_C(0x00000400) /**< The dynamic linker should not notify the prebinding agent about this executable. */138 #define MH_PREBINDABLE UINT32_C(0x00000800) /**< Not prebound, but it can be. Invalid if MH_PREBOUND is set. */139 #define MH_ALLMODSBOUND UINT32_C(0x00001000) /**< Binds to all two-level namespace modules of preqs. Requires MH_PREBINDABLE and MH_TWOLEVEL to be set. */140 #define MH_SUBSECTIONS_VIA_SYMBOLS UINT32_C(0x00002000) /**< Safe to divide sections into sub-sections via symbols for dead code stripping. */141 #define MH_CANONICAL UINT32_C(0x00004000) /**< Canonicalized via unprebind. */142 #define MH_WEAK_DEFINES UINT32_C(0x00008000) /**< The (finally) linked image has weak symbols. */143 #define MH_BINDS_TO_WEAK UINT32_C(0x00010000) /**< The (finally) linked image uses weak symbols. */144 #define MH_ALLOW_STACK_EXECUTION UINT32_C(0x00020000) /**< Task: allow stack execution. (MH_EXECUTE only) */145 #define MH_VALID_FLAGS UINT32_C(0x0003ffff) /**< Mask containing the defined flags. */127 #define MH_NOUNDEFS KU32_C(0x00000001) /**< No undefined symbols. */ 128 #define MH_INCRLINK KU32_C(0x00000002) /**< Partial increment link output. */ 129 #define MH_DYLDLINK KU32_C(0x00000004) /**< Food for the dynamic linker, not for ld. */ 130 #define MH_BINDATLOAD KU32_C(0x00000008) /**< Bind all undefined symbols at load time. */ 131 #define MH_PREBOUND KU32_C(0x00000010) /**< Contains prebound undefined symbols. */ 132 #define MH_SPLIT_SEGS KU32_C(0x00000020) /**< Read-only and read-write segments are split. */ 133 #define MH_LAZY_INIT KU32_C(0x00000040) /**< Obsolete flag for doing lazy init when data is written. */ 134 #define MH_TWOLEVEL KU32_C(0x00000080) /**< Uses two-level name space bindings. */ 135 #define MH_FORCE_FLAT KU32_C(0x00000100) /**< Task: The executable forces all images to use flat name space bindings. */ 136 #define MH_NOMULTIDEFS KU32_C(0x00000200) /**< No multiple symbol definitions, safe to use two-level namespace hints. */ 137 #define MH_NOFIXPREBINDING KU32_C(0x00000400) /**< The dynamic linker should not notify the prebinding agent about this executable. */ 138 #define MH_PREBINDABLE KU32_C(0x00000800) /**< Not prebound, but it can be. Invalid if MH_PREBOUND is set. */ 139 #define MH_ALLMODSBOUND KU32_C(0x00001000) /**< Binds to all two-level namespace modules of preqs. Requires MH_PREBINDABLE and MH_TWOLEVEL to be set. */ 140 #define MH_SUBSECTIONS_VIA_SYMBOLS KU32_C(0x00002000) /**< Safe to divide sections into sub-sections via symbols for dead code stripping. */ 141 #define MH_CANONICAL KU32_C(0x00004000) /**< Canonicalized via unprebind. */ 142 #define MH_WEAK_DEFINES KU32_C(0x00008000) /**< The (finally) linked image has weak symbols. */ 143 #define MH_BINDS_TO_WEAK KU32_C(0x00010000) /**< The (finally) linked image uses weak symbols. */ 144 #define MH_ALLOW_STACK_EXECUTION KU32_C(0x00020000) /**< Task: allow stack execution. (MH_EXECUTE only) */ 145 #define MH_VALID_FLAGS KU32_C(0x0003ffff) /**< Mask containing the defined flags. */ 146 146 /** @} */ 147 147 … … 150 150 * @{ 151 151 */ 152 #define CPU_ARCH_MASK INT32_C(0xff000000)153 #define CPU_ARCH_ABI64 INT32_C(0x01000000)154 #define CPU_TYPE_ANY INT32_C(-1)155 #define CPU_TYPE_VAX INT32_C(1)156 #define CPU_TYPE_MC680x0 INT32_C(6)157 #define CPU_TYPE_X86 INT32_C(7)152 #define CPU_ARCH_MASK KI32_C(0xff000000) 153 #define CPU_ARCH_ABI64 KI32_C(0x01000000) 154 #define CPU_TYPE_ANY KI32_C(-1) 155 #define CPU_TYPE_VAX KI32_C(1) 156 #define CPU_TYPE_MC680x0 KI32_C(6) 157 #define CPU_TYPE_X86 KI32_C(7) 158 158 #define CPU_TYPE_I386 CPU_TYPE_X86 159 159 #define CPU_TYPE_X86_64 (CPU_TYPE_X86 | CPU_ARCH_ABI64) 160 #define CPU_TYPE_MC98000 INT32_C(10)161 #define CPU_TYPE_HPPA INT32_C(11)162 #define CPU_TYPE_MC88000 INT32_C(13)163 #define CPU_TYPE_SPARC INT32_C(14)164 #define CPU_TYPE_I860 INT32_C(15)165 #define CPU_TYPE_POWERPC INT32_C(18)160 #define CPU_TYPE_MC98000 KI32_C(10) 161 #define CPU_TYPE_HPPA KI32_C(11) 162 #define CPU_TYPE_MC88000 KI32_C(13) 163 #define CPU_TYPE_SPARC KI32_C(14) 164 #define CPU_TYPE_I860 KI32_C(15) 165 #define CPU_TYPE_POWERPC KI32_C(18) 166 166 #define CPU_TYPE_POWERPC64 (CPU_TYPE_POWERPC | CPU_ARCH_ABI64) 167 167 /** @} */ … … 170 170 /** @name CPU subtypes (mach_header_64::cpusubtype, mach_header_32::cpusubtype, fat_arch::cpusubtype) 171 171 * @{ */ 172 #define CPU_SUBTYPE_MULTIPLE INT32_C(-1)173 #define CPU_SUBTYPE_LITTLE_ENDIAN INT32_C(0) /**< figure this one out. */174 #define CPU_SUBTYPE_BIG_ENDIAN INT32_C(1) /**< ditto */172 #define CPU_SUBTYPE_MULTIPLE KI32_C(-1) 173 #define CPU_SUBTYPE_LITTLE_ENDIAN KI32_C(0) /**< figure this one out. */ 174 #define CPU_SUBTYPE_BIG_ENDIAN KI32_C(1) /**< ditto */ 175 175 176 176 /* VAX */ 177 #define CPU_SUBTYPE_VAX_ALL INT32_C(0)178 #define CPU_SUBTYPE_VAX780 INT32_C(1)179 #define CPU_SUBTYPE_VAX785 INT32_C(2)180 #define CPU_SUBTYPE_VAX750 INT32_C(3)181 #define CPU_SUBTYPE_VAX730 INT32_C(4)182 #define CPU_SUBTYPE_UVAXI INT32_C(5)183 #define CPU_SUBTYPE_UVAXII INT32_C(6)184 #define CPU_SUBTYPE_VAX8200 INT32_C(7)185 #define CPU_SUBTYPE_VAX8500 INT32_C(8)186 #define CPU_SUBTYPE_VAX8600 INT32_C(9)187 #define CPU_SUBTYPE_VAX8650 INT32_C(10)188 #define CPU_SUBTYPE_VAX8800 INT32_C(11)189 #define CPU_SUBTYPE_UVAXIII INT32_C(12)177 #define CPU_SUBTYPE_VAX_ALL KI32_C(0) 178 #define CPU_SUBTYPE_VAX780 KI32_C(1) 179 #define CPU_SUBTYPE_VAX785 KI32_C(2) 180 #define CPU_SUBTYPE_VAX750 KI32_C(3) 181 #define CPU_SUBTYPE_VAX730 KI32_C(4) 182 #define CPU_SUBTYPE_UVAXI KI32_C(5) 183 #define CPU_SUBTYPE_UVAXII KI32_C(6) 184 #define CPU_SUBTYPE_VAX8200 KI32_C(7) 185 #define CPU_SUBTYPE_VAX8500 KI32_C(8) 186 #define CPU_SUBTYPE_VAX8600 KI32_C(9) 187 #define CPU_SUBTYPE_VAX8650 KI32_C(10) 188 #define CPU_SUBTYPE_VAX8800 KI32_C(11) 189 #define CPU_SUBTYPE_UVAXIII KI32_C(12) 190 190 191 191 /* MC680xx */ 192 #define CPU_SUBTYPE_MC680x0_ALL INT32_C(1)193 #define CPU_SUBTYPE_MC68030 INT32_C(1)194 #define CPU_SUBTYPE_MC68040 INT32_C(2)195 #define CPU_SUBTYPE_MC68030_ONLY INT32_C(3)192 #define CPU_SUBTYPE_MC680x0_ALL KI32_C(1) 193 #define CPU_SUBTYPE_MC68030 KI32_C(1) 194 #define CPU_SUBTYPE_MC68040 KI32_C(2) 195 #define CPU_SUBTYPE_MC68030_ONLY KI32_C(3) 196 196 197 197 /* I386 */ 198 #define CPU_SUBTYPE_INTEL(fam, model) ( ( int32_t)(((model) << 4) | (fam)) )198 #define CPU_SUBTYPE_INTEL(fam, model) ( (KI32)(((model) << 4) | (fam)) ) 199 199 #define CPU_SUBTYPE_INTEL_FAMILY(subtype) ( (subtype) & 0xf ) 200 200 #define CPU_SUBTYPE_INTEL_MODEL(subtype) ( (subtype) >> 4 ) … … 225 225 226 226 /* X86 */ 227 #define CPU_SUBTYPE_X86_ALL INT32_C(3) /* CPU_SUBTYPE_I386_ALL */228 #define CPU_SUBTYPE_X86_64_ALL INT32_C(3) /* CPU_SUBTYPE_I386_ALL */229 #define CPU_SUBTYPE_X86_ARCH1 INT32_C(4) /* CPU_SUBTYPE_I486_ALL */227 #define CPU_SUBTYPE_X86_ALL KI32_C(3) /* CPU_SUBTYPE_I386_ALL */ 228 #define CPU_SUBTYPE_X86_64_ALL KI32_C(3) /* CPU_SUBTYPE_I386_ALL */ 229 #define CPU_SUBTYPE_X86_ARCH1 KI32_C(4) /* CPU_SUBTYPE_I486_ALL */ 230 230 231 231 /* MIPS */ 232 #define CPU_SUBTYPE_MIPS_ALL INT32_C(0)233 #define CPU_SUBTYPE_MIPS_R2300 INT32_C(1)234 #define CPU_SUBTYPE_MIPS_R2600 INT32_C(2)235 #define CPU_SUBTYPE_MIPS_R2800 INT32_C(3)236 #define CPU_SUBTYPE_MIPS_R2000a INT32_C(4)237 #define CPU_SUBTYPE_MIPS_R2000 INT32_C(5)238 #define CPU_SUBTYPE_MIPS_R3000a INT32_C(6)239 #define CPU_SUBTYPE_MIPS_R3000 INT32_C(7)232 #define CPU_SUBTYPE_MIPS_ALL KI32_C(0) 233 #define CPU_SUBTYPE_MIPS_R2300 KI32_C(1) 234 #define CPU_SUBTYPE_MIPS_R2600 KI32_C(2) 235 #define CPU_SUBTYPE_MIPS_R2800 KI32_C(3) 236 #define CPU_SUBTYPE_MIPS_R2000a KI32_C(4) 237 #define CPU_SUBTYPE_MIPS_R2000 KI32_C(5) 238 #define CPU_SUBTYPE_MIPS_R3000a KI32_C(6) 239 #define CPU_SUBTYPE_MIPS_R3000 KI32_C(7) 240 240 241 241 /* MC98000 (PowerPC) */ 242 #define CPU_SUBTYPE_MC98000_ALL INT32_C(0)243 #define CPU_SUBTYPE_MC98601 INT32_C(1)242 #define CPU_SUBTYPE_MC98000_ALL KI32_C(0) 243 #define CPU_SUBTYPE_MC98601 KI32_C(1) 244 244 245 245 /* HP-PA */ 246 #define CPU_SUBTYPE_HPPA_ALL INT32_C(0)247 #define CPU_SUBTYPE_HPPA_7100 INT32_C(0)248 #define CPU_SUBTYPE_HPPA_7100LC INT32_C(1)246 #define CPU_SUBTYPE_HPPA_ALL KI32_C(0) 247 #define CPU_SUBTYPE_HPPA_7100 KI32_C(0) 248 #define CPU_SUBTYPE_HPPA_7100LC KI32_C(1) 249 249 250 250 /* MC88000 */ 251 #define CPU_SUBTYPE_MC88000_ALL INT32_C(0)252 #define CPU_SUBTYPE_MC88100 INT32_C(1)253 #define CPU_SUBTYPE_MC88110 INT32_C(2)251 #define CPU_SUBTYPE_MC88000_ALL KI32_C(0) 252 #define CPU_SUBTYPE_MC88100 KI32_C(1) 253 #define CPU_SUBTYPE_MC88110 KI32_C(2) 254 254 255 255 /* SPARC */ 256 #define CPU_SUBTYPE_SPARC_ALL INT32_C(0)256 #define CPU_SUBTYPE_SPARC_ALL KI32_C(0) 257 257 258 258 /* I860 */ 259 #define CPU_SUBTYPE_I860_ALL INT32_C(0)260 #define CPU_SUBTYPE_I860_860 INT32_C(1)259 #define CPU_SUBTYPE_I860_ALL KI32_C(0) 260 #define CPU_SUBTYPE_I860_860 KI32_C(1) 261 261 262 262 /* PowerPC */ 263 #define CPU_SUBTYPE_POWERPC_ALL INT32_C(0)264 #define CPU_SUBTYPE_POWERPC_601 INT32_C(1)265 #define CPU_SUBTYPE_POWERPC_602 INT32_C(2)266 #define CPU_SUBTYPE_POWERPC_603 INT32_C(3)267 #define CPU_SUBTYPE_POWERPC_603e INT32_C(4)268 #define CPU_SUBTYPE_POWERPC_603ev INT32_C(5)269 #define CPU_SUBTYPE_POWERPC_604 INT32_C(6)270 #define CPU_SUBTYPE_POWERPC_604e INT32_C(7)271 #define CPU_SUBTYPE_POWERPC_620 INT32_C(8)272 #define CPU_SUBTYPE_POWERPC_750 INT32_C(9)273 #define CPU_SUBTYPE_POWERPC_7400 INT32_C(10)274 #define CPU_SUBTYPE_POWERPC_7450 INT32_C(11)275 #define CPU_SUBTYPE_POWERPC_Max INT32_C(10)276 #define CPU_SUBTYPE_POWERPC_SCVger INT32_C(11)277 #define CPU_SUBTYPE_POWERPC_970 INT32_C(100)263 #define CPU_SUBTYPE_POWERPC_ALL KI32_C(0) 264 #define CPU_SUBTYPE_POWERPC_601 KI32_C(1) 265 #define CPU_SUBTYPE_POWERPC_602 KI32_C(2) 266 #define CPU_SUBTYPE_POWERPC_603 KI32_C(3) 267 #define CPU_SUBTYPE_POWERPC_603e KI32_C(4) 268 #define CPU_SUBTYPE_POWERPC_603ev KI32_C(5) 269 #define CPU_SUBTYPE_POWERPC_604 KI32_C(6) 270 #define CPU_SUBTYPE_POWERPC_604e KI32_C(7) 271 #define CPU_SUBTYPE_POWERPC_620 KI32_C(8) 272 #define CPU_SUBTYPE_POWERPC_750 KI32_C(9) 273 #define CPU_SUBTYPE_POWERPC_7400 KI32_C(10) 274 #define CPU_SUBTYPE_POWERPC_7450 KI32_C(11) 275 #define CPU_SUBTYPE_POWERPC_Max KI32_C(10) 276 #define CPU_SUBTYPE_POWERPC_SCVger KI32_C(11) 277 #define CPU_SUBTYPE_POWERPC_970 KI32_C(100) 278 278 279 279 /** @} */ … … 292 292 typedef struct load_command 293 293 { 294 uint32_tcmd; /**< The load command id. */295 uint32_tcmdsize; /**< The size of the command (including this header). */294 KU32 cmd; /**< The load command id. */ 295 KU32 cmdsize; /**< The size of the command (including this header). */ 296 296 } load_command_t; 297 297 … … 302 302 * grok the command. The dynamic linker will otherwise ignore commands it 303 303 * doesn't understand. Introduced with Mac OS X 10.1. */ 304 #define LC_REQ_DYLD UINT32_C(0x80000000)305 306 #define LC_SEGMENT_32 UINT32_C(0x01) /**< Segment to be mapped (32-bit). See segment_command_32. */307 #define LC_SYMTAB UINT32_C(0x02) /**< 'stab' symbol table. See symtab_command. */308 #define LC_SYMSEG UINT32_C(0x03) /**< Obsoleted gdb symbol table. */309 #define LC_THREAD UINT32_C(0x04) /**< Thread. See thread_command. */310 #define LC_UNIXTHREAD UINT32_C(0x05) /**< Unix thread (includes stack and stuff). See thread_command. */311 #define LC_LOADFVMLIB UINT32_C(0x06) /**< Load a specified fixed VM shared library (obsolete?). See fvmlib_command. */312 #define LC_IDFVMLIB UINT32_C(0x07) /**< Fixed VM shared library id (obsolete?). See fvmlib_command. */313 #define LC_IDENT UINT32_C(0x08) /**< Identification info (obsolete). See ident_command. */314 #define LC_FVMFILE UINT32_C(0x09) /**< Fixed VM file inclusion (internal). See fvmfile_command. */315 #define LC_PREPAGE UINT32_C(0x0a) /**< Prepage command (internal). See ?? */316 #define LC_DYSYMTAB UINT32_C(0x0b) /**< Symbol table for dynamic linking. See dysymtab_command. */317 #define LC_LOAD_DYLIB UINT32_C(0x0c) /**< Load a dynamically linked shared library. See dylib_command. */318 #define LC_ID_DYLIB UINT32_C(0x0d) /**< Dynamically linked share library ident. See dylib_command. */319 #define LC_LOAD_DYLINKER UINT32_C(0x0e) /**< Load a dynamical link editor. See dylinker_command. */320 #define LC_ID_DYLINKER UINT32_C(0x0f) /**< Dynamic link editor ident. See dylinker_command. */321 #define LC_PREBOUND_DYLIB UINT32_C(0x10) /**< Prebound modules for dynamically linking of a shared lib. See prebound_dylib_command. */322 #define LC_ROUTINES UINT32_C(0x11) /**< Image routines. See routines_command_32. */323 #define LC_SUB_FRAMEWORK UINT32_C(0x12) /**< Sub framework. See sub_framework_command. */324 #define LC_SUB_UMBRELLA UINT32_C(0x13) /**< Sub umbrella. See sub_umbrella_command. */325 #define LC_SUB_CLIENT UINT32_C(0x14) /**< Sub client. See sub_client_command. */326 #define LC_SUB_LIBRARY UINT32_C(0x15) /**< Sub library. See sub_library_command. */327 #define LC_TWOLEVEL_HINTS UINT32_C(0x16) /**< Two-level namespace lookup hints. See twolevel_hints_command. */328 #define LC_PREBIND_CKSUM UINT32_C(0x17) /**< Prebind checksum. See prebind_cksum_command. */329 #define LC_LOAD_WEAK_DYLIB ( UINT32_C(0x18) | LC_REQ_DYLD) /**< Dylib that can be missing, all symbols weak. See dylib_command. */330 #define LC_SEGMENT_64 UINT32_C(0x19) /**< segment to be mapped (64-bit). See segment_command_32. */331 #define LC_ROUTINES_64 UINT32_C(0x1a) /**< Image routines (64-bit). See routines_command_32. */332 #define LC_UUID UINT32_C(0x1b) /**< The UUID of the object module. See uuid_command. */304 #define LC_REQ_DYLD KU32_C(0x80000000) 305 306 #define LC_SEGMENT_32 KU32_C(0x01) /**< Segment to be mapped (32-bit). See segment_command_32. */ 307 #define LC_SYMTAB KU32_C(0x02) /**< 'stab' symbol table. See symtab_command. */ 308 #define LC_SYMSEG KU32_C(0x03) /**< Obsoleted gdb symbol table. */ 309 #define LC_THREAD KU32_C(0x04) /**< Thread. See thread_command. */ 310 #define LC_UNIXTHREAD KU32_C(0x05) /**< Unix thread (includes stack and stuff). See thread_command. */ 311 #define LC_LOADFVMLIB KU32_C(0x06) /**< Load a specified fixed VM shared library (obsolete?). See fvmlib_command. */ 312 #define LC_IDFVMLIB KU32_C(0x07) /**< Fixed VM shared library id (obsolete?). See fvmlib_command. */ 313 #define LC_IDENT KU32_C(0x08) /**< Identification info (obsolete). See ident_command. */ 314 #define LC_FVMFILE KU32_C(0x09) /**< Fixed VM file inclusion (internal). See fvmfile_command. */ 315 #define LC_PREPAGE KU32_C(0x0a) /**< Prepage command (internal). See ?? */ 316 #define LC_DYSYMTAB KU32_C(0x0b) /**< Symbol table for dynamic linking. See dysymtab_command. */ 317 #define LC_LOAD_DYLIB KU32_C(0x0c) /**< Load a dynamically linked shared library. See dylib_command. */ 318 #define LC_ID_DYLIB KU32_C(0x0d) /**< Dynamically linked share library ident. See dylib_command. */ 319 #define LC_LOAD_DYLINKER KU32_C(0x0e) /**< Load a dynamical link editor. See dylinker_command. */ 320 #define LC_ID_DYLINKER KU32_C(0x0f) /**< Dynamic link editor ident. See dylinker_command. */ 321 #define LC_PREBOUND_DYLIB KU32_C(0x10) /**< Prebound modules for dynamically linking of a shared lib. See prebound_dylib_command. */ 322 #define LC_ROUTINES KU32_C(0x11) /**< Image routines. See routines_command_32. */ 323 #define LC_SUB_FRAMEWORK KU32_C(0x12) /**< Sub framework. See sub_framework_command. */ 324 #define LC_SUB_UMBRELLA KU32_C(0x13) /**< Sub umbrella. See sub_umbrella_command. */ 325 #define LC_SUB_CLIENT KU32_C(0x14) /**< Sub client. See sub_client_command. */ 326 #define LC_SUB_LIBRARY KU32_C(0x15) /**< Sub library. See sub_library_command. */ 327 #define LC_TWOLEVEL_HINTS KU32_C(0x16) /**< Two-level namespace lookup hints. See twolevel_hints_command. */ 328 #define LC_PREBIND_CKSUM KU32_C(0x17) /**< Prebind checksum. See prebind_cksum_command. */ 329 #define LC_LOAD_WEAK_DYLIB (KU32_C(0x18) | LC_REQ_DYLD) /**< Dylib that can be missing, all symbols weak. See dylib_command. */ 330 #define LC_SEGMENT_64 KU32_C(0x19) /**< segment to be mapped (64-bit). See segment_command_32. */ 331 #define LC_ROUTINES_64 KU32_C(0x1a) /**< Image routines (64-bit). See routines_command_32. */ 332 #define LC_UUID KU32_C(0x1b) /**< The UUID of the object module. See uuid_command. */ 333 333 /** @} */ 334 334 … … 342 342 * The string is zero-terminated. the size of the load command 343 343 * is zero padded up to a multiple of 4 bytes. */ 344 uint32_toffset;344 KU32 offset; 345 345 } lc_str_t; 346 346 … … 351 351 typedef struct segment_command_32 352 352 { 353 uint32_tcmd; /**< LC_SEGMENT */354 uint32_tcmdsize; /**< sizeof(self) + sections. */353 KU32 cmd; /**< LC_SEGMENT */ 354 KU32 cmdsize; /**< sizeof(self) + sections. */ 355 355 char segname[16]; /**< The segment name. */ 356 uint32_tvmaddr; /**< Memory address of this segment. */357 uint32_tvmsize; /**< Size of this segment. */358 uint32_tfileoff; /**< The file location of the segment. */359 uint32_tfilesize; /**< The file size of the segment. */360 uint32_tmaxprot; /**< Maximum VM protection. */361 uint32_tinitprot; /**< Initial VM protection. */362 uint32_tnsects; /**< Number of section desciptors following this structure. */363 uint32_tflags; /**< Flags (SG_*). */356 KU32 vmaddr; /**< Memory address of this segment. */ 357 KU32 vmsize; /**< Size of this segment. */ 358 KU32 fileoff; /**< The file location of the segment. */ 359 KU32 filesize; /**< The file size of the segment. */ 360 KU32 maxprot; /**< Maximum VM protection. */ 361 KU32 initprot; /**< Initial VM protection. */ 362 KU32 nsects; /**< Number of section desciptors following this structure. */ 363 KU32 flags; /**< Flags (SG_*). */ 364 364 } segment_command_32_t; 365 365 … … 371 371 typedef struct segment_command_64 372 372 { 373 uint32_tcmd; /**< LC_SEGMENT */374 uint32_tcmdsize; /**< sizeof(self) + sections. */373 KU32 cmd; /**< LC_SEGMENT */ 374 KU32 cmdsize; /**< sizeof(self) + sections. */ 375 375 char segname[16]; /**< The segment name. */ 376 uint64_tvmaddr; /**< Memory address of this segment. */377 uint64_tvmsize; /**< Size of this segment. */378 uint64_tfileoff; /**< The file location of the segment. */379 uint64_tfilesize; /**< The file size of the segment. */380 uint32_tmaxprot; /**< Maximum VM protection. */381 uint32_tinitprot; /**< Initial VM protection. */382 uint32_tnsects; /**< Number of section desciptors following this structure. */383 uint32_tflags; /**< Flags (SG_*). */376 KU64 vmaddr; /**< Memory address of this segment. */ 377 KU64 vmsize; /**< Size of this segment. */ 378 KU64 fileoff; /**< The file location of the segment. */ 379 KU64 filesize; /**< The file size of the segment. */ 380 KU32 maxprot; /**< Maximum VM protection. */ 381 KU32 initprot; /**< Initial VM protection. */ 382 KU32 nsects; /**< Number of section desciptors following this structure. */ 383 KU32 flags; /**< Flags (SG_*). */ 384 384 } segment_command_64_t; 385 385 … … 389 389 * instead of the low end. Intended for stacks in core dumps. 390 390 * The part of the segment memory not covered by file bits will be zeroed. */ 391 #define SG_HIGHVM UINT32_C(0x00000001)391 #define SG_HIGHVM KU32_C(0x00000001) 392 392 /** This segment is the virtual memory allocated by a fixed VM library. 393 393 * (Used for overlap checking in the linker.) */ 394 #define SG_FVMLIB UINT32_C(0x00000002)394 #define SG_FVMLIB KU32_C(0x00000002) 395 395 /** No relocations for or symbols that's relocated to in this segment. 396 396 * The segment can therefore safely be replaced. */ 397 #define SG_NORELOC UINT32_C(0x00000004)397 #define SG_NORELOC KU32_C(0x00000004) 398 398 /** The segment is protected. 399 399 * The first page isn't protected if it starts at file offset 0 400 400 * (so that the mach header and this load command can be easily mapped). */ 401 #define SG_PROTECTED_VERSION_1 UINT32_C(0x00000008)401 #define SG_PROTECTED_VERSION_1 KU32_C(0x00000008) 402 402 /** @} */ 403 403 … … 410 410 char sectname[16]; /**< The section name. */ 411 411 char segname[16]; /**< The name of the segment this section goes into. */ 412 uint32_taddr; /**< The memory address of this section. */413 uint32_tsize; /**< The size of this section. */414 uint32_toffset; /**< The file offset of this section. */415 uint32_talign; /**< The section alignment (**2). */416 uint32_treloff; /**< The file offset of the relocations. */417 uint32_tnreloc; /**< The number of relocations. */418 uint32_tflags; /**< The section flags; section type and attribs */419 uint32_treserved1; /**< Reserved / offset / index. */420 uint32_treserved2; /**< Reserved / count / sizeof. */412 KU32 addr; /**< The memory address of this section. */ 413 KU32 size; /**< The size of this section. */ 414 KU32 offset; /**< The file offset of this section. */ 415 KU32 align; /**< The section alignment (**2). */ 416 KU32 reloff; /**< The file offset of the relocations. */ 417 KU32 nreloc; /**< The number of relocations. */ 418 KU32 flags; /**< The section flags; section type and attribs */ 419 KU32 reserved1; /**< Reserved / offset / index. */ 420 KU32 reserved2; /**< Reserved / count / sizeof. */ 421 421 } section_32_t; 422 422 … … 428 428 char sectname[16]; /**< The section name. */ 429 429 char segname[16]; /**< The name of the segment this section goes into. */ 430 uint64_taddr; /**< The memory address of this section. */431 uint64_tsize; /**< The size of this section. */432 uint32_toffset; /**< The file offset of this section. */433 uint32_talign; /**< The section alignment (**2). */434 uint32_treloff; /**< The file offset of the relocations. */435 uint32_tnreloc; /**< The number of relocations. */436 uint32_tflags; /**< The section flags; section type and attribs */437 uint32_treserved1; /**< Reserved / offset / index. */438 uint32_treserved2; /**< Reserved / count / sizeof. */439 uint32_treserved3; /**< (Just) Reserved. */430 KU64 addr; /**< The memory address of this section. */ 431 KU64 size; /**< The size of this section. */ 432 KU32 offset; /**< The file offset of this section. */ 433 KU32 align; /**< The section alignment (**2). */ 434 KU32 reloff; /**< The file offset of the relocations. */ 435 KU32 nreloc; /**< The number of relocations. */ 436 KU32 flags; /**< The section flags; section type and attribs */ 437 KU32 reserved1; /**< Reserved / offset / index. */ 438 KU32 reserved2; /**< Reserved / count / sizeof. */ 439 KU32 reserved3; /**< (Just) Reserved. */ 440 440 } section_64_t; 441 441 … … 444 444 */ 445 445 /** Section type mask. */ 446 #define SECTION_TYPE UINT32_C(0x000000ff)446 #define SECTION_TYPE KU32_C(0x000000ff) 447 447 /** Regular section. */ 448 448 #define S_REGULAR 0x0 … … 480 480 481 481 /** Section attribute mask. */ 482 #define SECTION_ATTRIBUTES UINT32_C(0xffffff00)482 #define SECTION_ATTRIBUTES KU32_C(0xffffff00) 483 483 484 484 /** User settable attribute mask. */ 485 #define SECTION_ATTRIBUTES_USR UINT32_C(0xff000000)485 #define SECTION_ATTRIBUTES_USR KU32_C(0xff000000) 486 486 /** Pure instruction (code). */ 487 #define S_ATTR_PURE_INSTRUCTIONS UINT32_C(0x80000000)487 #define S_ATTR_PURE_INSTRUCTIONS KU32_C(0x80000000) 488 488 /** ranlib, ignore my symbols... */ 489 #define S_ATTR_NO_TOC UINT32_C(0x40000000)489 #define S_ATTR_NO_TOC KU32_C(0x40000000) 490 490 /** May strip static symbols when linking int a MH_DYLDLINK file. */ 491 #define S_ATTR_STRIP_STATIC_SYMS UINT32_C(0x20000000)491 #define S_ATTR_STRIP_STATIC_SYMS KU32_C(0x20000000) 492 492 /** No dead stripping. */ 493 #define S_ATTR_NO_DEAD_STRIP UINT32_C(0x10000000)493 #define S_ATTR_NO_DEAD_STRIP KU32_C(0x10000000) 494 494 /** Live support. */ 495 #define S_ATTR_LIVE_SUPPORT UINT32_C(0x08000000)495 #define S_ATTR_LIVE_SUPPORT KU32_C(0x08000000) 496 496 /** Contains self modifying code (generally i386 code stub for dyld). */ 497 #define S_ATTR_SELF_MODIFYING_CODE UINT32_C(0x04000000)497 #define S_ATTR_SELF_MODIFYING_CODE KU32_C(0x04000000) 498 498 /** Debug info (DWARF usually). */ 499 #define S_ATTR_DEBUG UINT32_C(0x02000000)499 #define S_ATTR_DEBUG KU32_C(0x02000000) 500 500 501 501 /** System settable attribute mask. */ 502 #define SECTION_ATTRIBUTES_SYS UINT32_C(0x00ffff00)502 #define SECTION_ATTRIBUTES_SYS KU32_C(0x00ffff00) 503 503 /** Contains some instructions (code). */ 504 #define S_ATTR_SOME_INSTRUCTIONS UINT32_C(0x00000400)504 #define S_ATTR_SOME_INSTRUCTIONS KU32_C(0x00000400) 505 505 /** Has external relocations. */ 506 #define S_ATTR_EXT_RELOC UINT32_C(0x00000200)506 #define S_ATTR_EXT_RELOC KU32_C(0x00000200) 507 507 /** Has internal (local) relocations. */ 508 #define S_ATTR_LOC_RELOC UINT32_C(0x00000100)508 #define S_ATTR_LOC_RELOC KU32_C(0x00000100) 509 509 /** @} */ 510 510 … … 577 577 * is made up of a number of state structures preceded by a 32-bit flavor 578 578 * and 32-bit count field stating the kind of stat structure and it's size 579 * in uint32_titems respecitvly.579 * in KU32 items respecitvly. 580 580 * 581 581 * LC_UNIXTHREAD differs from LC_THREAD in that it implies stack creation … … 585 585 typedef struct thread_command 586 586 { 587 uint32_tcmd; /**< LC_UNIXTHREAD or LC_THREAD. */588 uint32_tcmdsize; /**< The size of the command (including this header). */587 KU32 cmd; /**< LC_UNIXTHREAD or LC_THREAD. */ 588 KU32 cmdsize; /**< The size of the command (including this header). */ 589 589 } thread_command_t; 590 590 … … 600 600 typedef struct symtab_command 601 601 { 602 uint32_tcmd; /**< LC_SYMTAB */603 uint32_tcmdsize; /** sizeof(symtab_command_t) */604 uint32_tsymoff; /** The file offset of the symbol table. */605 uint32_tnsyms; /** The number of symbols in the symbol table. */606 uint32_tstroff; /** The file offset of the string table. */607 uint32_tstrsize; /** The size of the string table. */602 KU32 cmd; /**< LC_SYMTAB */ 603 KU32 cmdsize; /** sizeof(symtab_command_t) */ 604 KU32 symoff; /** The file offset of the symbol table. */ 605 KU32 nsyms; /** The number of symbols in the symbol table. */ 606 KU32 stroff; /** The file offset of the string table. */ 607 KU32 strsize; /** The size of the string table. */ 608 608 } symtab_command_t; 609 609 … … 624 624 typedef struct uuid_command 625 625 { 626 uint32_tcmd; /**< LC_UUID */627 uint32_tcmdsize; /**< sizeof(uuid_command_t) */628 uint8_tuuid[16]; /** The UUID bytes. */626 KU32 cmd; /**< LC_UUID */ 627 KU32 cmdsize; /**< sizeof(uuid_command_t) */ 628 KU8 uuid[16]; /** The UUID bytes. */ 629 629 } uuid_command_t; 630 630 … … 652 652 union 653 653 { 654 int32_tn_strx; /**< Offset (index) into the string table. 0 means "". */654 KI32 n_strx; /**< Offset (index) into the string table. 0 means "". */ 655 655 } n_un; 656 uint8_tn_type; /**< Symbol type. */657 uint8_tn_sect; /**< Section number of NO_SECT. */658 int16_tn_desc; /**< Type specific, debug info details mostly.*/659 uint32_tn_value; /**< The symbol value or stab offset. */656 KU8 n_type; /**< Symbol type. */ 657 KU8 n_sect; /**< Section number of NO_SECT. */ 658 KI16 n_desc; /**< Type specific, debug info details mostly.*/ 659 KU32 n_value; /**< The symbol value or stab offset. */ 660 660 } macho_nlist_32_t; 661 661 … … 669 669 union 670 670 { 671 uint32_t n_strx;/**< Offset (index) into the string table. 0 means "". */671 KU32 n_strx; /**< Offset (index) into the string table. 0 means "". */ 672 672 } n_un; 673 uint8_tn_type; /**< Symbol type. */674 uint8_tn_sect; /**< Section number of NO_SECT. */675 int16_tn_desc; /**< Type specific, debug info details mostly.*/676 uint64_tn_value; /**< The symbol value or stab offset. */673 KU8 n_type; /**< Symbol type. */ 674 KU8 n_sect; /**< Section number of NO_SECT. */ 675 KI16 n_desc; /**< Type specific, debug info details mostly.*/ 676 KU64 n_value; /**< The symbol value or stab offset. */ 677 677 } macho_nlist_64_t; 678 678 … … 709 709 710 710 /* Base masks. */ 711 #define MACHO_N_EXT UINT8_C(0x01) /**< External symbol (when set) (N_EXT). */712 #define MACHO_N_TYPE UINT8_C(0x0e) /**< Symbol type (N_TYPE without the 8th bit). */713 #define MACHO_N_PEXT UINT8_C(0x10) /**< Private extern symbol (when set). (M) */714 #define MACHO_N_STAB UINT8_C(0xe0) /**< Debug symbol mask (N_STAB). */711 #define MACHO_N_EXT KU8_C(0x01) /**< External symbol (when set) (N_EXT). */ 712 #define MACHO_N_TYPE KU8_C(0x0e) /**< Symbol type (N_TYPE without the 8th bit). */ 713 #define MACHO_N_PEXT KU8_C(0x10) /**< Private extern symbol (when set). (M) */ 714 #define MACHO_N_STAB KU8_C(0xe0) /**< Debug symbol mask (N_STAB). */ 715 715 716 716 /* MACHO_N_TYPE values. */ 717 #define MACHO_N_UNDF UINT8_C(0x00) /**< MACHO_N_TYPE: Undefined symbol (N_UNDF). n_sect = NO_SECT. */718 #define MACHO_N_ABS UINT8_C(0x02) /**< MACHO_N_TYPE: Absolute symbol (N_UNDF). n_sect = NO_SECT. */719 #define MACHO_N_INDR UINT8_C(0x0a) /**< MACHO_N_TYPE: Indirect symbol, n_value is the index of the symbol. (M) */720 #define MACHO_N_PBUD UINT8_C(0x0c) /**< MACHO_N_TYPE: Prebound undefined symbo (defined in a dylib). (M) */721 #define MACHO_N_SECT UINT8_C(0x0e) /**< MACHO_N_TYPE: Defined in the section given by n_sects. (M) */717 #define MACHO_N_UNDF KU8_C(0x00) /**< MACHO_N_TYPE: Undefined symbol (N_UNDF). n_sect = NO_SECT. */ 718 #define MACHO_N_ABS KU8_C(0x02) /**< MACHO_N_TYPE: Absolute symbol (N_UNDF). n_sect = NO_SECT. */ 719 #define MACHO_N_INDR KU8_C(0x0a) /**< MACHO_N_TYPE: Indirect symbol, n_value is the index of the symbol. (M) */ 720 #define MACHO_N_PBUD KU8_C(0x0c) /**< MACHO_N_TYPE: Prebound undefined symbo (defined in a dylib). (M) */ 721 #define MACHO_N_SECT KU8_C(0x0e) /**< MACHO_N_TYPE: Defined in the section given by n_sects. (M) */ 722 722 723 723 /* Debug symbols. */ 724 #define MACHO_N_GSYM UINT8_C(0x20) /**< Global variable. "name",, NO_SECT, type, 0 (2) */725 #define MACHO_N_FNAME UINT8_C(0x22) /**< Function name (F77). "name",, NO_SECT, 0, 0 */726 #define MACHO_N_FUN UINT8_C(0x24) /**< Function / text var. "name",, section, line, address (1) */727 #define MACHO_N_STSYM UINT8_C(0x26) /**< Static data symbol. "name",, section, type, address (2) */728 #define MACHO_N_LCSYM UINT8_C(0x28) /**< static bss symbol. "name",, section, type, address (2) */724 #define MACHO_N_GSYM KU8_C(0x20) /**< Global variable. "name",, NO_SECT, type, 0 (2) */ 725 #define MACHO_N_FNAME KU8_C(0x22) /**< Function name (F77). "name",, NO_SECT, 0, 0 */ 726 #define MACHO_N_FUN KU8_C(0x24) /**< Function / text var. "name",, section, line, address (1) */ 727 #define MACHO_N_STSYM KU8_C(0x26) /**< Static data symbol. "name",, section, type, address (2) */ 728 #define MACHO_N_LCSYM KU8_C(0x28) /**< static bss symbol. "name",, section, type, address (2) */ 729 729 /* omits N_MAIN and N_ROSYM. */ 730 #define MACHO_N_BNSYM UINT8_C(0x2e) /**< Begin nsect symbol. 0,, section, 0, address (M) */731 #define MACHO_N_PC UINT8_C(0x30) /**< Global pascal symbol. "name",, NO_SECT, subtype?, line (3) */730 #define MACHO_N_BNSYM KU8_C(0x2e) /**< Begin nsect symbol. 0,, section, 0, address (M) */ 731 #define MACHO_N_PC KU8_C(0x30) /**< Global pascal symbol. "name",, NO_SECT, subtype?, line (3) */ 732 732 /* omits N_NSYMS, N_NOMAP and N_OBJ. */ 733 #define MACHO_N_OPT UINT8_C(0x3c) /**< Options for the debugger related to the language of the733 #define MACHO_N_OPT KU8_C(0x3c) /**< Options for the debugger related to the language of the 734 734 source file. "options?",,,, */ 735 #define MACHO_N_RSYM UINT8_C(0x40) /**< Register variable. "name",, NO_SECT, type, register */735 #define MACHO_N_RSYM KU8_C(0x40) /**< Register variable. "name",, NO_SECT, type, register */ 736 736 /* omits N_M2C */ 737 #define MACHO_N_SLINE UINT8_C(0x44) /**< Source line. 0,, section, line, address */737 #define MACHO_N_SLINE KU8_C(0x44) /**< Source line. 0,, section, line, address */ 738 738 /* omits N_DSLINE, N_BSLINE / N_BROWS, N_DEFD and N_FLINE. */ 739 #define MACHO_N_ENSYM UINT8_C(0x4e) /**< End nsect symbol. 0,, section, 0, address (M) */739 #define MACHO_N_ENSYM KU8_C(0x4e) /**< End nsect symbol. 0,, section, 0, address (M) */ 740 740 /* omits N_EHDECL / N_MOD2 and N_CATCH. */ 741 #define MACHO_N_SSYM UINT8_C(0x60) /**< Struct/union element. "name",, NO_SECT, type, offset */741 #define MACHO_N_SSYM KU8_C(0x60) /**< Struct/union element. "name",, NO_SECT, type, offset */ 742 742 /* omits N_ENDM */ 743 #define MACHO_N_SO UINT8_C(0x64) /**< Source file name. "fname",, section, 0, address */744 #define MACHO_N_OSO UINT8_C(0x66) /**< Object file name. "fname",, 0, 0, st_mtime (M?) */743 #define MACHO_N_SO KU8_C(0x64) /**< Source file name. "fname",, section, 0, address */ 744 #define MACHO_N_OSO KU8_C(0x66) /**< Object file name. "fname",, 0, 0, st_mtime (M?) */ 745 745 /* omits N_ALIAS */ 746 #define MACHO_N_LSYM UINT8_C(0x80) /**< Stack variable. "name",, NO_SECT, type, frame_offset */747 #define MACHO_N_BINCL UINT8_C(0x82) /**< Begin #include. "fname",, NO_SECT, 0, sum? */748 #define MACHO_N_SOL UINT8_C(0x84) /**< #included file. "fname",, section, 0, start_address (S) */749 #define MACHO_N_PARAMS UINT8_C(0x86) /**< Compiler params. "params",, NO_SECT, 0, 0 */750 #define MACHO_N_VERSION UINT8_C(0x88) /**< Compiler version. "version",, NO_SECT, 0, 0 */751 #define MACHO_N_OLEVEL UINT8_C(0x8A) /**< Compiler -O level. "level",, NO_SECT, 0, 0 */752 #define MACHO_N_PSYM UINT8_C(0xa0) /**< Parameter variable. "name",, NO_SECT, type, frame_offset */753 #define MACHO_N_EINCL UINT8_C(0xa2) /**< End #include. "fname",, NO_SECT, 0, 0 (S) */754 #define MACHO_N_ENTRY UINT8_C(0xa4) /**< Alternate entry point. "name",, section, line, address */755 #define MACHO_N_LBRAC UINT8_C(0xc0) /**< Left bracket. 0,, NO_SECT, nesting_level, address */756 #define MACHO_N_EXCL UINT8_C(0xc2) /**< Deleted include file. "fname",, NO_SECT, 0, sum? (S) */746 #define MACHO_N_LSYM KU8_C(0x80) /**< Stack variable. "name",, NO_SECT, type, frame_offset */ 747 #define MACHO_N_BINCL KU8_C(0x82) /**< Begin #include. "fname",, NO_SECT, 0, sum? */ 748 #define MACHO_N_SOL KU8_C(0x84) /**< #included file. "fname",, section, 0, start_address (S) */ 749 #define MACHO_N_PARAMS KU8_C(0x86) /**< Compiler params. "params",, NO_SECT, 0, 0 */ 750 #define MACHO_N_VERSION KU8_C(0x88) /**< Compiler version. "version",, NO_SECT, 0, 0 */ 751 #define MACHO_N_OLEVEL KU8_C(0x8A) /**< Compiler -O level. "level",, NO_SECT, 0, 0 */ 752 #define MACHO_N_PSYM KU8_C(0xa0) /**< Parameter variable. "name",, NO_SECT, type, frame_offset */ 753 #define MACHO_N_EINCL KU8_C(0xa2) /**< End #include. "fname",, NO_SECT, 0, 0 (S) */ 754 #define MACHO_N_ENTRY KU8_C(0xa4) /**< Alternate entry point. "name",, section, line, address */ 755 #define MACHO_N_LBRAC KU8_C(0xc0) /**< Left bracket. 0,, NO_SECT, nesting_level, address */ 756 #define MACHO_N_EXCL KU8_C(0xc2) /**< Deleted include file. "fname",, NO_SECT, 0, sum? (S) */ 757 757 /* omits N_SCOPE */ 758 #define MACHO_N_RBRAC UINT8_C(0xe0) /**< Right bracket. 0,, NO_SECT, nesting_level, address */759 #define MACHO_N_BCOMM UINT8_C(0xe2) /**< Begin common. "name",, NO_SECT?, 0, 0 */760 #define MACHO_N_ECOMM UINT8_C(0xe4) /**< End common. "name",, section, 0, 0 */761 #define MACHO_N_ECOML UINT8_C(0xe8) /**< End local common. 0,, section, 0, address */762 #define MACHO_N_LENG UINT8_C(0xfe) /**< Length-value of the preceding entry.758 #define MACHO_N_RBRAC KU8_C(0xe0) /**< Right bracket. 0,, NO_SECT, nesting_level, address */ 759 #define MACHO_N_BCOMM KU8_C(0xe2) /**< Begin common. "name",, NO_SECT?, 0, 0 */ 760 #define MACHO_N_ECOMM KU8_C(0xe4) /**< End common. "name",, section, 0, 0 */ 761 #define MACHO_N_ECOML KU8_C(0xe8) /**< End local common. 0,, section, 0, address */ 762 #define MACHO_N_LENG KU8_C(0xfe) /**< Length-value of the preceding entry. 763 763 "name",, NO_SECT, 0, length */ 764 764 … … 775 775 */ 776 776 777 #define REFERENCE_TYPE UINT16_C(0x000f) /**< The reference type mask. */777 #define REFERENCE_TYPE KU16_C(0x000f) /**< The reference type mask. */ 778 778 #define REFERENCE_FLAG_UNDEFINED_NON_LAZY 0 /**< Normal undefined symbol. */ 779 779 #define REFERENCE_FLAG_UNDEFINED_LAZY 1 /**< Lazy undefined symbol. */ … … 783 783 #define REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY 5 /**< Lazy undefined private symbol. */ 784 784 785 #define REFERENCED_DYNAMICALLY UINT16_C(0x0010) /**< Don't strip. */785 #define REFERENCED_DYNAMICALLY KU16_C(0x0010) /**< Don't strip. */ 786 786 787 787 … … 799 799 800 800 /** Only MH_OBJECT: Never dead strip me! */ 801 #define N_NO_DEAD_STRIP UINT16_C(0x0020)801 #define N_NO_DEAD_STRIP KU16_C(0x0020) 802 802 /** Not MH_OBJECT: Discarded symbol. */ 803 #define N_DESC_DISCARDED UINT16_C(0x0020)803 #define N_DESC_DISCARDED KU16_C(0x0020) 804 804 /** Weak external symbol. Symbol can be missing, in which case it's will have the value 0. */ 805 #define N_WEAK_REF UINT16_C(0x0040)805 #define N_WEAK_REF KU16_C(0x0040) 806 806 /** Weak symbol definition. The symbol can be overridden by another weak 807 807 * symbol already present or by a non-weak (strong) symbol definition. … … 809 809 * @remark This bit means something differently for undefined symbols, see N_REF_TO_WEAK. 810 810 */ 811 #define N_WEAK_DEF UINT16_C(0x0080)811 #define N_WEAK_DEF KU16_C(0x0080) 812 812 /** Reference to a weak symbol, resolve using flat namespace searching. 813 813 * @remark This bit means something differently for defined symbols, see N_WEAK_DEF. */ 814 #define N_REF_TO_WEAK UINT16_C(0x0080)814 #define N_REF_TO_WEAK KU16_C(0x0080) 815 815 816 816 /** @} */ … … 833 833 typedef struct macho_relocation_info 834 834 { 835 int32_tr_address; /**< Section relative address of the fixup.835 KI32 r_address; /**< Section relative address of the fixup. 836 836 The top bit (signed) indicates that this is a scattered 837 837 relocation if set, see scattered_relocation_info_t. */ 838 uint32_tr_symbolnum : 24, /**< r_extern=1: Symbol table index, relocate with the address of this symbol.838 KU32 r_symbolnum : 24, /**< r_extern=1: Symbol table index, relocate with the address of this symbol. 839 839 r_extern=0: Section ordinal, relocate with the address of this section. */ 840 840 r_pcrel : 1, /**< PC (program counter) relative fixup; subtract the fixup address. */ 841 r_length : 2, /**< Fixup length: 0= uint8_t, 1=uint16_t, 2=uint32_t, 3=uint64_t. */841 r_length : 2, /**< Fixup length: 0=KU8, 1=KU16, 2=KU32, 3=KU64. */ 842 842 r_extern : 1, /**< External or internal fixup, decides the r_symbolnum interpretation.. */ 843 843 r_type : 4; /**< Relocation type; 0 is standard, non-zero are machine specific. */ … … 849 849 /** Flag in r_address indicating that the relocation is of the 850 850 * scattered_relocation_info_t kind and not macho_relocation_info_t. */ 851 #define R_SCATTERED UINT32_C(0x80000000)851 #define R_SCATTERED KU32_C(0x80000000) 852 852 853 853 /** … … 864 864 { 865 865 #ifdef KLDR_LITTLE_ENDIAN 866 uint32_tr_address : 24, /**< Section relative address of the fixup. (macho_relocation_info_t::r_address) */866 KU32 r_address : 24, /**< Section relative address of the fixup. (macho_relocation_info_t::r_address) */ 867 867 r_type : 4, /**< Relocation type; 0 is standard, non-zero are machine specific. (macho_relocation_info_t::r_type) */ 868 r_length : 2, /**< Fixup length: 0= uint8_t, 1=uint16_t, 2=uint32_t, 3=uint64_t. (macho_relocation_info_t::r_length) */868 r_length : 2, /**< Fixup length: 0=KU8, 1=KU16, 2=KU32, 3=KU64. (macho_relocation_info_t::r_length) */ 869 869 r_pcrel : 1, /**< PC (program counter) relative fixup; subtract the fixup address. (macho_relocation_info_t::r_pcrel) */ 870 870 r_scattered : 1; /**< Set if scattered relocation, clear if normal relocation. */ 871 871 #elif defined(KLDR_BIG_ENDIAN) 872 uint32_tr_scattered : 1, /**< Set if scattered relocation, clear if normal relocation. */872 KU32 r_scattered : 1, /**< Set if scattered relocation, clear if normal relocation. */ 873 873 r_pcrel : 1, /**< PC (program counter) relative fixup; subtract the fixup address. (macho_relocation_info_t::r_pcrel) */ 874 r_length : 2, /**< Fixup length: 0= uint8_t, 1=uint16_t, 2=uint32_t, 3=uint64_t. (macho_relocation_info_t::r_length) */874 r_length : 2, /**< Fixup length: 0=KU8, 1=KU16, 2=KU32, 3=KU64. (macho_relocation_info_t::r_length) */ 875 875 r_type : 4, /**< Relocation type; 0 is standard, non-zero are machine specific. (macho_relocation_info_t::r_type) */ 876 876 r_address : 24; /**< Section relative address of the fixup. (macho_relocation_info_t::r_address) */ … … 878 878 # error "Neither KLDR_LITTLE_ENDIAN nor KLDR_BIG_ENDIAN is defined!" 879 879 #endif 880 int32_tr_value; /**< The value the fixup is refering to (without offset added). */880 KI32 r_value; /**< The value the fixup is refering to (without offset added). */ 881 881 } scattered_relocation_info_t; 882 882
Note:
See TracChangeset
for help on using the changeset viewer.