Class SleighInstructionDecoder

java.lang.Object
ghidra.pcode.emu.SleighInstructionDecoder
All Implemented Interfaces:
InstructionDecoder

public class SleighInstructionDecoder extends Object implements InstructionDecoder
The default instruction decoder, based on Sleigh

This simply uses a Disassembler on the machine's memory state.

  • Field Details

  • Constructor Details

    • SleighInstructionDecoder

      public SleighInstructionDecoder(Language language, PcodeExecutorState<?> state)
      Construct a Sleigh instruction decoder
      Parameters:
      language - the language to decoder
      state - the state containing the target program, probably the shared state of the p-code machine. It must be possible to obtain concrete buffers on this state.
  • Method Details

    • decodeInstruction

      public Instruction decodeInstruction(Address address, RegisterValue context)
      Description copied from interface: InstructionDecoder
      Decode the instruction starting at the given address using the given context

      This method cannot return null. If a decode error occurs, it must throw an exception.

      Specified by:
      decodeInstruction in interface InstructionDecoder
      Parameters:
      address - the address to start decoding
      context - the disassembler/decode context
      Returns:
      the instruction
    • branched

      public void branched(Address address)
      Description copied from interface: InstructionDecoder
      Inform the decoder that the emulator thread just branched
      Specified by:
      branched in interface InstructionDecoder
    • computeLength

      protected int computeLength()
      Compute the "length" of an instruction, including any delay-slotted instructions that follow
      Returns:
      the length
    • getLastLengthWithDelays

      public int getLastLengthWithDelays()
      Description copied from interface: InstructionDecoder
      Get the length of the last decoded instruction, including delay slots
      Specified by:
      getLastLengthWithDelays in interface InstructionDecoder
      Returns:
      the length
    • getLastInstruction

      public Instruction getLastInstruction()
      Description copied from interface: InstructionDecoder
      Get the last instruction decoded
      Specified by:
      getLastInstruction in interface InstructionDecoder
      Returns:
      the instruction