Package ghidra.program.model.lang
Class InvalidPrototype
java.lang.Object
ghidra.program.model.lang.InvalidPrototype
- All Implemented Interfaces:
InstructionPrototype,ParserContext
Class to represent an invalid instruction prototype.
-
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) If the indicated operand is an address, this gets the address value for that operandintintgetDelaySlotDepth(InstructionContext context) Get the number of delay slot instructions for this argument.getFallThrough(InstructionContext context) Get the Address for default flow after instruction.intgetFallThroughOffset(InstructionContext context) Get the byte offset to the default flow after instruction.Address[]getFlows(InstructionContext context) Get an array of Address objects for all flows other than a fall-through, null if no flows.getFlowType(InstructionContext context) Get the flow type of this instruction.Object[]getInputObjects(InstructionContext context) Get the Result objects produced/affected by this instruction These would probably only be Register or AddressGet a Mask that describe which bits of this instruction determine the opcode.Get processor language module associated with this prototype.intGet the length of this CodeProtoype.getMnemonic(InstructionContext context) Get the mnemonic for this CodeProtype.intReturn the number of operands in this instruction.getOperandRefType(int opIndex, InstructionContext context, PcodeOverride override) Get the suggested operand reference type.getOperandValueMask(int operandIndex) Get a Mask that describe which bits of this instruction determine the operand value.Object[]getOpObjects(int opIndex, InstructionContext context) Get objects used by this operand (Address, Scalar, Register ...)getOpRepresentation(int opIndex, MemBuffer buf, ProcessorContextView context, String label) getOpRepresentationList(int opIndex, InstructionContext context) Get a List of Objects that can be used to render an operands representation.intgetOpType(int opIndex, InstructionContext context) Get the type of a specific operand.getParserContext(MemBuffer buf, ProcessorContextView processorContext) Get a new instance of a ParserContext.PcodeOp[]getPcode(InstructionContext context, int opIndex) Get an array of PCode operations (micro code) that a particular operand performs to compute its value.PcodeOp[]getPcode(InstructionContext context, PcodeOverride override) Get an array of PCode operations (micro code) that this instruction performs.voidgetPcodePacked(PatchEncoder encoder, InstructionContext context, PcodeOverride override) Same as getPcode but emits the operations directly to an encoder to optimize transfer to other processesgetPseudoParserContext(Address addr, MemBuffer buffer, ProcessorContextView processorContext) Get a ParserContext by parsing bytes outside of the normal disassembly processgetRegister(int opIndex, InstructionContext context) If the indicated operand is a register, this gets the register value for that operandObject[]getResultObjects(InstructionContext context) Get the Result objects produced/affected by this instruction These would probably only be Register or AddressgetScalar(int opIndex, InstructionContext context) If the indicated operand is a scalar, this gets the scalar value for that operandgetSeparator(int opIndex) Get the separator strings between an operand.booleanbooleanbooleanhasDelimeter(int opIndex) Return true if the operand at opIndex should have a delimiter following it.booleanReturn 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()- Specified by:
hasDelaySlotsin interfaceInstructionPrototype- Returns:
- true if instruction prototype expects one or more delay slotted instructions to exist.
-
hasCrossBuildDependency
public boolean hasCrossBuildDependency()- Specified by:
hasCrossBuildDependencyin interfaceInstructionPrototype- Returns:
- true if instruction semantics have a CrossBuild instruction dependency which may require a robust InstructionContext with access to preceding instructions
-
getInstructionMask
Description copied from interface:InstructionPrototypeGet a Mask that describe which bits of this instruction determine the opcode.- Specified by:
getInstructionMaskin interfaceInstructionPrototype- Returns:
- a Mask for the opcode bits or null if unknown.
-
getOperandValueMask
Description copied from interface:InstructionPrototypeGet a Mask that describe which bits of this instruction determine the operand value.- Specified by:
getOperandValueMaskin interfaceInstructionPrototype- Returns:
- a Mask for the operand bits or null if unknown.
-
getFlowType
Description copied from interface:InstructionPrototypeGet the flow type of this instruction. Used for analysis purposes. i.e., how this instruction flows to the next instruction.- Specified by:
getFlowTypein interfaceInstructionPrototype- Parameters:
context- the instruction context- Returns:
- flow type.
-
getDelaySlotDepth
Description copied from interface:InstructionPrototypeGet the number of delay slot instructions for this argument. 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 for this instruction.
-
isInDelaySlot
public boolean isInDelaySlot()Description copied from interface:InstructionPrototypeReturn true if this prototype was disassembled in a delay slot.- Specified by:
isInDelaySlotin interfaceInstructionPrototype
-
getNumOperands
public int getNumOperands()Description copied from interface:InstructionPrototypeReturn the number of operands in this instruction.- Specified by:
getNumOperandsin interfaceInstructionPrototype
-
getOpType
Description copied from interface:InstructionPrototypeGet the type of a specific operand.- Specified by:
getOpTypein interfaceInstructionPrototype- Parameters:
opIndex- the index of the operand. (zero based)context- the instruction context.- Returns:
- the type of the operand.
-
getFallThrough
Description copied from interface:InstructionPrototypeGet the Address for default flow after instruction.- Specified by:
getFallThroughin interfaceInstructionPrototype- Parameters:
context- the instruction context- Returns:
- Address of fall through flow or null if flow does not fall through this instruction.
-
getFallThroughOffset
Description copied from interface:InstructionPrototypeGet the byte offset to the default flow after instruction. If this instruction does not have a fall-through due to flow behavior, this method will still return an offset which accounts for the instruction length including delay slotted instructions if applicable.- Specified by:
getFallThroughOffsetin interfaceInstructionPrototype- Parameters:
context- the instruction context- Returns:
- int how much to add to the current address to get the fall through address.
-
getFlows
Description copied from interface:InstructionPrototypeGet an array of Address objects for all flows other than a fall-through, null if no flows.- Specified by:
getFlowsin interfaceInstructionPrototype- Parameters:
context- the instruction context.- Returns:
- an array of Address objects for all flows other than a fall-through, null if no flows.
-
getOpRepresentation
public String getOpRepresentation(int opIndex, MemBuffer buf, ProcessorContextView context, String label) -
getOpRepresentationList
Description copied from interface:InstructionPrototypeGet a List of Objects that can be used to render an operands representation.- Specified by:
getOpRepresentationListin interfaceInstructionPrototype- Parameters:
opIndex- operand to get the Representation Listcontext- the instruction context- Returns:
- ArrayList of Register, Address, Scalar, VariableOffset and Character objects of null if the operation isn't supported
-
getAddress
Description copied from interface:InstructionPrototypeIf the indicated operand is an address, this gets the address value for that operand- Specified by:
getAddressin interfaceInstructionPrototype- Parameters:
opIndex- index of the operand.context- the instruction context.- Returns:
- the address indicated by the operand
-
getScalar
Description copied from interface:InstructionPrototypeIf the indicated operand is a scalar, this gets the scalar value for that operand- Specified by:
getScalarin interfaceInstructionPrototype- Parameters:
opIndex- index of the operand.context- the instruction context- Returns:
- the scalar for the indicated operand
-
getRegister
Description copied from interface:InstructionPrototypeIf the indicated operand is a register, this gets the register value for that operand- Specified by:
getRegisterin interfaceInstructionPrototype- Parameters:
opIndex- index of the operand.context- the instruction context- Returns:
- a register description for the indicated operand
-
getOpObjects
Description copied from interface:InstructionPrototypeGet objects used by this operand (Address, Scalar, Register ...)- Specified by:
getOpObjectsin interfaceInstructionPrototype- Parameters:
opIndex- the index of the operand. (zero based)context- the instruction context- Returns:
- an array of objects found at this operand.
-
hasDelimeter
public boolean hasDelimeter(int opIndex) Description copied from interface:InstructionPrototypeReturn true if the operand at opIndex should have a delimiter following it.- Specified by:
hasDelimeterin interfaceInstructionPrototype- Parameters:
opIndex- the index of the operand to test for having a delimiter.
-
getInputObjects
Description copied from interface:InstructionPrototypeGet the Result objects produced/affected by this instruction These would probably only be Register or Address- Specified by:
getInputObjectsin interfaceInstructionPrototype- Parameters:
context- the instruction context- Returns:
- an array of objects that are used by this instruction
-
getResultObjects
Description copied from interface:InstructionPrototypeGet the Result objects produced/affected by this instruction These would probably only be Register or Address- Specified by:
getResultObjectsin interfaceInstructionPrototype- Parameters:
context- the instruction context- Returns:
- an array of objects that are affected by this instruction
-
getPcode
Description copied from interface:InstructionPrototypeGet an array of PCode operations (micro code) that this instruction performs.- Specified by:
getPcodein interfaceInstructionPrototype- Parameters:
context- the instruction contextoverride- if not null, may indicate that different elements of the pcode generation are overridden- Returns:
- array of PCODE, zero length array if language doesn't support PCODE for this instruction
-
getPcodePacked
public void getPcodePacked(PatchEncoder encoder, InstructionContext context, PcodeOverride override) throws IOException Description copied from interface:InstructionPrototypeSame as getPcode 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:InstructionPrototypeGet an array of PCode operations (micro code) that a particular operand performs to compute its value.- Specified by:
getPcodein interfaceInstructionPrototype- Parameters:
context- the instruction contextopIndex- the index of the operand for which to get PCode.- Returns:
- array of PCODE, zero length array if language doesn't support PCODE for this instruction
-
getMnemonic
Description copied from interface:InstructionPrototypeGet the mnemonic for this CodeProtype. Examples: "MOV" and "CALL" for instructions and "DB" and "DA" for data.- Specified by:
getMnemonicin interfaceInstructionPrototype- Parameters:
context- the instruction context- Returns:
- the mnemonic for this CodePrototype.
-
getLength
public int getLength()Description copied from interface:InstructionPrototypeGet the length of this CodeProtoype.- Specified by:
getLengthin interfaceInstructionPrototype- Returns:
- the length of this CodeProtoype.
-
getSeparator
Description copied from interface:InstructionPrototypeGet the separator strings between an operand. The separator string for 0 are the characters before the first operand. The separator string for numOperands+1 are the characters after the last operand.- Specified by:
getSeparatorin interfaceInstructionPrototype- Parameters:
opIndex- valid values are 0 thru numOperands+1- Returns:
- separator string, or null if there is no string
-
getOperandRefType
Description copied from interface:InstructionPrototypeGet the suggested operand reference type.- Specified by:
getOperandRefTypein interfaceInstructionPrototype- Parameters:
opIndex- the index of the operand. (zero based)context- the instruction contextoverride- if not null, steers local overrides of pcode generation- Returns:
- reference type.
-
getLanguage
Description copied from interface:InstructionPrototypeGet processor language module associated with this prototype.- Specified by:
getLanguagein interfaceInstructionPrototype- Returns:
- language module
-
getParserContext
public ParserContext getParserContext(MemBuffer buf, ProcessorContextView processorContext) throws MemoryAccessException Description copied from interface:InstructionPrototypeGet a new instance of a ParserContext.- Specified by:
getParserContextin interfaceInstructionPrototype- Parameters:
buf-processorContext-- Returns:
- instruction ParserContext
- Throws:
MemoryAccessException
-
getPrototype
- Specified by:
getPrototypein interfaceParserContext
-
getDelaySlotByteCount
public int getDelaySlotByteCount()- 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:InstructionPrototypeGet a ParserContext by parsing bytes outside of the normal disassembly process- Specified by:
getPseudoParserContextin interfaceInstructionPrototype- Parameters:
addr- where the ParserContext is neededbuffer- of actual bytesprocessorContext-- Returns:
- Throws:
InsufficientBytesExceptionUnknownInstructionExceptionUnknownContextExceptionMemoryAccessException
-