Mac OS 9
PEFBinaryFormat.h File Reference

PEF Types and Macros. More...

#include <MacTypes.h>

Go to the source code of this file.

Data Structures

struct  PEFContainerHeader
 
struct  PEFSectionHeader
 
struct  PEFLoaderInfoHeader
 
struct  PEFImportedLibrary
 
struct  PEFImportedSymbol
 
struct  PEFExportedSymbolHashSlot
 
struct  PEFSplitHashWord
 
struct  PEFExportedSymbolKey
 
struct  PEFExportedSymbol
 
struct  PEFLoaderRelocationHeader
 

Macros

#define PEFFirstSectionNameOffset(container)
 
#define PEFPkDataOpcode(byte)   (((UInt8)(byte)) >> kPEFPkDataOpcodeShift)
 
#define PEFPkDataCount5(byte)   (((UInt8)(byte)) & kPEFPkDataCount5Mask)
 
#define PEFPkDataComposeInstr(opcode, count5)    ((((UInt8)(opcode)) << kPEFPkDataOpcodeShift) | ((UInt8)(count5)))
 
#define PEFImportedSymbolClass(classAndName)    ((UInt8)((classAndName) >> kPEFImpSymClassShift))
 
#define PEFImportedSymbolNameOffset(classAndName)    ((classAndName) & kPEFImpSymNameOffsetMask)
 
#define PEFComposeImportedSymbol(class, nameOffset)    ((((UInt32)(class)) << kPEFImpSymClassShift) | ((UInt32)(nameOffset)))
 
#define PEFHashTableIndex(fullHashWord, hashTablePower)
 
#define PEFHashSlotSymbolCount(countAndStart)    ((UInt32)((countAndStart) >> kPEFHashSlotSymCountShift))
 
#define PEFHashSlotFirstKey(countAndStart)    ((countAndStart) & kPEFHashSlotFirstKeyMask)
 
#define PEFComposeExportedSymbolHashSlot(symbolCount, firstKey)
 
#define PEFHashNameLength(fullHashWord)    ((UInt32)((fullHashWord) >> kPEFHashLengthShift))
 
#define PEFHashValue(fullHashWord)   ((fullHashWord) & kPEFHashValueMask)
 
#define PEFComposeFullHashWord(nameLength, hashValue)    ((((UInt32)(nameLength)) << kPEFHashLengthShift) | ((UInt32)(hashValue)))
 
#define PEFExportedSymbolClass(classAndName)    ((UInt8)((classAndName) >> kPEFExpSymClassShift))
 
#define PEFExportedSymbolNameOffset(classAndName)    ((classAndName) & kPEFExpSymNameOffsetMask)
 
#define PEFComposeExportedSymbol(class, nameOffset)    ((((UInt32)(class)) << kPEFExpSymClassShift) | ((UInt32)(nameOffset)))
 
#define PEFRFShift(offset, length)   (16 - ((offset) + (length)))
 
#define PEFRFMask(length)   ((1 << (length)) - 1)
 
#define PEFRelocField(chunk, offset, length)    (((chunk) >> (16 - ((offset) + (length)))) & ((1 << (length)) - 1))
 
#define PEFRelocBasicOpcode(firstChunk)    (kPEFRelocBasicOpcodes[(firstChunk) >> 9])
 
#define PEFRelocLgSetOrBySubopcode(chunk)   (((chunk) >> 6) & 0x0F)
 
#define PEFMaskedBasicOpcodes
 
#define PEFRelocWithSkipSkipCount(chunk)   PEFRelocField((chunk), 2, 8)
 
#define PEFRelocWithSkipRelocCount(chunk)   PEFRelocField((chunk), 10, 6)
 
#define PEFRelocComposeWithSkip(skipCount, relocCount)    (0x0000 | (((UInt16)(skipCount)) << 6) | ((UInt16)(relocCount)))
 
#define PEFRelocRunSubopcode(chunk)   PEFRelocField((chunk), 3, 4)
 
#define PEFRelocRunRunLength(chunk)   (PEFRelocField((chunk), 7, 9) + 1)
 
#define PEFRelocComposeRun(subopcode, runLength)    (0x4000 | (((UInt16)(subopcode)) << 9) | ((UInt16)((runLength)-1)))
 
#define PEFRelocComposeBySectC(runLength)   PEFRelocComposeRun(0, (runLength))
 
