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

Stores a 68K jump table, found in 'CODE'0 resources. More...

#include <macos.h>

Inheritance diagram for Apple::MacintoshResourceFileFormat::JumpTableCodeResource:
Apple::MacintoshResourceFileFormat::Resource Linker::Format Linker::Contents

Public Types

enum  JumpTableFormat {
  Near , Far , CFM_68K , CFM_68K_StartUp ,
  CFM_68K_Library , CFM_68K_Unflattened_Library
}
 
enum  {
  MOVE_DATA_SP = 0x3F3C , LOADSEG = 0xA9F0 , JMP_ABS_L = 0x4EF9 , FAR_VERSION_MARK = 0xFFFF ,
  CFM_68K_VERSION_MARK = 0xFFFD
}
 
enum  jump_table_parse_mode { FromUnknown , FromResource , FromPEFContainer }
 Describes how a jump table should be handled. More...
 

Public Member Functions

 JumpTableCodeResource (std::shared_ptr< JumpTable > jump_table)
 
bool IsResource () const
 
void CalculateValues () override
 
offset_t JumpTableSize () const
 
offset_t ImageSize () const override
 Retrieves the offset of the byte after the last one belonging to this format from the first one.
 
void ReadFile (const std::shared_ptr< Linker::Reader > &rd) override
 Loads file into memory.
 
void ReadFile (const std::shared_ptr< Linker::Reader > &rd, offset_t length) override
 
void ReadJumpTable (const std::shared_ptr< Linker::Reader > &rd, offset_t length, jump_table_parse_mode mode, std::map< offset_t, offset_t > section_relocations={})
 Read full jump table.
 
void CollectRelocations (std::map< offset_t, offset_t > &section_relocations)
 Generate the section relocations in a PEF container data section.
 
offset_t WriteFile (const std::shared_ptr< Linker::Writer > &wr) const override
 Stores data in memory to file.
 
int GetDisplayOptions () const override
 
void Dump (Dumper::Dumper &dump, offset_t file_offset) const override
 
void AddFields (Dumper::Dumper &dump, Dumper::Region &region, offset_t file_offset) const override
 
std::unique_ptr< Dumper::Region > CreateRegion (std::string name, offset_t offset, offset_t length, unsigned display_width) const override
 
- Public Member Functions inherited from Apple::MacintoshResourceFileFormat::Resource
void Dump (Dumper::Dumper &dump) const override
 Display file contents in a nice manner.
 
virtual void EffectFormat (MacintoshResourceFileFormat &format, const std::shared_ptr< Linker::Reader > &rd)
 Apply some changes to the format after parsing.
 
- Public Member Functions inherited from Linker::Format
 Format (offset_t file_offset=0)
 
virtual void Clear ()
 Resets all fields to their default values, deallocate memory.
 
virtual void SetFileOffset (offset_t new_offset)
 Attempts to alter the offset to the first byte of the format from the beginning of the file.
 
- Public Member Functions inherited from Linker::Contents
virtual std::shared_ptr< const Image > AsImage () const
 Retrieves a randomly accessible image.
 
std::shared_ptr< Image > AsImage ()
 Retrieves a randomly accessible image.
 

Public Attributes

std::shared_ptr< JumpTable > jump_table
 
JumpTableFormat jump_table_format = Near
 
- Public Attributes inherited from Apple::MacintoshResourceFileFormat::Resource
char type [4]
 
uint16_t id
 
std::optional< std::string > name
 
uint8_t attributes
 
- Public Attributes inherited from Linker::Format
offset_t file_offset
 The offset of the first byte used by this format in the file it is stored in.
 

Additional Inherited Members

- Protected Member Functions inherited from Apple::MacintoshResourceFileFormat::Resource
 Resource (const char type[4], uint16_t id, uint8_t attributes=0)
 
 Resource (const char type[4], uint16_t id, std::optional< std::string > name, uint8_t attributes=0)
 

Detailed Description

