Interface InstructionPrototype
- All Known Implementing Classes:
InvalidPrototype,SleighInstructionPrototype
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intSentinel value to indicate an invalid depth change -
Method Summary
Modifier and TypeMethodDescriptiongetAddress(int operandIndex, 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 operandIndex, 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 operandIndex, InstructionContext context) Returns the objects used by a specific operand.getOpRepresentationList(int operandIndex, InstructionContext context) Returns a the objects for rendering an operand's representation.intgetOpType(int operandIndex, 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 operandIndex) 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 asgetPcode(InstructionContext, PcodeOverride)but emits the operations directly to an encoder to optimize transfer to other processes}getPseudoParserContext(Address address, MemBuffer buffer, ProcessorContextView processorContext) Returns a ParserContext by parsing bytes outside of the normal disassembly process.getRegister(int operandIndex, InstructionContext context) Object[]getResultObjects(InstructionContext context) Returns the objects affected by this instruction.getScalar(int operandIndex, InstructionContext context) getSeparator(int operandIndex) 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 operandIndex) 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.
-
Field Details
-
INVALID_DEPTH_CHANGE
static final int INVALID_DEPTH_CHANGESentinel value to indicate an invalid depth change- See Also:
-
-
Method Details
-
getParserContext
ParserContext getParserContext(MemBuffer buf, ProcessorContextView processorContext) throws MemoryAccessException Returns a new instance of an instructionParserContext.- 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
-
getPseudoParserContext
ParserContext getPseudoParserContext(Address address, MemBuffer buffer, ProcessorContextView processorContext) throws InsufficientBytesException, UnknownInstructionException, UnknownContextException, MemoryAccessException Returns a ParserContext by parsing bytes outside of the normal disassembly process.- Parameters:
address- 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
-
hasDelaySlots
boolean hasDelaySlots()Returns true if instruction prototype expects one or more delay slotted instructions to exist.- Returns:
- true if instruction prototype expects one or more delay slotted instructions to exist
-
hasCrossBuildDependency
boolean hasCrossBuildDependency()Returns true if instruction semantics have acrossbuildinstruction dependency which may require a robustInstructionContextwith access to preceding instructions.- Returns:
- true if instruction semantics have a
crossbuildinstruction dependency which may require a robustInstructionContextwith access to preceding instructions
-
hasNext2Dependency
boolean hasNext2Dependency()Returns true if instruction semantics contain a reference toinst_next2..- Returns:
- true if instruction semantics contain a reference to
inst_next2
-
getMnemonic
Returns the mnemonic for this prototype.Examples: "
MOV" and "CALL"- Parameters:
context- the instruction context- Returns:
- the mnemonic for this prototype
-
getLength
int getLength()Returns the length in bytes of this prototype.- Returns:
- the length in bytes of this prototype
-
getInstructionMask
Mask getInstructionMask()Returns theMaskthat describe which bits of this instruction determine the opcode, or null if unknown.- Returns:
- the
Maskthat describe which bits of this instruction determine the opcode, or null if unknown
-
getOperandValueMask
Returns theMaskthat describe which bits of this instruction determine a specific operand's value, or null if unknown.- 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
Returns the flow type of this instruction.This is used for analysis purposes. i.e., how this instruction flows to the next instruction.
- Parameters:
context- the instruction context- Returns:
- the flow type of this instruction
-
getDelaySlotDepth
Returns 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.
- Parameters:
context- the instruction context- Returns:
- the number of delay slot instructions following this instruction
-
getDelaySlotByteCount
int getDelaySlotByteCount()Returns the number of delay-slot instruction bytes which correspond to this prototype.- Returns:
- the number of delay-slot instruction bytes which correspond to this prototype
-
isInDelaySlot
boolean isInDelaySlot()Returns true if this prototype was disassembled in a delay slot.- Returns:
- true if this prototype was disassembled in a delay slot
-
getNumOperands
int getNumOperands()Returns the number of operands in this instruction.- Returns:
- the number of operands in this instruction
-
getOpType
Returns the type of a specific operand.- Parameters:
operandIndex- the 0-up index of the operandcontext- the instruction context.- Returns:
- the type of a specific operand
-
getFallThrough
Returns theAddressfor fall-through flow after this instruction, or null if flow cannot fall through this instruction.- Parameters:
context- the instruction context- Returns:
- the
Addressfor fall-through flow after this instruction, or null if flow cannot fall through this instruction
-
getFallThroughOffset
Returns 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.
- Parameters:
context- the instruction context- Returns:
- the byte offset to the fall-through flow after this instruction
-
getFlows
Returns 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.- Parameters:
context- the instruction context.- Returns:
- the
Addresses for all flows other than a fall-through, or null if no flows
-
getSeparator
Returns 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.- Parameters:
operandIndex- valid values are 0 thrunumOperands, inclusive- Returns:
- the separator string before a specific operand, or null
-
getOpRepresentationList
Returns 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.- Parameters:
operandIndex- the 0-up index of the operandcontext- the instruction context- Returns:
- a the objects for rendering an operand's representation
-
getAddress
-
getRegister
-
getScalar
-
getOpObjects
Returns the objects used by a specific operand.Each element is one of
Address,Register,Scalar, orVariableOffset.- Parameters:
operandIndex- the 0-up index of the operandcontext- the instruction context- Returns:
- the objects used by a specific operand
-
getOperandRefType
Returns the suggested reference type for a specific operand.- Parameters:
operandIndex- 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
-
hasDelimeter
boolean hasDelimeter(int operandIndex) Returns true if a specific operand ought to have a delimiter following it.- Parameters:
operandIndex- the 0-up index of the operand- Returns:
- true if a specific operand ought to have a delimiter following it
-
getInputObjects
Returns the objects used as input by this instruction.Each element should probably only be one of
AddressorRegister.- Parameters:
context- the instruction context- Returns:
- the objects used as input by this instruction
-
getResultObjects
Returns the objects affected by this instruction.Each element should probably only be one of
AddressorRegister.- Parameters:
context- the instruction context- Returns:
- the objects affected by this instruction
-
getPcode
Returns 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.
- 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
void getPcodePacked(PatchEncoder encoder, InstructionContext context, PcodeOverride override) throws IOException Does the same asgetPcode(InstructionContext, PcodeOverride)but emits the operations directly to an encoder to optimize transfer to other processes}- 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
Returns the p-code operations (micro code) that perform the computation of a particular operand's value.- Parameters:
context- the instruction contextoperandIndex- the 0-up index of the operand- Returns:
- the p-code operations (micro code) that perform the computation of a particular operand's value
-
getLanguage
Language getLanguage()Returns the processor language module associated with this prototype.- Returns:
- the processor language module associated with this prototype
-