#define PEFRelocComposeBySectD(runLength)   PEFRelocComposeRun(1, (runLength))
 
#define PEFRelocComposeTVector12(runLength)   PEFRelocComposeRun(2, (runLength))
 
#define PEFRelocComposeTVector8(runLength)   PEFRelocComposeRun(3, (runLength))
 
#define PEFRelocComposeVTable8(runLength)   PEFRelocComposeRun(4, (runLength))
 
#define PEFRelocComposeImportRun(runLength)   PEFRelocComposeRun(5, (runLength))
 
#define PEFRelocSmIndexSubopcode(chunk)   PEFRelocField((chunk), 3, 4)
 
#define PEFRelocSmIndexIndex(chunk)   PEFRelocField((chunk), 7, 9)
 
#define PEFRelocComposeSmIndex(subopcode, index)    (0x6000 | (((UInt16)(subopcode)) << 9) | ((UInt16)(index)))
 
#define PEFRelocComposeSmByImport(index)   PEFRelocComposeSmIndex(0, (index))
 
#define PEFRelocComposeSmSetSectC(index)   PEFRelocComposeSmIndex(1, (index))
 
#define PEFRelocComposeSmSetSectD(index)   PEFRelocComposeSmIndex(2, (index))
 
#define PEFRelocComposeSmBySection(index)   PEFRelocComposeSmIndex(3, (index))
 
#define PEFRelocIncrPositionOffset(chunk)   (PEFRelocField((chunk), 4, 12) + 1)
 
#define PEFRelocComposeIncrPosition(offset)   (0x8000 | ((UInt16)((offset)-1)))
 
#define PEFRelocSmRepeatChunkCount(chunk)   (PEFRelocField((chunk), 4, 4) + 1)
 
#define PEFRelocSmRepeatRepeatCount(chunk)   (PEFRelocField((chunk), 8, 8) + 1)
 
#define PEFRelocComposeSmRepeat(chunkCount, repeatCount)    (0x9000 | ((((UInt16)(chunkCount)) - 1) << 8) | (((UInt16)(repeatCount)) - 1))
 
#define PEFRelocSetPosOffsetHigh(chunk)   PEFRelocField((chunk), 6, 10)
 
#define PEFRelocSetPosFullOffset(firstChunk, secondChunk)    (((((UInt32)(firstChunk)) & 0x03FF) << 16) | ((UInt32)(secondChunk)))
 
#define PEFRelocComposeSetPosition_1st(fullOffset)    (0xA000 | ((UInt16)(((UInt32)(fullOffset)) >> 16)))
 
#define PEFRelocComposeSetPosition_2nd(fullOffset)    ((UInt16)((UInt32)(fullOffset) & 0xFFFF))
 
#define PEFRelocLgByImportIndexHigh(chunk)   PEFRelocField((chunk), 6, 10)
 
#define PEFRelocLgByImportFullIndex(firstChunk, secondChunk)    (((((UInt32)(firstChunk)) & 0x03FF) << 16) | ((UInt32)(secondChunk)))
 
#define PEFRelocComposeLgByImport_1st(fullIndex)    (0xA400 | ((UInt16)(((UInt32)(fullIndex)) >> 16)))
 
#define PEFRelocComposeLgByImport_2nd(fullIndex)    ((UInt16)((UInt32)(fullIndex) & 0xFFFF))
 
#define PEFRelocLgRepeatChunkCount(chunk)   (PEFRelocField((chunk), 6, 4) + 1)
 
#define PEFRelocLgRepeatRepeatCountHigh(chunk)   PEFRelocField((chunk), 10, 6)
 
#define PEFRelocLgRepeatFullRepeatCount(firstChunk, secondChunk)    (((((UInt32)(firstChunk)) & 0x003F) << 16) | ((UInt32)(secondChunk)))
 
#define PEFRelocComposeLgRepeat_1st(chunkCount, fullRepeatCount)
 
#define PEFRelocComposeLgRepeat_2nd(chunkCount, fullRepeatCount)    ((UInt16)((UInt32)(fullRepeatCount) & 0xFFFF))
 
#define PEFRelocLgSetOrBySectionSubopcode(chunk)   PEFRelocField((chunk), 6, 4)
 
#define PEFRelocLgSetOrBySectionIndexHigh(chunk)   PEFRelocField((chunk), 10, 6)
 
