Interface ICodeResolver<InsnType extends IInstruction>
public interface ICodeResolver<InsnType extends IInstruction>
A resolver attempts to determine the actual value of symbols and items used by instruction
artifacts. They can be: branch targets, register values, operand values, flags and other
processor state data, etc.
-
Method Summary
Modifier and TypeMethodDescriptiondetermineNextAddress
(IMachineContext context, InsnType instruction) Determine the next value of the program counter (PC).determineOperandValue
(IMachineContext context, InsnType instruction, int index) Determine the actual values of an instruction operand.
-
Method Details
-
determineNextAddress
ICodePointer determineNextAddress(IMachineContext context, InsnType instruction) throws ProcessorException Determine the next value of the program counter (PC). Note that the instruction is provided optionally (the context has enough data to parse the instruction at the current PC); however, in practice, the instruction at PC has very likely been decoded already, and is provided by the caller. In such a case, the implementor is free to check the consistency between the provided instruction and the context (eg, performing a basic byte match). AnIllegalArgumentException
can be raised if a mismatch is detected.- Parameters:
context
- mandatory contextinstruction
- optional instruction- Returns:
- the next address as well as any possible relevant information about the processor state when that next address is executed (eg, processor mode change)
- Throws:
ProcessorException
- if the value cannot be determined
-
determineOperandValue
IResolvedOperandValue determineOperandValue(IMachineContext context, InsnType instruction, int index) throws ProcessorException Determine the actual values of an instruction operand. Note that the instruction is provided optionally (the context has enough data to parse the instruction at the current PC); however, in practice, the instruction at PC has very likely been decoded already, and is provided by the caller. In such a case, the implementor is free to check the consistency between the provided instruction and the context (eg, performing a basic byte match). AnIllegalArgumentException
can be raised if a mismatch is detected.- Parameters:
context
- mandatory contextinstruction
- optional instructionindex
- the operand index- Returns:
- the operand value
- Throws:
ProcessorException
- if a value cannot be determined
-