RetroLinker
Linker for several 8-bit, 16-bit and 32-bit formats
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
Apple::PEFFormat::RelocationProcessor Class Reference

A representation of a state machine that generates the actual relocations using the relocation data in a file. More...

#include <pefexe.h>

Public Member Functions

void Initialize ()
 
 RelocationProcessor (const PEFFormat &pef_format, std::vector< RelocOpcode > &reloc_opcodes, std::map< uint32_t, Relocation > &relocations)
 
void Advance (uint32_t offset)
 
void AddRelocation (Relocation relocation)
 
void AddSection (uint32_t section_number)
 
void AddSectionC ()
 
void AddSectionD ()
 
void AddSymbol ()
 
void Regress (uint32_t block_count)
 Step back this amount of 16-bit halfwords in the instruction stream.
 
void Repeat (uint32_t block_count, uint32_t repeat_count)
 Repeat a previous sequence of instructions.
 
void GenerateRelocations ()
 

Public Attributes

const PEFFormatpef_format
 
size_t reloc_instr_ptr = 0
 
uint32_t reloc_address = 0
 
uint32_t import_index = 0
 
uint32_t section_c = 0
 
uint32_t section_d = 0
 
uint32_t current_repeat_count = 0
 
std::vector< RelocOpcode > & reloc_opcodes
 
std::map< uint32_t, Relocation > & relocations
 

Detailed Description

A representation of a state machine that generates the actual relocations using the relocation data in a file.

PEF files contain a sequence of instructions that express state changes to be applied to an internal "pseudo-microprocessor". This class can interpret these instructions and convert them to symbol relocations. The behavior is modelled on the description in Inside Macintosh: Mac OS Runtime Architectures, except no actual memory addresses are used, since this is not intended to be used as a loader. Addresses are instead replaced by section and symbol indices.

Member Function Documentation

◆ Repeat()

void Apple::PEFFormat::RelocationProcessor::Repeat ( uint32_t  block_count,
uint32_t  repeat_count 
)
inline

Repeat a previous sequence of instructions.

This function is intended to be called repeatedly each time the sequence of instructions is executed. The processor keeps track of how many times the repetition has taken place and stops iterating once the internal count reaches zero.

Parameters
[in]block_countThe number of 16-bit halfwords consisting of the block (not counting the repetition instruction). Note that some instructions have a length of 32 bits, which means block_count has to count them as 2.
[in]repeat_countThe number of times the block needs to be repeated. This does not include the initial repetition.

The documentation for this class was generated from the following files: