Package ghidra.pcode.emu
Class SleighInstructionDecoder
java.lang.Object
ghidra.pcode.emu.SleighInstructionDecoder
- All Implemented Interfaces:
InstructionDecoder
The default instruction decoder, based on Sleigh
This simply uses a Disassembler
on the machine's memory state.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final AddressFactory
protected InstructionBlock
protected final Disassembler
protected final Language
protected String
protected int
protected final PcodeExecutorState
<?> -
Constructor Summary
ConstructorDescriptionSleighInstructionDecoder
(Language language, PcodeExecutorState<?> state) Construct a Sleigh instruction decoder -
Method Summary
Modifier and TypeMethodDescriptionvoid
Inform the decoder that the emulator thread just branchedprotected int
Compute the "length" of an instruction, including any delay-slotted instructions that followdecodeInstruction
(Address address, RegisterValue context) Decode the instruction starting at the given address using the given contextGet the last instruction decodedint
Get the length of the last decoded instruction, including delay slots
-
Field Details
-
language
-
state
-
addrFactory
-
disassembler
-
lastMsg
-
block
-
lengthWithDelays
protected int lengthWithDelays
-
-
Constructor Details
-
SleighInstructionDecoder
Construct a Sleigh instruction decoder- Parameters:
language
- the language to decoderstate
- 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.- See Also:
-
-
Method Details
-
decodeInstruction
Description copied from interface:InstructionDecoder
Decode the instruction starting at the given address using the given contextThis method cannot return null. If a decode error occurs, it must throw an exception.
- Specified by:
decodeInstruction
in interfaceInstructionDecoder
- Parameters:
address
- the address to start decodingcontext
- the disassembler/decode context- Returns:
- the instruction
-
branched
Description copied from interface:InstructionDecoder
Inform the decoder that the emulator thread just branched- Specified by:
branched
in interfaceInstructionDecoder
- Parameters:
address
-
-
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 interfaceInstructionDecoder
- Returns:
- the length
-
getLastInstruction
Description copied from interface:InstructionDecoder
Get the last instruction decoded- Specified by:
getLastInstruction
in interfaceInstructionDecoder
- Returns:
- the instruction
-