#define PEFRelocLgSetOrBySectionFullIndex(firstChunk, secondChunk)    (((((UInt32)(firstChunk)) & 0x003F) << 16) | ((UInt32)(secondChunk)))
 
#define PEFRelocComposeLgSetOrBySection_1st(subopcode, fullIndex)
 
#define PEFRelocComposeLgSetOrBySection_2nd(subopcode, fullIndex)    ((UInt16)((UInt32)(fullIndex) & 0xFFFF))
 
#define PEFRelocComposeLgBySection(fullIndex)    PEFRelocComposeLgSetOrBySection(0x00, (fullIndex))
 
#define PEFRelocComposeLgSetSectC(fullIndex)    PEFRelocComposeLgSetOrBySection(0x01, (fullIndex))
 
#define PEFRelocComposeLgSetSectD(fullIndex)    PEFRelocComposeLgSetOrBySection(0x02, (fullIndex))
 

Typedefs

typedef struct PEFContainerHeader PEFContainerHeader
 
typedef struct PEFSectionHeader PEFSectionHeader
 
typedef struct PEFLoaderInfoHeader PEFLoaderInfoHeader
 
typedef struct PEFImportedLibrary PEFImportedLibrary
 
typedef struct PEFImportedSymbol PEFImportedSymbol
 
typedef struct PEFExportedSymbolHashSlot PEFExportedSymbolHashSlot
 
typedef struct PEFSplitHashWord PEFSplitHashWord
 
typedef struct PEFExportedSymbolKey PEFExportedSymbolKey
 
typedef struct PEFExportedSymbol PEFExportedSymbol
 
typedef UInt16 PEFRelocChunk
 
typedef struct PEFLoaderRelocationHeader PEFLoaderRelocationHeader
 

Enumerations

enum  { kPEFTag1 = FOUR_CHAR_CODE('Joy!') , kPEFTag2 = FOUR_CHAR_CODE('peff') , kPEFVersion = 0x00000001 }
 
enum  { kPEFFirstSectionHeaderOffset = sizeof(PEFContainerHeader) }
 
enum  {
  kPEFCodeSection = 0 , kPEFUnpackedDataSection = 1 , kPEFPackedDataSection = 2 , kPEFConstantSection = 3 ,
  kPEFExecDataSection = 6 , kPEFLoaderSection = 4 , kPEFDebugSection = 5 , kPEFExceptionSection = 7 ,
  kPEFTracebackSection = 8
}
 
enum  { kPEFProcessShare = 1 , kPEFGlobalShare = 4 , kPEFProtectedShare = 5 }
 
enum  {
  kPEFPkDataZero = 0 , kPEFPkDataBlock = 1 , kPEFPkDataRepeat = 2 , kPEFPkDataRepeatBlock = 3 ,
  kPEFPkDataRepeatZero = 4
}
 
enum  {
  kPEFPkDataOpcodeShift = 5 , kPEFPkDataCount5Mask = 0x1F , kPEFPkDataMaxCount5 = 31 , kPEFPkDataVCountShift = 7 ,
  kPEFPkDataVCountMask = 0x7F , kPEFPkDataVCountEndMask = 0x80
}
 
enum  { kPEFWeakImportLibMask , kPEFInitLibBeforeMask }
 
enum  { kPEFImpSymClassShift = 24 , kPEFImpSymNameOffsetMask = 0x00FFFFFF , kPEFImpSymMaxNameOffset = 0x00FFFFFF }
 
enum  {
  kPEFCodeSymbol = 0x00 , kPEFDataSymbol = 0x01 , kPEFTVectorSymbol = 0x02 , kPEFTOCSymbol = 0x03 ,
  kPEFGlueSymbol = 0x04 , kPEFUndefinedSymbol = 0x0F , kPEFWeakImportSymMask = 0x80
}
 
enum  { kPEFHashSlotSymCountShift = 18 , kPEFHashSlotFirstKeyMask = 0x0003FFFF , kPEFHashSlotMaxSymbolCount = 0x00003FFF , kPEFHashSlotMaxKeyIndex = 0x0003FFFF }
 
enum  { kPEFHashLengthShift = 16 , kPEFHashValueMask = 0x0000FFFF , kPEFHashMaxLength = 0x0000FFFF }
 