Stores a 68K jump table, found in 'CODE'0 resources.

Member Enumeration Documentation

◆ jump_table_parse_mode

Describes how a jump table should be handled.

Enumerator
FromUnknown 

No information, try to make the best out of it (untested)

FromResource 

The jump table is found inside a 'CODE' resource.

FromPEFContainer 

The jump table is found inside a PEF container data section.

◆ JumpTableFormat

Enumerator
Near 

Near model jump table, with only near model format entries.

Far 

Far model jump table, with a single near model format entries and several far model format entries.

CFM_68K 

CFM-68K jump table as stored in the PEF container, with a single classic format entries and several regular format entries.

CFM_68K_StartUp 

CFM-68K startup jump table as stored in the 'CODE'0 resource, with a single classic format entry.

CFM_68K_Library 

CFM-68K shared library jump table as stored in the PEF container, with a single classic format entry.

           All jump table entries and transition vectors are stored in a flattened format
CFM_68K_Unflattened_Library 

CFM-68K shared library jump table as stored in the PEF container, with a single classic format entry.

           Jump table entries are stored in their segmented format, transition vectors are stored in an 8-byte unflattened format

Member Function Documentation

◆ AddFields()

void MacintoshResourceFileFormat::JumpTableCodeResource::AddFields ( Dumper::Dumper &  dump,
Dumper::Region &  region,
offset_t  file_offset 
) const
overridevirtual

◆ CalculateValues()

void MacintoshResourceFileFormat::JumpTableCodeResource::CalculateValues ( )
overridevirtual

◆ CreateRegion()

std::unique_ptr< Dumper::Region > MacintoshResourceFileFormat::JumpTableCodeResource::CreateRegion ( std::string  name,
offset_t  offset,
offset_t  length,
unsigned  display_width 
) const
overridevirtual

◆ Dump()

void MacintoshResourceFileFormat::JumpTableCodeResource::Dump ( Dumper::Dumper &  dump,
offset_t  file_offset 
) const
overridevirtual

◆ GetDisplayOptions()

int MacintoshResourceFileFormat::JumpTableCodeResource::GetDisplayOptions ( ) const
overridevirtual

◆ ImageSize()

offset_t MacintoshResourceFileFormat::JumpTableCodeResource::ImageSize ( ) const
overridevirtual

Retrieves the offset of the byte after the last one belonging to this format from the first one.

Returns
The size of the image, or offset_t(-1) if it cannot be determined before writing to the file

Implements Apple::MacintoshResourceFileFormat::Resource.

◆ ReadFile() [1/2]

void MacintoshResourceFileFormat::JumpTableCodeResource::ReadFile ( const std::shared_ptr< Linker::Reader > &  rd)
overridevirtual

Loads file into memory.

Implements Linker::Format.

◆ ReadFile() [2/2]

void MacintoshResourceFileFormat::JumpTableCodeResource::ReadFile ( const std::shared_ptr< Linker::Reader > &  rd,
offset_t  length 
)
overridevirtual

◆ ReadJumpTable()

void MacintoshResourceFileFormat::JumpTableCodeResource::ReadJumpTable ( const std::shared_ptr< Linker::Reader > &  rd,
offset_t  length,
jump_table_parse_mode  mode,
std::map< offset_t, offset_t >  section_relocations = {} 
)

Read full jump table.

When the jump table is found in a resource, this will also determine what format the jump table is in. For PEF containers, the format of the jump table must be assigned prior to calling this function.

Parameters
rdThe reader
lengthThe expected length of the jump table
modeWhether to parse it as a jump table found inside a 'CODE' resource or a PEF container data section
section_relocationsFor PEF container data, also check if there are section relocations at the specified offsets

◆ WriteFile()

offset_t MacintoshResourceFileFormat::JumpTableCodeResource::WriteFile ( const std::shared_ptr< Linker::Writer > &  wr) const
overridevirtual

Stores data in memory to file.

Implements Linker::Format.


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