Enum Class LocationPcodeArithmetic
- All Implemented Interfaces:
PcodeArithmetic<ValueLocation>
,Serializable
,Comparable<LocationPcodeArithmetic>
,Constable
This is intended for use as the right side of a PairedPcodeArithmetic
. Note that constant
and unique spaces are never returned. Furthermore, any computation performed on a value,
producing a temporary value, philosophically does not exist at any location in the state. Thus,
most operations in this arithmetic result in null
. The accompanying state piece
LocationPcodeExecutorStatePiece
generates the actual locations.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
Nested classes/interfaces inherited from interface ghidra.pcode.exec.PcodeArithmetic
PcodeArithmetic.Purpose
-
Enum Constant Summary
-
Field Summary
Fields inherited from interface ghidra.pcode.exec.PcodeArithmetic
SIZEOF_SIZEOF
-
Method Summary
Modifier and TypeMethodDescriptionbinaryOp
(int opcode, int sizeout, int sizein1, ValueLocation in1, int sizein2, ValueLocation in2) Apply a binary operator to the given inputsstatic LocationPcodeArithmetic
forEndian
(boolean bigEndian) fromConst
(byte[] value) Convert the given constant concrete value to typeT
having the same size.fromConst
(long value, int size) Convert the given constant concrete value to typeT
having the given size.fromConst
(BigInteger value, int size) Convert the given constant concrete value to typeT
having the given size.fromConst
(BigInteger value, int size, boolean isContextreg) Convert the given constant concrete value to typeT
having the given size.Get the endianness of this arithmeticmodAfterLoad
(int sizeout, int sizeinAddress, ValueLocation inAddress, int sizeinValue, ValueLocation inValue) Apply any modifications after a value is loadedmodBeforeStore
(int sizeout, int sizeinAddress, ValueLocation inAddress, int sizeinValue, ValueLocation inValue) Apply any modifications before a value is storedlong
sizeOf
(ValueLocation value) Get the size in bytes, if possible, of the given abstract valuebyte[]
toConcrete
(ValueLocation value, PcodeArithmetic.Purpose purpose) Convert, if possible, the given abstract value to a concrete byte arrayunaryOp
(int opcode, int sizeout, int sizein1, ValueLocation in1) Apply a unary operator to the given inputstatic LocationPcodeArithmetic
Returns the enum constant of this class with the specified name.static LocationPcodeArithmetic[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class java.lang.Enum
clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
Methods inherited from interface ghidra.pcode.exec.PcodeArithmetic
binaryOp, isTrue, ptrAdd, ptrSub, sizeOfAbstract, toBigInteger, toLong, unaryOp
-
Enum Constant Details
-
BIG_ENDIAN
-
LITTLE_ENDIAN
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
forEndian
-
getEndian
Description copied from interface:PcodeArithmetic
Get the endianness of this arithmeticOften T is a byte array, or at least represents one abstractly. Ideally, it is an array where each element is an abstraction of a byte. If that is the case, then the arithmetic likely has to interpret those bytes as integral values according to an endianness. This should return that endianness.
If the abstraction has no notion of endianness, return null. In that case, the both
PcodeArithmetic.fromConst(BigInteger, int, boolean)
andPcodeArithmetic.fromConst(long, int)
must be overridden. Furthermore, unlessPcodeArithmetic.toConcrete(Object, Purpose)
is guaranteed to throw an exception, thenPcodeArithmetic.toBigInteger(Object, Purpose)
andPcodeArithmetic.toLong(Object, Purpose)
must also be overridden.- Specified by:
getEndian
in interfacePcodeArithmetic<ValueLocation>
- Returns:
- the endianness or null
-
unaryOp
Description copied from interface:PcodeArithmetic
Apply a unary operator to the given inputNote the sizes of variables are given, because values don't necessarily have an intrinsic size. For example, a
BigInteger
may have a minimum encoding size, but that does not necessarily reflect the size of the variable from which is was read.- Specified by:
unaryOp
in interfacePcodeArithmetic<ValueLocation>
- Parameters:
opcode
- the p-code opcodesizeout
- the size (in bytes) of the output variablesizein1
- the size (in bytes) of the input variablein1
- the input value- Returns:
- the output value
-
binaryOp
public ValueLocation binaryOp(int opcode, int sizeout, int sizein1, ValueLocation in1, int sizein2, ValueLocation in2) Description copied from interface:PcodeArithmetic
Apply a binary operator to the given inputsNote the sizes of variables are given, because values don't necessarily have an intrinsic size. For example, a
BigInteger
may have a minimum encoding size, but that does not necessarily reflect the size of the variable from which is was read.- Specified by:
binaryOp
in interfacePcodeArithmetic<ValueLocation>
- Parameters:
opcode
- the operation's opcode. SeePcodeOp
.sizeout
- the size (in bytes) of the output variablesizein1
- the size (in bytes) of the first (left) input variablein1
- the first (left) input valuesizein2
- the size (in bytes) of the second (right) input variablein2
- the second (right) input value- Returns:
- the output value
-
modBeforeStore
public ValueLocation modBeforeStore(int sizeout, int sizeinAddress, ValueLocation inAddress, int sizeinValue, ValueLocation inValue) Description copied from interface:PcodeArithmetic
Apply any modifications before a value is storedThis implements any abstractions associated with
PcodeOp.STORE
. This is called on the address/offset and the value before the value is actually stored into the state.- Specified by:
modBeforeStore
in interfacePcodeArithmetic<ValueLocation>
- Parameters:
sizeout
- the size (in bytes) of the output variablesizeinAddress
- the size (in bytes) of the variable used for indirectioninAddress
- the value used as the address (or offset)sizeinValue
- the size (in bytes) of the variable to storeinValue
- the value to store- Returns:
- the modified value to store
-
modAfterLoad
public ValueLocation modAfterLoad(int sizeout, int sizeinAddress, ValueLocation inAddress, int sizeinValue, ValueLocation inValue) Description copied from interface:PcodeArithmetic
Apply any modifications after a value is loadedThis implements any abstractions associated with
PcodeOp.LOAD
. This is called on the address/offset and the value after the value is actually loaded from the state.- Specified by:
modAfterLoad
in interfacePcodeArithmetic<ValueLocation>
- Parameters:
sizeout
- the size (in bytes) of the output variablesizeinAddress
- the size (in bytes) of the variable used for indirectioninAddress
- the value used as the address (or offset)sizeinValue
- the size (in bytes) of the variable loadedinValue
- the value loaded- Returns:
- the modified value loaded
-
fromConst
Description copied from interface:PcodeArithmetic
Convert the given constant concrete value to typeT
having the same size.- Specified by:
fromConst
in interfacePcodeArithmetic<ValueLocation>
- Parameters:
value
- the constant value- Returns:
- the value as a
T
-
fromConst
Description copied from interface:PcodeArithmetic
Convert the given constant concrete value to typeT
having the given size.Note that the size may not be applicable to
T
. It is given to ensure the value can be held in a variable of that size when passed to downstream operators or stored in the executor state.- Specified by:
fromConst
in interfacePcodeArithmetic<ValueLocation>
- Parameters:
value
- the constant valuesize
- the size (in bytes) of the variable into which the value is to be storedisContextreg
- true to indicate the value is from the disassembly context register. IfT
represents bytes, and the value is the contextreg, then the bytes are in big endian, no matter the machine language's endianness.- Returns:
- the value as a
T
-
fromConst
Description copied from interface:PcodeArithmetic
Convert the given constant concrete value to typeT
having the given size.The value is assumed not to be for the disassembly context register.
- Specified by:
fromConst
in interfacePcodeArithmetic<ValueLocation>
- See Also:
-
fromConst
Description copied from interface:PcodeArithmetic
Convert the given constant concrete value to typeT
having the given size.Note that the size may not be applicable to
T
. It is given to ensure the value can be held in a variable of that size when passed to downstream operators or stored in the executor state.- Specified by:
fromConst
in interfacePcodeArithmetic<ValueLocation>
- Parameters:
value
- the constant valuesize
- the size (in bytes) of the variable into which the value is to be stored- Returns:
- the value as a
T
-
toConcrete
Description copied from interface:PcodeArithmetic
Convert, if possible, the given abstract value to a concrete byte array- Specified by:
toConcrete
in interfacePcodeArithmetic<ValueLocation>
- Parameters:
value
- the abstract valuepurpose
- the purpose for which the emulator needs a concrete value- Returns:
- the array
-
sizeOf
Description copied from interface:PcodeArithmetic
Get the size in bytes, if possible, of the given abstract valueIf the abstract value does not conceptually have a size, throw an exception.
- Specified by:
sizeOf
in interfacePcodeArithmetic<ValueLocation>
- Parameters:
value
- the abstract value- Returns:
- the size in bytes
-