Class encapsulating the action/behavior of specific pcode opcodes.
More...
#include <opbehavior.hh>
Inherited by OpBehaviorBoolAnd, OpBehaviorBoolNegate, OpBehaviorBoolOr, OpBehaviorBoolXor, OpBehaviorCopy, OpBehaviorEqual, OpBehaviorFloatAbs, OpBehaviorFloatAdd, OpBehaviorFloatCeil, OpBehaviorFloatDiv, OpBehaviorFloatEqual, OpBehaviorFloatFloat2Float, OpBehaviorFloatFloor, OpBehaviorFloatInt2Float, OpBehaviorFloatLess, OpBehaviorFloatLessEqual, OpBehaviorFloatMult, OpBehaviorFloatNan, OpBehaviorFloatNeg, OpBehaviorFloatNotEqual, OpBehaviorFloatRound, OpBehaviorFloatSqrt, OpBehaviorFloatSub, OpBehaviorFloatTrunc, OpBehaviorInt2Comp, OpBehaviorIntAdd, OpBehaviorIntAnd, OpBehaviorIntCarry, OpBehaviorIntDiv, OpBehaviorIntLeft, OpBehaviorIntLess, OpBehaviorIntLessEqual, OpBehaviorIntMult, OpBehaviorIntNegate, OpBehaviorIntOr, OpBehaviorIntRem, OpBehaviorIntRight, OpBehaviorIntSborrow, OpBehaviorIntScarry, OpBehaviorIntSdiv, OpBehaviorIntSext, OpBehaviorIntSless, OpBehaviorIntSlessEqual, OpBehaviorIntSrem, OpBehaviorIntSright, OpBehaviorIntSub, OpBehaviorIntXor, OpBehaviorIntZext, OpBehaviorNotEqual, OpBehaviorPiece, OpBehaviorPopcount, and OpBehaviorSubpiece.
|
| OpBehavior (OpCode opc, bool isun) |
| A behavior constructor. More...
|
|
| OpBehavior (OpCode opc, bool isun, bool isspec) |
| A special behavior constructor. More...
|
|
OpCode | getOpcode (void) const |
| Get the opcode for this pcode operation. More...
|
|
bool | isSpecial (void) const |
| Check if this is a special operator. More...
|
|
bool | isUnary (void) const |
| Check if operator is unary. More...
|
|
virtual uintb | evaluateUnary (int4 sizeout, int4 sizein, uintb in1) const |
| Emulate the unary op-code on an input value. More...
|
|
virtual uintb | evaluateBinary (int4 sizeout, int4 sizein, uintb in1, uintb in2) const |
| Emulate the binary op-code on input values. More...
|
|
virtual uintb | recoverInputBinary (int4 slot, int4 sizeout, uintb out, int4 sizein, uintb in) const |
| Reverse the binary op-code operation, recovering an input value. More...
|
|
virtual uintb | recoverInputUnary (int4 sizeout, uintb out, int4 sizein) const |
| Reverse the unary op-code operation, recovering the input value. More...
|
|
Class encapsulating the action/behavior of specific pcode opcodes.
At the lowest level, a pcode op is one of a small set of opcodes that operate on varnodes (address space, offset, size). Classes derived from this base class encapsulate this basic behavior for each possible opcode. These classes describe the most basic behaviors and include:
- uintb evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb int2)
- uintb evaluateUnary(int4 sizeout,int4 sizein,uintb in1)
- uintb recoverInputBinary(int4 slot,int4 sizeout,uintb out,int4 sizein,uintb in)
- uintb recoverInputUnary(int4 sizeout,uintb out,int4 sizein)
◆ OpBehavior() [1/2]
OpBehavior::OpBehavior |
( |
OpCode |
opc, |
|
|
bool |
isun |
|
) |
| |
|
inline |
A behavior constructor.
This kind of OpBehavior is associated with a particular opcode and is either unary or binary
- Parameters
-
opc | is the opcode of the behavior |
isun | is true if the behavior is unary, false if binary |
◆ OpBehavior() [2/2]
OpBehavior::OpBehavior |
( |
OpCode |
opc, |
|
|
bool |
isun, |
|
|
bool |
isspec |
|
) |
| |
|
inline |
A special behavior constructor.
This kind of OpBehavior can be set to special, if it neither unary or binary.
- Parameters
-
opc | is the opcode of the behavior |
isun | is true if the behavior is unary |
isspec | is true if the behavior is neither unary or binary |
◆ evaluateBinary()
uintb OpBehavior::evaluateBinary |
( |
int4 |
sizeout, |
|
|
int4 |
sizein, |
|
|
uintb |
in1, |
|
|
uintb |
in2 |
|
) |
| const |
|
virtual |
Emulate the binary op-code on input values.
- Parameters
-
sizeout | is the size of the output in bytes |
sizein | is the size of the inputs in bytes |
in1 | is the first input value |
in2 | is the second input value |
- Returns
- the output value
Reimplemented in OpBehaviorSubpiece, OpBehaviorPiece, OpBehaviorFloatSub, OpBehaviorFloatMult, OpBehaviorFloatDiv, OpBehaviorFloatAdd, OpBehaviorFloatLessEqual, OpBehaviorFloatLess, OpBehaviorFloatNotEqual, OpBehaviorFloatEqual, OpBehaviorBoolOr, OpBehaviorBoolAnd, OpBehaviorBoolXor, OpBehaviorIntSrem, OpBehaviorIntRem, OpBehaviorIntSdiv, OpBehaviorIntDiv, OpBehaviorIntMult, OpBehaviorIntSright, OpBehaviorIntRight, OpBehaviorIntLeft, OpBehaviorIntOr, OpBehaviorIntAnd, OpBehaviorIntXor, OpBehaviorIntSborrow, OpBehaviorIntScarry, OpBehaviorIntCarry, OpBehaviorIntSub, OpBehaviorIntAdd, OpBehaviorIntLessEqual, OpBehaviorIntLess, OpBehaviorIntSlessEqual, OpBehaviorIntSless, OpBehaviorNotEqual, and OpBehaviorEqual.
◆ evaluateUnary()
uintb OpBehavior::evaluateUnary |
( |
int4 |
sizeout, |
|
|
int4 |
sizein, |
|
|
uintb |
in1 |
|
) |
| const |
|
virtual |
Emulate the unary op-code on an input value.
- Parameters
-
sizeout | is the size of the output in bytes |
sizein | is the size of the input in bytes |
in1 | is the input value |
- Returns
- the output value
Reimplemented in OpBehaviorPopcount, OpBehaviorFloatRound, OpBehaviorFloatFloor, OpBehaviorFloatCeil, OpBehaviorFloatTrunc, OpBehaviorFloatFloat2Float, OpBehaviorFloatInt2Float, OpBehaviorFloatSqrt, OpBehaviorFloatAbs, OpBehaviorFloatNeg, OpBehaviorFloatNan, OpBehaviorBoolNegate, OpBehaviorIntNegate, OpBehaviorInt2Comp, OpBehaviorIntSext, OpBehaviorIntZext, and OpBehaviorCopy.
◆ getOpcode()
OpCode OpBehavior::getOpcode |
( |
void |
| ) |
const |
|
inline |
Get the opcode for this pcode operation.
There is an internal enumeration value for each type of pcode operation. This routine returns that value.
- Returns
- the opcode value
◆ isSpecial()
bool OpBehavior::isSpecial |
( |
void |
| ) |
const |
|
inline |
Check if this is a special operator.
If this function returns false, the operation is a normal unary or binary operation which can be evaluated calling evaluateBinary() or evaluateUnary(). Otherwise, the operation requires special handling to emulate properly
◆ isUnary()
bool OpBehavior::isUnary |
( |
void |
| ) |
const |
|
inline |
Check if operator is unary.
The operated can either be evaluated as unary or binary
- Returns
- true if the operator is unary
◆ recoverInputBinary()
uintb OpBehavior::recoverInputBinary |
( |
int4 |
slot, |
|
|
int4 |
sizeout, |
|
|
uintb |
out, |
|
|
int4 |
sizein, |
|
|
uintb |
in |
|
) |
| const |
|
virtual |
Reverse the binary op-code operation, recovering an input value.
If the output value and one of the input values is known, recover the value of the other input.
- Parameters
-
slot | is the input slot to recover |
sizeout | is the size of the output in bytes |
out | is the output value |
sizein | is the size of the inputs in bytes |
in | is the known input value |
- Returns
- the input value corresponding to the slot
Reimplemented in OpBehaviorIntSright, OpBehaviorIntRight, OpBehaviorIntLeft, OpBehaviorIntSub, and OpBehaviorIntAdd.
◆ recoverInputUnary()
uintb OpBehavior::recoverInputUnary |
( |
int4 |
sizeout, |
|
|
uintb |
out, |
|
|
int4 |
sizein |
|
) |
| const |
|
virtual |
Reverse the unary op-code operation, recovering the input value.
If the output value is known, recover the input value.
- Parameters
-
sizeout | is the size of the output in bytes |
out | is the output value |
sizein | is the size of the input in bytes |
- Returns
- the input value
Reimplemented in OpBehaviorIntSext, OpBehaviorIntZext, and OpBehaviorCopy.
◆ registerInstructions()
void OpBehavior::registerInstructions |
( |
vector< OpBehavior * > & |
inst, |
|
|
const Translate * |
trans |
|
) |
| |
|
static |
Build all pcode behaviors.
This routine generates a vector of OpBehavior objects indexed by opcode
- Parameters
-
inst | is the vector of behaviors to be filled |
trans | is the translator object needed by the floating point behaviors |
The documentation for this class was generated from the following files: