Class TokenFieldSolver
java.lang.Object
ghidra.app.plugin.assembler.sleigh.expr.AbstractExpressionSolver<TokenField>
ghidra.app.plugin.assembler.sleigh.expr.TokenFieldSolver
Solves expressions of a token (instruction encoding) field
Essentially, this just encodes the goal into the field, if it can be represented in the given space and format. Otherwise, there is no solution.
-
Field Summary
Fields inherited from class ghidra.app.plugin.assembler.sleigh.expr.AbstractExpressionSolver
dbg, solver -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintDetermines the length of the subconstructor that would be returned had the expression not depended on an undefined symbol.getValue(TokenField tf, Map<String, Long> vals, AssemblyResolvedPatterns cur) Attempt to get a constant value for the expressionsolve(AbstractAssemblyResolutionFactory<?, ?> factory, TokenField tf, MaskedLong goal, Map<String, Long> vals, AssemblyResolvedPatterns cur, Set<SolverHint> hints, String description) Attempt to solve an expression for a given valuevalueForResolution(TokenField tf, Map<String, Long> vals, AssemblyResolvedPatterns rc) Compute the value of the expression given the (possibly-intermediate) resolutionMethods inherited from class ghidra.app.plugin.assembler.sleigh.expr.AbstractExpressionSolver
register
-
Constructor Details
-
TokenFieldSolver
public TokenFieldSolver()
-
-
Method Details
-
solve
public AssemblyResolution solve(AbstractAssemblyResolutionFactory<?, ?> factory, TokenField tf, MaskedLong goal, Map<String, Long> vals, AssemblyResolvedPatterns cur, Set<SolverHint> hints, String description) Description copied from class:AbstractExpressionSolverAttempt to solve an expression for a given value- Specified by:
solvein classAbstractExpressionSolver<TokenField>- Parameters:
tf- the expression to solvegoal- the desired value of the expressionvals- values of defined symbolshints- describes techniques applied by calling solversdescription- the description to give to resolved solutions- Returns:
- the resolution
-
getValue
Description copied from class:AbstractExpressionSolverAttempt to get a constant value for the expression- Specified by:
getValuein classAbstractExpressionSolver<TokenField>- Parameters:
tf- the expressionvals- values of defined symbols- Returns:
- the constant value, or null if it depends on a variable
-
getInstructionLength
Description copied from class:AbstractExpressionSolverDetermines the length of the subconstructor that would be returned had the expression not depended on an undefined symbol.This is used by the backfilling process to ensure values are written to the correct offset
- Specified by:
getInstructionLengthin classAbstractExpressionSolver<TokenField>- Parameters:
tf- the expression- Returns:
- the length of filled in token field(s).
-
valueForResolution
public MaskedLong valueForResolution(TokenField tf, Map<String, Long> vals, AssemblyResolvedPatterns rc) Description copied from class:AbstractExpressionSolverCompute the value of the expression given the (possibly-intermediate) resolution- Specified by:
valueForResolutionin classAbstractExpressionSolver<TokenField>- Parameters:
tf- the expression to evaluatevals- values of defined symbolsrc- the resolution on which to evaluate it- Returns:
- the result
-