Class InvalidPrototype
- All Implemented Interfaces:
InstructionPrototype,ParserContext
-
Field Summary
Fields inherited from interface ghidra.program.model.lang.InstructionPrototype
INVALID_DEPTH_CHANGE -
Constructor Summary
ConstructorsConstructorDescriptionInvalidPrototype(Language lang) Construct a new invalid instruction prototype. -
Method Summary
Modifier and TypeMethodDescriptiongetAddress(int opIndex, InstructionContext context) intReturns the number of delay-slot instruction bytes which correspond to this prototype.intgetDelaySlotDepth(InstructionContext context) Returns the number of delay slot instructions following this instruction.getFallThrough(InstructionContext context) Returns theAddressfor fall-through flow after this instruction, or null if flow cannot fall through this instruction.intgetFallThroughOffset(InstructionContext context) Returns the byte offset to the fall-through flow after this instruction.Address[]getFlows(InstructionContext context) Returns theAddresses for all flows other than a fall-through, or null if no flows.getFlowType(InstructionContext context) Returns the flow type of this instruction.Object[]getInputObjects(InstructionContext context) Returns the objects used as input by this instruction.Returns theMaskthat describe which bits of this instruction determine the opcode, or null if unknown.Returns the processor language module associated with this prototype.intReturns the length in bytes of this prototype.getMnemonic(InstructionContext context) Returns the mnemonic for this prototype.intReturns the number of operands in this instruction.getOperandRefType(int opIndex, InstructionContext context, PcodeOverride override) Returns the suggested reference type for a specific operand.getOperandValueMask(int operandIndex) Returns theMaskthat describe which bits of this instruction determine a specific operand's value, or null if unknown.Object[]getOpObjects(int opIndex, InstructionContext context) Returns the objects used by a specific operand.getOpRepresentation(int opIndex, MemBuffer buf, ProcessorContextView context, String label) getOpRepresentationList(int opIndex, InstructionContext context) Returns a the objects for rendering an operand's representation.intgetOpType(int opIndex, InstructionContext context) Returns the type of a specific operand.getParserContext(MemBuffer buf, ProcessorContextView processorContext) Returns a new instance of an instructionParserContext.PcodeOp[]getPcode(InstructionContext context, int opIndex) Returns the p-code operations (micro code) that perform the computation of a particular operand's value.PcodeOp[]getPcode(InstructionContext context, PcodeOverride override) Returns the p-code operations (micro code) that this instruction performs.voidgetPcodePacked(PatchEncoder encoder, InstructionContext context, PcodeOverride override) Does the same asInstructionPrototype.getPcode(InstructionContext, PcodeOverride)but emits the operations directly to an encoder to optimize transfer to other processes}getPseudoParserContext(Address addr, MemBuffer buffer, ProcessorContextView processorContext) Returns a ParserContext by parsing bytes outside of the normal disassembly process.getRegister(int opIndex, InstructionContext context) Object[]getResultObjects(InstructionContext context) Returns the objects affected by this instruction.getScalar(int opIndex, InstructionContext context) getSeparator(int opIndex) Returns the separator string before a specific operand, or null.booleanReturns true if instruction semantics have acrossbuildinstruction dependency which may require a robustInstructionContextwith access to preceding instructions.booleanReturns true if instruction prototype expects one or more delay slotted instructions to exist.booleanhasDelimeter(int opIndex) Returns true if a specific operand ought to have a delimiter following it.booleanReturns true if instruction semantics contain a reference toinst_next2.booleanReturns true if this prototype was disassembled in a delay slot.
-
Constructor Details
-
InvalidPrototype
Construct a new invalid instruction prototype.- Parameters:
lang- is the Language for which the invalid instruction is discovered
-
-
Method Details
-
hasDelaySlots
public boolean hasDelaySlots()Description copied from interface:InstructionPrototypeReturns true if instruction prototype expects one or more delay slotted instructions to exist.- Specified by:
hasDelaySlotsin interfaceInstructionPrototype- Returns:
- true if instruction prototype expects one or more delay slotted instructions to exist
-
hasCrossBuildDependency
public boolean hasCrossBuildDependency()Description copied from interface:InstructionPrototypeReturns true if instruction semantics have acrossbuildinstruction dependency which may require a robustInstructionContextwith access to preceding instructions.- Specified by:
hasCrossBuildDependencyin interfaceInstructionPrototype- Returns:
- true if instruction semantics have a
crossbuildinstruction dependency which may require a robustInstructionContextwith access to preceding instructions
-
hasNext2Dependency
public boolean hasNext2Dependency()Description copied from interface:InstructionPrototypeReturns true if instruction semantics contain a reference toinst_next2..- Specified by:
hasNext2Dependencyin interfaceInstructionPrototype- Returns:
- true if instruction semantics contain a reference to
inst_next2
-
getInstructionMask
Description copied from interface:InstructionPrototypeReturns theMaskthat describe which bits of this instruction determine the opcode, or null if unknown.- Specified by:
getInstructionMaskin interfaceInstructionPrototype- Returns:
- the
Maskthat describe which bits of this instruction determine the opcode, or null if unknown
-
getOperandValueMask
Description copied from interface:InstructionPrototypeReturns theMaskthat describe which bits of this instruction determine a specific operand's value, or null if unknown.- Specified by:
getOperandValueMaskin interfaceInstructionPrototype- Parameters:
operandIndex- the 0-up index of the operand- Returns:
- the
Maskthat describe which bits of this instruction determine a specific operand's value, or null if unknown
-
getFlowType
Description copied from interface:InstructionPrototypeReturns the flow type of this instruction.This is used for analysis purposes. i.e., how this instruction flows to the next instruction.
- Specified by:
getFlowTypein interfaceInstructionPrototype- Parameters:
context- the instruction context- Returns:
- the flow type of this instruction
-
getDelaySlotDepth
Description copied from interface:InstructionPrototypeReturns the number of delay slot instructions following this instruction.This should be 0 for instructions which don't have a delay slot. This is used to support the delay slots found on some RISC processors such as SPARC and the PA-RISC. This returns an integer instead of a boolean in case some other processor executes more than one instruction from a delay slot.
- Specified by:
getDelaySlotDepthin interfaceInstructionPrototype- Parameters:
context- the instruction context- Returns:
- the number of delay slot instructions following this instruction
-
isInDelaySlot
public boolean isInDelaySlot()Description copied from interface:InstructionPrototypeReturns true if this prototype was disassembled in a delay slot.- Specified by:
isInDelaySlotin interfaceInstructionPrototype- Returns:
- true if this prototype was disassembled in a delay slot
-
getNumOperands
public int getNumOperands()Description copied from interface:InstructionPrototypeReturns the number of operands in this instruction.- Specified by:
getNumOperandsin interfaceInstructionPrototype- Returns:
- the number of operands in this instruction
-
getOpType
Description copied from interface:InstructionPrototypeReturns the type of a specific operand.- Specified by:
getOpTypein interfaceInstructionPrototype- Parameters:
opIndex- the 0-up index of the operandcontext- the instruction context.- Returns:
- the type of a specific operand
-
getFallThrough
Description copied from interface:InstructionPrototypeReturns theAddressfor fall-through flow after this instruction, or null if flow cannot fall through this instruction.- Specified by:
getFallThroughin interfaceInstructionPrototype- Parameters:
context- the instruction context- Returns:
- the
Addressfor fall-through flow after this instruction, or null if flow cannot fall through this instruction
-
getFallThroughOffset
Description copied from interface:InstructionPrototypeReturns the byte offset to the fall-through flow after this instruction.Ordinarily, this is just the length (in bytes) of this instruction. However, if this instruction has delay-slotted instruction(s), their lengths are included. Even if flow cannot fall through this instruction, this method will still return a the fall-through offset.
- Specified by:
getFallThroughOffsetin interfaceInstructionPrototype- Parameters:
context- the instruction context- Returns:
- the byte offset to the fall-through flow after this instruction
-
getFlows
Description copied from interface:InstructionPrototypeReturns theAddresses for all flows other than a fall-through, or null if no flows.A null return is equivalent to an empty array. Note the result may include
Address.NO_ADDRESSto indicate flow to an address that could not be evaluated, e.g., toinst_next2when the skipped instruction could not be parsed.- Specified by:
getFlowsin interfaceInstructionPrototype- Parameters:
context- the instruction context.- Returns:
- the
Addresses for all flows other than a fall-through, or null if no flows
-
getOpRepresentation
public String getOpRepresentation(int opIndex, MemBuffer buf, ProcessorContextView context, String label) -
getOpRepresentationList
Description copied from interface:InstructionPrototypeReturns a the objects for rendering an operand's representation.Each element is one of
Address,Register,Scalar,VariableOffset,Character, or null. This method may also return null (as in no list at all) if the operation is not supported. Nulls should be rendered as empty strings.- Specified by:
getOpRepresentationListin interfaceInstructionPrototype- Parameters:
opIndex- the 0-up index of the operandcontext- the instruction context- Returns:
- a the objects for rendering an operand's representation
-
getAddress
Description copied from interface:InstructionPrototype- Specified by:
getAddressin interfaceInstructionPrototype- Parameters:
opIndex- the 0-up index of the operandcontext- the instruction context.- Returns:
- the
Addressvalue of a specific operand, or null if its value is not anAddress
-
getScalar
Description copied from interface:InstructionPrototype- Specified by:
getScalarin interfaceInstructionPrototype- Parameters:
opIndex- the 0-up index of the operandcontext- the instruction context- Returns:
- the
Scalarvalue of a specific operand, or null if its value is not anScalar
-
getRegister
Description copied from interface:InstructionPrototype- Specified by:
getRegisterin interfaceInstructionPrototype- Parameters:
opIndex- the 0-up index of the operandcontext- the instruction context- Returns:
- the
Registervalue of a specific operand, or null if its value is not anRegister
-
getOpObjects
Description copied from interface:InstructionPrototypeReturns the objects used by a specific operand.Each element is one of
Address,Register,Scalar, orVariableOffset.- Specified by:
getOpObjectsin interfaceInstructionPrototype- Parameters:
opIndex- the 0-up index of the operandcontext- the instruction context- Returns:
- the objects used by a specific operand
-
hasDelimeter
public boolean hasDelimeter(int opIndex) Description copied from interface:InstructionPrototypeReturns true if a specific operand ought to have a delimiter following it.- Specified by:
hasDelimeterin interfaceInstructionPrototype- Parameters:
opIndex- the 0-up index of the operand- Returns:
- true if a specific operand ought to have a delimiter following it
-
getInputObjects
Description copied from interface:InstructionPrototypeReturns the objects used as input by this instruction.Each element should probably only be one of
AddressorRegister.- Specified by:
getInputObjectsin interfaceInstructionPrototype- Parameters:
context- the instruction context- Returns:
- the objects used as input by this instruction
-
getResultObjects
Description copied from interface:InstructionPrototypeReturns the objects affected by this instruction.Each element should probably only be one of
AddressorRegister.- Specified by:
getResultObjectsin interfaceInstructionPrototype- Parameters:
context- the instruction context- Returns:
- the objects affected by this instruction
-
getPcode
Description copied from interface:InstructionPrototypeReturns the p-code operations (micro code) that this instruction performs.This will return an empty array if the language does not support p-code for this instruction.
- Specified by:
getPcodein interfaceInstructionPrototype- Parameters:
context- the instruction contextoverride- if not null, may indicate that different elements of the pcode generation are overridden- Returns:
- the p-code operations (micro code) that this instruction performs
-
getPcodePacked
public void getPcodePacked(PatchEncoder encoder, InstructionContext context, PcodeOverride override) throws IOException Description copied from interface:InstructionPrototypeDoes the same asInstructionPrototype.getPcode(InstructionContext, PcodeOverride)but emits the operations directly to an encoder to optimize transfer to other processes}- Specified by:
getPcodePackedin interfaceInstructionPrototype- Parameters:
encoder- is the encoder receiving the operationscontext- the instruction contextoverride- if not null, may indicate that different elements of the pcode generation are overridden- Throws:
IOException- for errors writing to any stream underlying the encoder
-
getPcode
Description copied from interface:InstructionPrototypeReturns the p-code operations (micro code) that perform the computation of a particular operand's value.- Specified by:
getPcodein interfaceInstructionPrototype- Parameters:
context- the instruction contextopIndex- the 0-up index of the operand- Returns:
- the p-code operations (micro code) that perform the computation of a particular operand's value
-
getMnemonic
Description copied from interface:InstructionPrototypeReturns the mnemonic for this prototype.Examples: "
MOV" and "CALL"- Specified by:
getMnemonicin interfaceInstructionPrototype- Parameters:
context- the instruction context- Returns:
- the mnemonic for this prototype
-
getLength
public int getLength()Description copied from interface:InstructionPrototypeReturns the length in bytes of this prototype.- Specified by:
getLengthin interfaceInstructionPrototype- Returns:
- the length in bytes of this prototype
-
getSeparator
Description copied from interface:InstructionPrototypeReturns the separator string before a specific operand, or null.In particular, the separator string for operand 0 are the characters before the first operand. The separator string for
numOperandsare the characters after the last operand. A null return value is equivalent to an empty string.- Specified by:
getSeparatorin interfaceInstructionPrototype- Parameters:
opIndex- valid values are 0 thrunumOperands, inclusive- Returns:
- the separator string before a specific operand, or null
-
getOperandRefType
Description copied from interface:InstructionPrototypeReturns the suggested reference type for a specific operand.- Specified by:
getOperandRefTypein interfaceInstructionPrototype- Parameters:
opIndex- the 0-up index of the operandcontext- the instruction contextoverride- if not null, steers local overrides of p-code generation- Returns:
- the suggested reference type for a specific operand
-
getLanguage
Description copied from interface:InstructionPrototypeReturns the processor language module associated with this prototype.- Specified by:
getLanguagein interfaceInstructionPrototype- Returns:
- the processor language module associated with this prototype
-
getParserContext
public ParserContext getParserContext(MemBuffer buf, ProcessorContextView processorContext) throws MemoryAccessException Description copied from interface:InstructionPrototypeReturns a new instance of an instructionParserContext.- Specified by:
getParserContextin interfaceInstructionPrototype- Parameters:
buf- the memory from which this prototype was parsed, or an equivalent cacheprocessorContext- the (incoming) processor context during parse- Returns:
- a new instance of an instruction
ParserContext - Throws:
MemoryAccessException- if the memory buffer cannot be accessed
-
getPrototype
- Specified by:
getPrototypein interfaceParserContext
-
getDelaySlotByteCount
public int getDelaySlotByteCount()Description copied from interface:InstructionPrototypeReturns the number of delay-slot instruction bytes which correspond to this prototype.- Specified by:
getDelaySlotByteCountin interfaceInstructionPrototype- Returns:
- the number of delay-slot instruction bytes which correspond to this prototype
-
getPseudoParserContext
public ParserContext getPseudoParserContext(Address addr, MemBuffer buffer, ProcessorContextView processorContext) throws InsufficientBytesException, UnknownInstructionException, UnknownContextException, MemoryAccessException Description copied from interface:InstructionPrototypeReturns a ParserContext by parsing bytes outside of the normal disassembly process.- Specified by:
getPseudoParserContextin interfaceInstructionPrototype- Parameters:
addr- where the ParserContext is needed, i.e., the first address of an instruction to be parsedbuffer- of actual bytesprocessorContext- the (incoming) processor context- Returns:
- a ParserContext by parsing bytes outside of the normal disassembly process
- Throws:
InsufficientBytesException- if not enough bytes are in the bufferUnknownInstructionException- if the bytes do not constitute a valid instructionUnknownContextException- if contextual dependencies, e.g.crossbuildinstructions, are not availableMemoryAccessException- if the memory buffer cannot be accessed
-