00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef LLVM_SUPPORT_MACHO_H
00015 #define LLVM_SUPPORT_MACHO_H
00016
00017 #include "llvm/Support/DataTypes.h"
00018
00019
00020
00021
00022 namespace
llvm {
00023
namespace
MachO {
00024
00025 enum
{
00026
00027
00028
HeaderMagic32
= 0xFEEDFACEu,
00029
HeaderMagic32Swapped
= 0xCEFAEDFEu,
00030
HeaderMagic64
= 0xFEEDFACFu,
00031
HeaderMagic64Swapped
= 0xCFFAEDFEu,
00032
UniversalMagic
= 0xCAFEBABEu,
00033
UniversalMagicSwapped
= 0xBEBAFECAu,
00034
00035
00036
00037
HeaderFileTypeObject
= 0x1u,
00038
HeaderFileTypeExecutable
= 0x2u,
00039
HeaderFileTypeFixedVMShlib
= 0x3u,
00040
HeaderFileTypeCore
= 0x4u,
00041
HeaderFileTypePreloadedExecutable
= 0x5u,
00042
HeaderFileTypeDynamicShlib
= 0x6u,
00043
HeaderFileTypeDynamicLinkEditor
= 0x7u,
00044
HeaderFileTypeBundle
= 0x8u,
00045
HeaderFileTypeDynamicShlibStub
= 0x9u,
00046
HeaderFileTypeDSYM
= 0xAu,
00047
HeaderFileTypeKextBundle
= 0xBu,
00048
00049
00050
00051
HeaderFlagBitNoUndefinedSymbols
= 0x00000001u,
00052
HeaderFlagBitIsIncrementalLinkObject
= 0x00000002u,
00053
HeaderFlagBitIsDynamicLinkObject
= 0x00000004u,
00054
HeaderFlagBitBindAtLoad
= 0x00000008u,
00055
HeaderFlagBitPrebound
= 0x00000010u,
00056
HeaderFlagBitSplitSegments
= 0x00000020u,
00057
HeaderFlagBitLazyInit
= 0x00000040u,
00058
HeaderFlagBitTwoLevelNamespace
= 0x00000080u,
00059
HeaderFlagBitForceFlatNamespace
= 0x00000100u,
00060
HeaderFlagBitNoMultipleDefintions
= 0x00000200u,
00061
HeaderFlagBitNoFixPrebinding
= 0x00000400u,
00062
HeaderFlagBitPrebindable
= 0x00000800u,
00063
HeaderFlagBitAllModulesBound
= 0x00001000u,
00064
HeaderFlagBitSubsectionsViaSymbols
= 0x00002000u,
00065
HeaderFlagBitCanonical
= 0x00004000u,
00066
HeaderFlagBitWeakDefines
= 0x00008000u,
00067
HeaderFlagBitBindsToWeak
= 0x00010000u,
00068
HeaderFlagBitAllowStackExecution
= 0x00020000u,
00069
HeaderFlagBitRootSafe
= 0x00040000u,
00070
HeaderFlagBitSetUIDSafe
= 0x00080000u,
00071
HeaderFlagBitNoReexportedDylibs
= 0x00100000u,
00072
HeaderFlagBitPIE
= 0x00200000u,
00073
HeaderFlagBitDeadStrippableDylib
= 0x00400000u,
00074
00075
00076
LoadCommandDynamicLinkerRequired
= 0x80000000u,
00077
LoadCommandSegment32
= 0x00000001u,
00078
LoadCommandSymtab
= 0x00000002u,
00079
LoadCommandSymSeg
= 0x00000003u,
00080
LoadCommandThread
= 0x00000004u,
00081
LoadCommandUnixThread
= 0x00000005u,
00082
LoadCommandFixedVMShlibLoad
= 0x00000006u,
00083
LoadCommandFixedVMShlibIdent
= 0x00000007u,
00084
LoadCommandIdent
= 0x00000008u,
00085
LoadCommandFixedVMFileInclusion
= 0x00000009u,
00086
LoadCommandPrePage
= 0x0000000Au,
00087
LoadCommandDynamicSymtabInfo
= 0x0000000Bu,
00088
LoadCommandDylibLoad
= 0x0000000Cu,
00089
LoadCommandDylibIdent
= 0x0000000Du,
00090
LoadCommandDynamicLinkerLoad
= 0x0000000Eu,
00091
LoadCommandDynamicLinkerIdent
= 0x0000000Fu,
00092
LoadCommandDylibPrebound
= 0x00000010u,
00093
LoadCommandRoutines32
= 0x00000011u,
00094
LoadCommandSubFramework
= 0x00000012u,
00095
LoadCommandSubUmbrella
= 0x00000013u,
00096
LoadCommandSubClient
= 0x00000014u,
00097
LoadCommandSubLibrary
= 0x00000015u,
00098
LoadCommandTwoLevelHints
= 0x00000016u,
00099
LoadCommandPreBindChecksum
= 0x00000017u,
00100
LoadCommandDylibLoadWeak
= 0x80000018u,
00101
LoadCommandSegment64
= 0x00000019u,
00102
LoadCommandRoutines64
= 0x0000001Au,
00103
LoadCommandUUID
= 0x0000001Bu,
00104
LoadCommandRunpath
= 0x8000001Cu,
00105
LoadCommandCodeSignature
= 0x0000001Du,
00106
LoadCommandSegmentSplitInfo
= 0x0000001Eu,
00107
LoadCommandDylibReexport
= 0x8000001Fu,
00108
LoadCommandDylibLazyLoad
= 0x00000020u,
00109
LoadCommandEncryptionInfo
= 0x00000021u,
00110
LoadCommandDynamicLinkerInfo
= 0x00000022u,
00111
LoadCommandDynamicLinkerInfoOnly
= 0x80000022u,
00112
LoadCommandDylibLoadUpward
= 0x80000023u,
00113
00114
00115
SegmentCommandFlagBitHighVM
= 0x1u,
00116
SegmentCommandFlagBitFixedVMLibrary
= 0x2u,
00117
SegmentCommandFlagBitNoRelocations
= 0x4u,
00118
SegmentCommandFlagBitProtectedVersion1
= 0x8u,
00119
00120
00121
00122
00123
SectionFlagMaskSectionType
= 0x000000ffu,
00124
SectionFlagMaskAllAttributes
= 0xffffff00u,
00125
SectionFlagMaskUserAttributes
= 0xff000000u,
00126
SectionFlagMaskSystemAttributes
= 0x00ffff00u,
00127
00128
00129
00130
SectionTypeRegular
= 0x00u,
00131
SectionTypeZeroFill
= 0x01u,
00132
SectionTypeCStringLiterals
= 0x02u,
00133
SectionType4ByteLiterals
= 0x03u,
00134
SectionType8ByteLiterals
= 0x04u,
00135
SectionTypeLiteralPointers
= 0x05u,
00136
SectionTypeNonLazySymbolPointers
= 0x06u,
00137
SectionTypeLazySymbolPointers
= 0x07u,
00138
SectionTypeSymbolStubs
= 0x08u,
00139
SectionTypeModuleInitFunctionPointers
= 0x09u,
00140
SectionTypeModuleTermFunctionPointers
= 0x0au,
00141
SectionTypeCoalesced
= 0x0bu,
00142
SectionTypeZeroFillLarge
= 0x0cu,
00143
SectionTypeInterposing
= 0x0du,
00144
SectionType16ByteLiterals
= 0x0eu,
00145
SectionTypeDTraceObjectFormat
= 0x0fu,
00146
SectionTypeLazyDylibSymbolPointers
= 0x10u,
00147
00148
00149
00150
SectionAttrUserPureInstructions
= 0x80000000u,
00151
SectionAttrUserNoTableOfContents
= 0x40000000u,
00152
SectionAttrUserCanStripStaticSymbols
= 0x20000000u,
00153
SectionAttrUserNoDeadStrip
= 0x10000000u,
00154
SectionAttrUserLiveSupport
= 0x08000000u,
00155
SectionAttrUserSelfModifyingCode
= 0x04000000u,
00156
SectionAttrUserDebug
= 0x02000000u,
00157
00158
00159
00160
SectionAttrSytemSomeInstructions
= 0x00000400u,
00161
SectionAttrSytemHasExternalRelocations
= 0x00000200u,
00162
SectionAttrSytemHasLocalRelocations
= 0x00000100u,
00163
00164
IndirectSymbolLocal
= 0x80000000u,
00165
IndirectSymbolAbsolute
= 0x40000000u,
00166
00167
RebaseTypePointer
= 1u,
00168
RebaseTypeTextAbsolute32
= 2u,
00169
RebaseTypeTextPCRelative32
= 3u,
00170
00171
RebaseOpcodeMask
= 0xF0u,
00172
RebaseImmediateMask
= 0x0Fu,
00173
RebaseOpcodeDone
= 0x00u,
00174
RebaseOpcodeSetTypeImmediate
= 0x10u,
00175
RebaseOpcodeSetSegmentAndOffsetULEB
= 0x20u,
00176
RebaseOpcodeAddAddressULEB
= 0x30u,
00177
RebaseOpcodeAddAddressImmediateScaled
= 0x40u,
00178
RebaseOpcodeDoRebaseImmediateTimes
= 0x50u,
00179
RebaseOpcodeDoRebaseULEBTimes
= 0x60u,
00180
RebaseOpcodeDoRebaseAddAddressULEB
= 0x70u,
00181
RebaseOpcodeDoRebaseULEBTimesSkippingULEB
= 0x80u,
00182
00183
00184
BindTypePointer
= 1u,
00185
BindTypeTextAbsolute32
= 2u,
00186
BindTypeTextPCRelative32
= 3u,
00187
00188
BindSpecialDylibSelf
= 0u,
00189
BindSpecialDylibMainExecutable
= -1u,
00190
BindSpecialDylibFlatLookup
= -2u,
00191
00192
BindSymbolFlagsWeakImport
= 0x1u,
00193
BindSymbolFlagsNonWeakDefinition
= 0x8u,
00194
00195
BindOpcodeMask
= 0xF0u,
00196
BindImmediateMask
= 0x0Fu,
00197
BindOpcodeDone
= 0x00u,
00198
BindOpcodeSetDylibOrdinalImmediate
= 0x10u,
00199
BindOpcodeSetDylibOrdinalULEB
= 0x20u,
00200
BindOpcodeSetDylibSpecialImmediate
= 0x30u,
00201
BindOpcodeSetSymbolTrailingFlagsImmediate
= 0x40u,
00202
BindOpcodeSetTypeImmediate
= 0x50u,
00203
BindOpcodeSetAppendSLEB
= 0x60u,
00204
BindOpcodeSetSegmentAndOffsetULEB
= 0x70u,
00205
BindOpcodeAddAddressULEB
= 0x80u,
00206
BindOpcodeDoBind
= 0x90u,
00207
BindOpcodeDoBindAddAddressULEB
= 0xA0u,
00208
BindOpcodeDoBindAddAddressImmediateScaled
= 0xB0u,
00209
BindOpcodeDoBindULEBTimesSkippingULEB
= 0xC0u,
00210
00211
ExportSymbolFlagsKindMask
= 0x03u,
00212
ExportSymbolFlagsKindRegular
= 0x00u,
00213
ExportSymbolFlagsKindThreadLocal
= 0x01u,
00214
ExportSymbolFlagsWeakDefinition
= 0x04u,
00215
ExportSymbolFlagsIndirectDefinition
= 0x08u,
00216
ExportSymbolFlagsHasSpecializations
= 0x10u,
00217
00218
00219
00220
00221
NlistMaskStab
= 0xe0,
00222
NlistMaskPrivateExternal
= 0x10,
00223
NlistMaskType
= 0x0e,
00224
NlistMaskExternal
= 0x01,
00225
00226
00227
00228
NListTypeUndefined
= 0x0u,
00229
NListTypeAbsolute
= 0x2u,
00230
NListTypeSection
= 0xeu,
00231
NListTypePreboundUndefined
= 0xcu,
00232
NListTypeIndirect
= 0xau,
00233
00234
00235
00236
NListSectionNoSection
= 0u,
00237
NListSectionMaxSection
= 0xffu,
00238
00239
00240
00241
StabGlobalSymbol
= 0x20u,
00242
StabFunctionName
= 0x22u,
00243
StabFunction
= 0x24u,
00244
StabStaticSymbol
= 0x26u,
00245
StabLocalCommon
= 0x28u,
00246
StabBeginSymbol
= 0x2Eu,
00247
StabSourceFileOptions
= 0x3Cu,
00248
StabRegisterSymbol
= 0x40u,
00249
StabSourceLine
= 0x44u,
00250
StabEndSymbol
= 0x4Eu,
00251
StabStructureType
= 0x60u,
00252
StabSourceFileName
= 0x64u,
00253
StabObjectFileName
= 0x66u,
00254
StabLocalSymbol
= 0x80u,
00255
StabBeginIncludeFileName
= 0x82u,
00256
StabIncludeFileName
= 0x84u,
00257
StabCompilerParameters
= 0x86u,
00258
StabCompilerVersion
= 0x88u,
00259
StabCompilerOptLevel
= 0x8Au,
00260
StabParameter
= 0xA0u,
00261
StabEndIncludeFile
= 0xA2u,
00262
StabAlternateEntry
= 0xA4u,
00263
StabLeftBracket
= 0xC0u,
00264
StabDeletedIncludeFile
= 0xC2u,
00265
StabRightBracket
= 0xE0u,
00266
StabBeginCommon
= 0xE2u,
00267
StabEndCommon
= 0xE4u,
00268
StabEndCommonLocal
= 0xE8u,
00269
StabLength
= 0xFEu
00270
00271 };
00272
00273
00274
00275
struct
mach_header
{
00276
uint32_t magic
;
00277
uint32_t cputype
;
00278
uint32_t cpusubtype
;
00279
uint32_t filetype
;
00280
uint32_t ncmds
;
00281
uint32_t sizeofcmds
;
00282
uint32_t flags
;
00283 };
00284
00285
struct
mach_header_64
{
00286
uint32_t magic
;
00287
uint32_t cputype
;
00288
uint32_t cpusubtype
;
00289
uint32_t filetype
;
00290
uint32_t ncmds
;
00291
uint32_t sizeofcmds
;
00292
uint32_t flags
;
00293
uint32_t reserved
;
00294 };
00295
00296
struct
load_command
{
00297
uint32_t cmd
;
00298
uint32_t cmdsize
;
00299 };
00300
00301
struct
segment_command
{
00302
uint32_t cmd
;
00303
uint32_t cmdsize
;
00304
char
segname
[16];
00305
uint32_t vmaddr
;
00306
uint32_t vmsize
;
00307
uint32_t fileoff
;
00308
uint32_t filesize
;
00309
uint32_t maxprot
;
00310
uint32_t initprot
;
00311
uint32_t nsects
;
00312
uint32_t flags
;
00313 };
00314
00315
struct
segment_command_64
{
00316
uint32_t cmd
;
00317
uint32_t cmdsize
;
00318
char
segname
[16];
00319
uint64_t vmaddr
;
00320
uint64_t vmsize
;
00321
uint64_t fileoff
;
00322
uint64_t filesize
;
00323
uint32_t maxprot
;
00324
uint32_t initprot
;
00325
uint32_t nsects
;
00326
uint32_t flags
;
00327 };
00328
00329
struct
section
{
00330
char
sectname
[16];
00331
char
segname
[16];
00332
uint32_t addr
;
00333
uint32_t size
;
00334
uint32_t offset
;
00335
uint32_t align
;
00336
uint32_t reloff
;
00337
uint32_t nreloc
;
00338
uint32_t flags
;
00339
uint32_t reserved1
;
00340
uint32_t reserved2
;
00341 };
00342
00343
struct
section_64
{
00344
char
sectname
[16];
00345
char
segname
[16];
00346
uint64_t addr
;
00347
uint64_t size
;
00348
uint32_t offset
;
00349
uint32_t align
;
00350
uint32_t reloff
;
00351
uint32_t nreloc
;
00352
uint32_t flags
;
00353
uint32_t reserved1
;
00354
uint32_t reserved2
;
00355
uint32_t reserved3
;
00356 };
00357
00358
struct
fvmlib
{
00359
uint32_t name
;
00360
uint32_t minor_version
;
00361
uint32_t header_addr
;
00362 };
00363
00364
struct
fvmlib_command
{
00365
uint32_t cmd
;
00366
uint32_t cmdsize
;
00367
struct
fvmlib
fvmlib
;
00368 };
00369
00370
struct
dylib
{
00371
uint32_t name
;
00372
uint32_t timestamp
;
00373
uint32_t current_version
;
00374
uint32_t compatibility_version
;
00375 };
00376
00377
struct
dylib_command
{
00378
uint32_t cmd
;
00379
uint32_t cmdsize
;
00380
struct
dylib
dylib
;
00381 };
00382
00383
struct
sub_framework_command
{
00384
uint32_t cmd
;
00385
uint32_t cmdsize
;
00386
uint32_t umbrella
;
00387 };
00388
00389
struct
sub_client_command
{
00390
uint32_t cmd
;
00391
uint32_t cmdsize
;
00392
uint32_t client
;
00393 };
00394
00395
struct
sub_umbrella_command
{
00396
uint32_t cmd
;
00397
uint32_t cmdsize
;
00398
uint32_t sub_umbrella
;
00399 };
00400
00401
struct
sub_library_command
{
00402
uint32_t cmd
;
00403
uint32_t cmdsize
;
00404
uint32_t sub_library
;
00405 };
00406
00407
struct
prebound_dylib_command
{
00408
uint32_t cmd
;
00409
uint32_t cmdsize
;
00410
uint32_t name
;
00411
uint32_t nmodules
;
00412
uint32_t linked_modules
;
00413 };
00414
00415
struct
dylinker_command
{
00416
uint32_t cmd
;
00417
uint32_t cmdsize
;
00418
uint32_t name
;
00419 };
00420
00421
struct
thread_command
{
00422
uint32_t cmd
;
00423
uint32_t cmdsize
;
00424 };
00425
00426
struct
routines_command
{
00427
uint32_t cmd
;
00428
uint32_t cmdsize
;
00429
uint32_t init_address
;
00430
uint32_t init_module
;
00431
uint32_t reserved1
;
00432
uint32_t reserved2
;
00433
uint32_t reserved3
;
00434
uint32_t reserved4
;
00435
uint32_t reserved5
;
00436
uint32_t reserved6
;
00437 };
00438
00439
struct
routines_command_64
{
00440
uint32_t cmd
;
00441
uint32_t cmdsize
;
00442
uint64_t init_address
;
00443
uint64_t init_module
;
00444
uint64_t reserved1
;
00445
uint64_t reserved2
;
00446
uint64_t reserved3
;
00447
uint64_t reserved4
;
00448
uint64_t reserved5
;
00449
uint64_t reserved6
;
00450 };
00451
00452
struct
symtab_command
{
00453
uint32_t cmd
;
00454
uint32_t cmdsize
;
00455
uint32_t symoff
;
00456
uint32_t nsyms
;
00457
uint32_t stroff
;
00458
uint32_t strsize
;
00459 };
00460
00461
struct
dysymtab_command
{
00462
uint32_t cmd
;
00463
uint32_t cmdsize
;
00464
uint32_t ilocalsym
;
00465
uint32_t nlocalsym
;
00466
uint32_t iextdefsym
;
00467
uint32_t nextdefsym
;
00468
uint32_t iundefsym
;
00469
uint32_t nundefsym
;
00470
uint32_t tocoff
;
00471
uint32_t ntoc
;
00472
uint32_t modtaboff
;
00473
uint32_t nmodtab
;
00474
uint32_t extrefsymoff
;
00475
uint32_t nextrefsyms
;
00476
uint32_t indirectsymoff
;
00477
uint32_t nindirectsyms
;
00478
uint32_t extreloff
;
00479
uint32_t nextrel
;
00480
uint32_t locreloff
;
00481
uint32_t nlocrel
;
00482 };
00483
00484
struct
dylib_table_of_contents
{
00485
uint32_t symbol_index
;
00486
uint32_t module_index
;
00487 };
00488
00489
struct
dylib_module
{
00490
uint32_t module_name
;
00491
uint32_t iextdefsym
;
00492
uint32_t nextdefsym
;
00493
uint32_t irefsym
;
00494
uint32_t nrefsym
;
00495
uint32_t ilocalsym
;
00496
uint32_t nlocalsym
;
00497
uint32_t iextrel
;
00498
uint32_t nextrel
;
00499
uint32_t iinit_iterm
;
00500
uint32_t ninit_nterm
;
00501
uint32_t objc_module_info_addr
;
00502
uint32_t objc_module_info_size
;
00503 };
00504
00505
struct
dylib_module_64
{
00506
uint32_t module_name
;
00507
uint32_t iextdefsym
;
00508
uint32_t nextdefsym
;
00509
uint32_t irefsym
;
00510
uint32_t nrefsym
;
00511
uint32_t ilocalsym
;
00512
uint32_t nlocalsym
;
00513
uint32_t iextrel
;
00514
uint32_t nextrel
;
00515
uint32_t iinit_iterm
;
00516
uint32_t ninit_nterm
;
00517
uint32_t objc_module_info_size
;
00518
uint64_t objc_module_info_addr
;
00519 };
00520
00521
struct
dylib_reference
{
00522
uint32_t isym
:24,
00523 flags
:8;
00524 };
00525
00526
00527
struct
twolevel_hints_command
{
00528
uint32_t cmd
;
00529
uint32_t cmdsize
;
00530
uint32_t offset
;
00531
uint32_t nhints
;
00532 };
00533
00534
struct
twolevel_hint
{
00535
uint32_t isub_image
:8,
00536 itoc
:24;
00537 };
00538
00539
struct
prebind_cksum_command
{
00540
uint32_t cmd
;
00541
uint32_t cmdsize
;
00542
uint32_t cksum
;
00543 };
00544
00545
struct
uuid_command
{
00546
uint32_t cmd
;
00547
uint32_t cmdsize
;
00548
uint8_t uuid
[16];
00549 };
00550
00551
struct
rpath_command
{
00552
uint32_t cmd
;
00553
uint32_t cmdsize
;
00554
uint32_t path
;
00555 };
00556
00557
struct
linkedit_data_command
{
00558
uint32_t cmd
;
00559
uint32_t cmdsize
;
00560
uint32_t dataoff
;
00561
uint32_t datasize
;
00562 };
00563
00564
struct
encryption_info_command
{
00565
uint32_t cmd
;
00566
uint32_t cmdsize
;
00567
uint32_t cryptoff
;
00568
uint32_t cryptsize
;
00569
uint32_t cryptid
;
00570 };
00571
00572
struct
dyld_info_command
{
00573
uint32_t cmd
;
00574
uint32_t cmdsize
;
00575
uint32_t rebase_off
;
00576
uint32_t rebase_size
;
00577
uint32_t bind_off
;
00578
uint32_t bind_size
;
00579
uint32_t weak_bind_off
;
00580
uint32_t weak_bind_size
;
00581
uint32_t lazy_bind_off
;
00582
uint32_t lazy_bind_size
;
00583
uint32_t export_off
;
00584
uint32_t export_size
;
00585 };
00586
00587
struct
symseg_command
{
00588
uint32_t cmd
;
00589
uint32_t cmdsize
;
00590
uint32_t offset
;
00591
uint32_t size
;
00592 };
00593
00594
struct
ident_command
{
00595
uint32_t cmd
;
00596
uint32_t cmdsize
;
00597 };
00598
00599
struct
fvmfile_command
{
00600
uint32_t cmd
;
00601
uint32_t cmdsize
;
00602
uint32_t name
;
00603
uint32_t header_addr
;
00604 };
00605
00606
00607
00608
struct
fat_header
{
00609
uint32_t magic
;
00610
uint32_t nfat_arch
;
00611 };
00612
00613
struct
fat_arch
{
00614
uint32_t cputype
;
00615
uint32_t cpusubtype
;
00616
uint32_t offset
;
00617
uint32_t size
;
00618
uint32_t align
;
00619 };
00620
00621
00622
struct
nlist
{
00623
uint32_t n_strx
;
00624
uint8_t n_type
;
00625
uint8_t n_sect
;
00626
int16_t n_desc
;
00627
uint32_t n_value
;
00628 };
00629
00630
struct
nlist_64
{
00631
uint32_t n_strx
;
00632
uint8_t n_type
;
00633
uint8_t n_sect
;
00634
uint16_t n_desc
;
00635
uint64_t n_value
;
00636 };
00637
00638
00639
00640
static
inline
uint16_t GET_LIBRARY_ORDINAL
(uint16_t n_desc)
00641 {
00642 return
(((n_desc) >> 8u) & 0xffu);
00643 }
00644
00645
static
inline
void
SET_LIBRARY_ORDINAL
(uint16_t &n_desc, uint8_t ordinal)
00646 {
00647 n_desc = (((n_desc) & 0x00ff) | (((ordinal) & 0xff) << 8));
00648 }
00649
00650
static
inline
uint8_t GET_COMM_ALIGN
(uint16_t n_desc)
00651 {
00652 return
(n_desc >> 8u) & 0x0fu;
00653 }
00654
00655
static
inline
void
SET_COMM_ALIGN
(uint16_t &n_desc, uint8_t align)
00656 {
00657 n_desc = ((n_desc & 0xf0ffu) | ((align & 0x0fu) << 8u));
00658 }
00659
00660
00661 enum
{
00662
00663
CPUArchMask
= 0xff000000,
00664
CPUArchABI64
= 0x01000000,
00665
00666
00667
CPUTypeI386
= 7,
00668
CPUTypeX86_64
= CPUTypeI386
| CPUArchABI64
,
00669
CPUTypeARM
= 12,
00670
CPUTypeSPARC
= 14,
00671
CPUTypePowerPC
= 18,
00672
CPUTypePowerPC64
= CPUTypePowerPC
| CPUArchABI64
,
00673
00674
00675
00676
00677
00678
CPUSubType_I386_ALL
= 3,
00679
CPUSubType_X86_64_ALL
= 3,
00680
00681
00682
CPUSubType_ARM_ALL
= 0,
00683
CPUSubType_ARM_V4T
= 5,
00684
CPUSubType_ARM_V5
= 7,
00685
CPUSubType_ARM_V6
= 6,
00686
CPUSubType_ARM_V7
= 9,
00687
00688
00689
CPUSubType_POWERPC_ALL
= 0,
00690
00691
CPUSubType_SPARC_ALL
= 0
00692 };
00693 }
00694 }
00695
00696 #endif
see also: http://www.opensource.apple.com/source/xnu/xnu-1456.1.26/bsd/kern/mach_loader.c