enum  { kPEFExpSymClassShift = 24 , kPEFExpSymNameOffsetMask = 0x00FFFFFF , kPEFExpSymMaxNameOffset = 0x00FFFFFF }
 
enum  { kPEFAbsoluteExport = -2 , kPEFReexportedImport }
 
enum  { kPEFRelocBasicOpcodeRange = 128 }
 
enum  {
  kPEFRelocBySectDWithSkip = 0x00 , kPEFRelocBySectC = 0x20 , kPEFRelocBySectD = 0x21 , kPEFRelocTVector12 = 0x22 ,
  kPEFRelocTVector8 = 0x23 , kPEFRelocVTable8 = 0x24 , kPEFRelocImportRun = 0x25 , kPEFRelocSmByImport = 0x30 ,
  kPEFRelocSmSetSectC = 0x31 , kPEFRelocSmSetSectD = 0x32 , kPEFRelocSmBySection = 0x33 , kPEFRelocIncrPosition = 0x40 ,
  kPEFRelocSmRepeat = 0x48 , kPEFRelocSetPosition = 0x50 , kPEFRelocLgByImport = 0x52 , kPEFRelocLgRepeat = 0x58 ,
  kPEFRelocLgSetOrBySection = 0x5A , kPEFRelocUndefinedOpcode
}
 
enum  { kPEFRelocLgBySectionSubopcode = 0x00 , kPEFRelocLgSetSectCSubopcode = 0x01 , kPEFRelocLgSetSectDSubopcode = 0x02 }
 
enum  { kPEFRelocWithSkipMaxSkipCount = 255 , kPEFRelocWithSkipMaxRelocCount = 63 }
 
enum  { kPEFRelocRunMaxRunLength = 512 }
 
enum  { kPEFRelocSmIndexMaxIndex = 511 }
 
enum  { kPEFRelocIncrPositionMaxOffset = 4096 }
 
enum  { kPEFRelocSmRepeatMaxChunkCount = 16 , kPEFRelocSmRepeatMaxRepeatCount = 256 }
 
enum  { kPEFRelocSetPosMaxOffset = 0x03FFFFFF }
 
enum  { kPEFRelocLgByImportMaxIndex = 0x03FFFFFF }
 
enum  { kPEFRelocLgRepeatMaxChunkCount = 16 , kPEFRelocLgRepeatMaxRepeatCount = 0x003FFFFF }
 
enum  { kPEFRelocLgSetOrBySectionMaxIndex = 0x003FFFFF }
 

Detailed Description

PEF Types and Macros.

Introduced In: Master Interfaces
Avaliable From: Universal Interfaces 3.4.1
Copyright: © 1993-2001 by Apple Computer, Inc., all rights reserved.

For bug reports, consult the following page on the World Wide Web:

http://developer.apple.com/bugreporter/

Macro Definition Documentation

◆ PEFComposeExportedSymbolHashSlot

#define PEFComposeExportedSymbolHashSlot (   symbolCount,
  firstKey 
)
Value:
((((UInt32)(symbolCount)) << kPEFHashSlotSymCountShift) | \
((UInt32)(firstKey)))

◆ PEFFirstSectionNameOffset

#define PEFFirstSectionNameOffset (   container)
Value:
(kPEFFirstSectionHeaderOffset + \
((container)->sectionCount * sizeof(PEFSectionHeader)))
Definition: AEDataModel.h:175
Definition: PEFBinaryFormat.h:160

◆ PEFHashTableIndex

#define PEFHashTableIndex (   fullHashWord,
  hashTablePower 
)
Value:
(((fullHashWord) ^ ((fullHashWord) >> (hashTablePower))) & \
((1 << (hashTablePower)) - 1))

◆ PEFRelocComposeLgRepeat_1st

#define PEFRelocComposeLgRepeat_1st (   chunkCount,
  fullRepeatCount 
)
Value:
(0xB000 | ((((UInt16)(chunkCount)) - 1) << 6) | \
((UInt16)(((UInt32)(fullRepeatCount)) >> 16)))

◆ PEFRelocComposeLgSetOrBySection_1st

#define PEFRelocComposeLgSetOrBySection_1st (   subopcode,
  fullIndex 
)
Value:
(0xB400 | (((UInt16)(subopcode)) << 6) | \
((UInt16)(((UInt32)(fullIndex)) >> 16)))