Package ghidra.pcode.eval
Class ArithmeticVarnodeEvaluator<T>
java.lang.Object
ghidra.pcode.eval.AbstractVarnodeEvaluator<T>
ghidra.pcode.eval.ArithmeticVarnodeEvaluator<T>
- Type Parameters:
T- the type of values resulting from evaluation
- All Implemented Interfaces:
VarnodeEvaluator<T>
An abstract implementation of
VarnodeEvaluator that evaluates ops using a bound
PcodeArithmetic.-
Constructor Summary
ConstructorsConstructorDescriptionArithmeticVarnodeEvaluator(PcodeArithmetic<T> arithmetic) Construct an evaluator -
Method Summary
Modifier and TypeMethodDescriptionprotected TConcatenate the given valuesstatic <T> Tcatenate(PcodeArithmetic<T> arithmetic, int sizeTotal, T upper, T lower, int sizeLower) A convenience for concatenating two varnodesprotected TevaluateAbstract(Program program, AddressSpace space, T offset, int size, Map<Varnode, T> already) Evaluate a variable whose offset is of typeAbstractVarnodeEvaluatorprotected TevaluateBinaryOp(Program program, PcodeOp op, BinaryOpBehavior binOp, Map<Varnode, T> already) Evaluate a binary opprotected TevaluateConstant(long value, int size) Evaluate a constantprotected TEvaluate aPcodeOp.LOADopprotected TEvaluate aPcodeOp.PTRADDopprotected TEvaluate aPcodeOp.PTRSUBopevaluateStorage(Program program, VariableStorage storage) Evaluate variable storageprotected TevaluateUnaryOp(Program program, PcodeOp op, UnaryOpBehavior unOp, Map<Varnode, T> already) Evaluate a unary opMethods inherited from class ghidra.pcode.eval.AbstractVarnodeEvaluator
applyBase, badOp, doEvaluateVarnode, evaluateBranch, evaluateLeaf, evaluateMemory, evaluateOp, evaluateOp, evaluateRegister, evaluateStack, evaluateStorage, evaluateUnique, evaluateVarnode, evaluateVarnode, getIntConst, isLeaf, translateMemory
-
Constructor Details
-
ArithmeticVarnodeEvaluator
Construct an evaluator- Parameters:
arithmetic- the arithmetic for computing p-code op outputs
-
-
Method Details
-
catenate
public static <T> T catenate(PcodeArithmetic<T> arithmetic, int sizeTotal, T upper, T lower, int sizeLower) A convenience for concatenating two varnodesThere is no p-code op for catenation, but it is easily achieved as one might do in C or SLEIGH:
shiftthe left piece thenorit with the right piece.- Type Parameters:
T- the type of values- Parameters:
arithmetic- the p-code arithmetic for values of typeTsizeTotal- the expected output size in bytesupper- the value of the left (more significant) piecelower- the value of the right (less significant) piecesizeLower- the size of the lower piece- Returns:
- the result of concatenation
-
catenate
Description copied from class:AbstractVarnodeEvaluatorConcatenate the given values- Specified by:
catenatein classAbstractVarnodeEvaluator<T>- Parameters:
sizeTotal- the expected output size in bytesupper- the value of the left (more significant) piecelower- the value of the right (less significant) piecesizeLower- the size of the lower piece- Returns:
- the result of concatenation
-
evaluateStorage
Description copied from interface:VarnodeEvaluatorEvaluate variable storageEach varnode is evaluated as in
VarnodeEvaluator.evaluateStorage(Program, VariableStorage)and then concatenated. The lower-indexed varnodes in storage are the more significant pieces, similar to big endian.- Parameters:
program- the program containing the variable storagestorage- the storage- Returns:
- the value of the storage
-
evaluateConstant
Description copied from class:AbstractVarnodeEvaluatorEvaluate a constant- Specified by:
evaluateConstantin classAbstractVarnodeEvaluator<T>- Parameters:
value- the constant valuesize- the size of the value in bytes- Returns:
- the value as a
AbstractVarnodeEvaluator
-
evaluateAbstract
protected T evaluateAbstract(Program program, AddressSpace space, T offset, int size, Map<Varnode, T> already) Description copied from class:AbstractVarnodeEvaluatorEvaluate a variable whose offset is of typeAbstractVarnodeEvaluatorThe three parameters
space,offset, andsizeimitate the varnode triple, except that the offset is abstract. This is typically invoked for aPcodeOp.LOAD, i.e., a dereference.- Specified by:
evaluateAbstractin classAbstractVarnodeEvaluator<T>- Parameters:
program- the program defining the static contextspace- the address space of the variableoffset- the offset of the variablesize- the size of the variable in bytesalready- a cache of already-evaluated varnodes and their values- Returns:
- the value
-
evaluateUnaryOp
protected T evaluateUnaryOp(Program program, PcodeOp op, UnaryOpBehavior unOp, Map<Varnode, T> already) Description copied from class:AbstractVarnodeEvaluatorEvaluate a unary opThis evaluates the input varnode then computes the output value.
- Specified by:
evaluateUnaryOpin classAbstractVarnodeEvaluator<T>- Parameters:
program- the program defining the static contextop- the op whose output to evaluateunOp- the concrete behavior of the opalready- a cache of already-evaluated varnodes and their values- Returns:
- the output value
-
evaluateBinaryOp
protected T evaluateBinaryOp(Program program, PcodeOp op, BinaryOpBehavior binOp, Map<Varnode, T> already) Description copied from class:AbstractVarnodeEvaluatorEvaluate a binary opThis evaluates the input varnodes then computes the output value.
- Specified by:
evaluateBinaryOpin classAbstractVarnodeEvaluator<T>- Parameters:
program- the program defining the static contextop- the op whose output to evaluatebinOp- the concrete behavior of the opalready- a cache of already-evaluated varnodes and their values- Returns:
- the output value
-
evaluatePtrAdd
Description copied from class:AbstractVarnodeEvaluatorEvaluate aPcodeOp.PTRADDop- Specified by:
evaluatePtrAddin classAbstractVarnodeEvaluator<T>- Parameters:
program- the program defining the static contextop- the op whose output to evaluatealready- a cache of already-evaluated varnodes and their values- Returns:
- the output value
-
evaluatePtrSub
Description copied from class:AbstractVarnodeEvaluatorEvaluate aPcodeOp.PTRSUBop- Specified by:
evaluatePtrSubin classAbstractVarnodeEvaluator<T>- Parameters:
program- the program defining the static contextop- the op whose output to evaluatealready- a cache of already-evaluated varnodes and their values- Returns:
- the output value
-
evaluateLoad
Description copied from class:AbstractVarnodeEvaluatorEvaluate aPcodeOp.LOADop- Specified by:
evaluateLoadin classAbstractVarnodeEvaluator<T>- Parameters:
program- the program defining the static contextop- the op whose output to evaluatealready- a cache of already-evaluated varnodes and their values- Returns:
- the output value
-