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
FieldsModifier and TypeFieldDescriptionprotected final AddressFactoryprotected InstructionBlockprotected final Disassemblerprotected final Languageprotected Stringprotected intprotected final PcodeExecutorState<?> -
Constructor Summary
ConstructorsConstructorDescriptionSleighInstructionDecoder(Language language, PcodeExecutorState<?> state) Construct a Sleigh instruction decoder -
Method Summary
Modifier and TypeMethodDescriptionvoidInform the decoder that the emulator thread just branchedprotected intCompute 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 language for this decoderGet the last instruction decodedintGet the length of the last decoded instruction, including delay slotsprotected voidparseNewBlock(Address address, RegisterValue context) protected booleanuseCachedInstruction(Address address, RegisterValue context)
-
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
-
getLanguage
Description copied from interface:InstructionDecoderGet the language for this decoder- Specified by:
getLanguagein interfaceInstructionDecoder- Returns:
- the language
-
useCachedInstruction
-
parseNewBlock
-
decodeInstruction
Description copied from interface:InstructionDecoderDecode 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:
decodeInstructionin interfaceInstructionDecoder- Parameters:
address- the address to start decodingcontext- the disassembler/decode context- Returns:
- the instruction
-
branched
Description copied from interface:InstructionDecoderInform the decoder that the emulator thread just branched- Specified by:
branchedin 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:InstructionDecoderGet the length of the last decoded instruction, including delay slots- Specified by:
getLastLengthWithDelaysin interfaceInstructionDecoder- Returns:
- the length
-
getLastInstruction
Description copied from interface:InstructionDecoderGet the last instruction decoded- Specified by:
getLastInstructionin interfaceInstructionDecoder- Returns:
- the instruction
-