Class Relocation

java.lang.Object
ghidra.app.util.bin.format.pef.Relocation
All Implemented Interfaces:
StructConverter
Direct Known Subclasses:
RelocByIndexGroup, RelocBySectDWithSkip, RelocIncrPosition, RelocLgByImport, RelocLgRepeat, RelocLgSetOrBySection, RelocSetPosition, RelocSmRepeat, RelocUndefinedOpcode, RelocValueGroup

public abstract class Relocation extends Object implements StructConverter
The high-order 7 bits for the currently defined relocation opcode values. Binary values indicated by "x" are "don't care" operands. For example, any combination of the high-order 7 bits that starts with two zero bits (00) indicates the RelocBySectDWithSkip instruction. Relocation instructions are stored in 2-byte relocation blocks. Most instructions take up one block that combines an opcode and related arguments. Instructions that are larger than 2 bytes have an opcode and some of the operands in the first 2-byte block, with other operands in the following 2-byte blocks. The opcode occupies the upper (higher-order) bits of the block that contains it. Relocation instructions can be decoded from the high-order 7 bits of their first block. All currently defined relocation instructions relocate locations as words (that is, 4-byte values).
  • Field Details

    • opcode

      protected int opcode
  • Constructor Details

    • Relocation

      public Relocation()
  • Method Details

    • isMatch

      public abstract boolean isMatch()
    • apply

      public abstract void apply(ImportStateCache importState, RelocationState relocState, ContainerHeader header, Program program, MessageLog log, TaskMonitor monitor)
    • getOpcode

      public int getOpcode()
    • getSizeInBytes

      public int getSizeInBytes()
    • getRepeatCount

      public int getRepeatCount()
    • getRepeatChunks

      public int getRepeatChunks()
    • toDataType

      public DataType toDataType() throws DuplicateNameException, IOException
      Description copied from interface: StructConverter
      Returns a structure datatype representing the contents of the implementor of this interface.

      For example, given:

       class A {
           int foo;
           double bar;
       }
       

      The return value should be a structure data type with two data type components; an INT and a DOUBLE. The structure should contain field names and, if possible, field comments.

      Specified by:
      toDataType in interface StructConverter
      Returns:
      returns a structure datatype representing the implementor of this interface
      Throws:
      DuplicateNameException - when a datatype of the same name already exists
      IOException
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object