#include <VirtualMachineSemantics.h>
Collaboration diagram for VirtualMachineSemantics::Policy< State, ValueType >:

Public Types | |
| MRT_STACK_PTR | |
| MRT_FRAME_PTR | |
| MRT_OTHER_PTR | |
| enum | MemRefType { MRT_STACK_PTR, MRT_FRAME_PTR, MRT_OTHER_PTR } |
| See memory_reference_type(). More... | |
Public Member Functions | |
| Policy () | |
| void | set_map (MemoryMap *map) |
| Set the memory map that holds known values for known memory addresses. | |
| size_t | get_ninsns () const |
| Returns the number of instructions processed. | |
| void | set_ninsns (size_t n) |
| Sets the number instructions processed. | |
| SgAsmInstruction * | get_insn () const |
| Returns current instruction. | |
| const State< ValueType > & | get_orig_state () const |
| Returns the original state. | |
| State< ValueType > & | get_orig_state () |
| const ValueType< 32 > & | get_ip () const |
| Returns the current instruction pointer. | |
| const ValueType< 32 > & | get_orig_ip () const |
| Returns the original instruction pointer. | |
| Memory | memory_for_equality (const State< ValueType > &) const |
| Returns a copy of the state after removing memory that is not pertinent to an equal_states() comparison. | |
| Memory | memory_for_equality () const |
| Returns a copy of the current state after removing memory that is not pertinent to an equal_states() comparison. | |
| bool | equal_states (const State< ValueType > &, const State< ValueType > &) const |
| Compares two states for equality. | |
| void | print (std::ostream &, RenameMap *rmap=NULL) const |
| Print the current state of this policy. | |
| bool | on_stack (const ValueType< 32 > &value) const |
| Returns true if the specified value exists in memory and is provably at or above the stack pointer. | |
| void | set_discard_popped_memory (bool b) |
| Changes how the policy treats the stack. | |
| bool | get_discard_popped_memory () const |
| Returns the current setting for the property that determines how the stack behaves. | |
| void | print_diff (std::ostream &, const State< ValueType > &, const State< ValueType > &, RenameMap *rmap=NULL) const |
| Print only the differences between two states. | |
| void | print_diff (std::ostream &o, const State< ValueType > &state, RenameMap *rmap=NULL) const |
| Print the difference between a state and the initial state. | |
| void | print_diff (std::ostream &o, RenameMap *rmap=NULL) const |
| Print the difference between the current state and the initial state. | |
| std::string | SHA1 () const |
| Returns the SHA1 hash of the difference between the current state and the original state. | |
| bool | SHA1 (unsigned char *digest) const |
| Obtains the binary SHA1 hash of the difference between the current state and the original state. | |
| template<size_t FromLen, size_t ToLen> | |
| ValueType< ToLen > | signExtend (const ValueType< FromLen > &a) const |
Sign extend from FromLen bits to ToLen bits. | |
| template<size_t BeginAt, size_t EndAt, size_t Len> | |
| ValueType< EndAt-BeginAt > | extract (const ValueType< Len > &a) const |
| Extracts certain bits from the specified value and shifts them to the low-order positions in the result. | |
| template<size_t FromLen, size_t ToLen> | |
| ValueType< ToLen > | unsignedExtend (const ValueType< FromLen > &a) const |
| Return a newly sized value by either truncating the most significant bits or by adding more most significant bits that are set to zeros. | |
| template<size_t Len> | |
| ValueType< Len > | mem_read (State< ValueType > &state, const ValueType< 32 > &addr) const |
| Reads a value from memory in a way that always returns the same value provided there are not intervening writes that would clobber the value either directly or by aliasing. | |
| MemRefType | memory_reference_type (const State< ValueType > &state, const ValueType< 32 > &addr) const |
| Determines if the specified address is related to the current stack or frame pointer. | |
| template<size_t Len> | |
| void | mem_write (State< ValueType > &state, const ValueType< 32 > &addr, const ValueType< Len > &data) |
| Writes a value to memory. | |
| const RegisterDictionary * | get_register_dictionary () const |
| Returns the register dictionary. | |
| void | set_register_dictionary (const RegisterDictionary *regdict) |
| Sets the register dictionary. | |
| void | startInstruction (SgAsmInstruction *insn) |
| void | finishInstruction (SgAsmInstruction *) |
| void | startBlock (rose_addr_t addr) |
| void | finishBlock (rose_addr_t addr) |
| ValueType< 1 > | true_ () const |
| True value. | |
| ValueType< 1 > | false_ () const |
| False value. | |
| ValueType< 1 > | undefined_ () const |
| Undefined Boolean. | |
| template<size_t Len> | |
| ValueType< Len > | number (uint64_t n) const |
| Used to build a known constant. | |
| ValueType< 32 > | filterCallTarget (const ValueType< 32 > &a) const |
| Called only for CALL instructions before assigning new value to IP register. | |
| ValueType< 32 > | filterReturnTarget (const ValueType< 32 > &a) const |
| Called only for RET instructions before adjusting the IP register. | |
| ValueType< 32 > | filterIndirectJumpTarget (const ValueType< 32 > &a) const |
| Called only for JMP instructions before adjusting the IP register. | |
| void | hlt () |
| Called only for the HLT instruction. | |
| void | cpuid () |
| Called only for the CPUID instruction. | |
| ValueType< 64 > | rdtsc () |
| Called only for the RDTSC instruction. | |
| void | interrupt (uint8_t num) |
| Called only for the INT instruction. | |
| void | sysenter () |
| Called only for the SYSENTER instruction. | |
| const RegisterDescriptor & | findRegister (const std::string ®name, size_t nbits=0) |
| Finds a register by name. | |
| template<size_t Len> | |
| ValueType< Len > | readRegister (const char *regname) |
| Reads from a named register. | |
| template<size_t Len> | |
| void | writeRegister (const char *regname, const ValueType< Len > &value) |
| Writes to a named register. | |
| template<size_t Len> | |
| ValueType< Len > | readRegister (const RegisterDescriptor ®) |
| Generic register read. | |
| template<size_t Len> | |
| void | writeRegister (const RegisterDescriptor ®, const ValueType< Len > &value) |
| Generic register write. | |
| template<size_t Len> | |
| ValueType< Len > | readMemory (X86SegmentRegister segreg, const ValueType< 32 > &addr, const ValueType< 1 > &cond) const |
| Reads a value from memory. | |
| template<size_t Len> | |
| void | writeMemory (X86SegmentRegister segreg, const ValueType< 32 > &addr, const ValueType< Len > &data, const ValueType< 1 > &cond) |
| Writes a value to memory. | |
| template<size_t Len> | |
| ValueType< Len > | add (const ValueType< Len > &a, const ValueType< Len > &b) const |
| Adds two values. | |
| template<size_t Len> | |
| ValueType< Len > | addWithCarries (const ValueType< Len > &a, const ValueType< Len > &b, const ValueType< 1 > &c, ValueType< Len > &carry_out) const |
| Add two values of equal size and a carry bit. | |
| template<size_t Len> | |
| ValueType< Len > | and_ (const ValueType< Len > &a, const ValueType< Len > &b) const |
| Computes bit-wise AND of two values. | |
| template<size_t Len> | |
| ValueType< 1 > | equalToZero (const ValueType< Len > &a) const |
| Returns true_, false_, or undefined_ depending on whether argument is zero. | |
| template<size_t Len> | |
| ValueType< Len > | invert (const ValueType< Len > &a) const |
| One's complement. | |
| template<size_t Len1, size_t Len2> | |
| ValueType< Len1+Len2 > | concat (const ValueType< Len1 > &a, const ValueType< Len2 > &b) const |
Concatenate the values of a and b so that the result has b in the high-order bits and a in the low order bits. | |
| template<size_t Len> | |
| ValueType< Len > | ite (const ValueType< 1 > &sel, const ValueType< Len > &ifTrue, const ValueType< Len > &ifFalse) const |
| Returns second or third arg depending on value of first arg. | |
| template<size_t Len> | |
| ValueType< Len > | leastSignificantSetBit (const ValueType< Len > &a) const |
| Returns position of least significant set bit; zero when no bits are set. | |
| template<size_t Len> | |
| ValueType< Len > | mostSignificantSetBit (const ValueType< Len > &a) const |
| Returns position of most significant set bit; zero when no bits are set. | |
| template<size_t Len> | |
| ValueType< Len > | negate (const ValueType< Len > &a) const |
| Two's complement. | |
| template<size_t Len> | |
| ValueType< Len > | or_ (const ValueType< Len > &a, const ValueType< Len > &b) const |
| Computes bit-wise OR of two values. | |
| template<size_t Len, size_t SALen> | |
| ValueType< Len > | rotateLeft (const ValueType< Len > &a, const ValueType< SALen > &sa) const |
| Rotate bits to the left. | |
| template<size_t Len, size_t SALen> | |
| ValueType< Len > | rotateRight (const ValueType< Len > &a, const ValueType< SALen > &sa) const |
| Rotate bits to the right. | |
| template<size_t Len, size_t SALen> | |
| ValueType< Len > | shiftLeft (const ValueType< Len > &a, const ValueType< SALen > &sa) const |
| Returns arg shifted left. | |
| template<size_t Len, size_t SALen> | |
| ValueType< Len > | shiftRight (const ValueType< Len > &a, const ValueType< SALen > &sa) const |
| Returns arg shifted right logically (no sign bit). | |
| template<size_t Len, size_t SALen> | |
| ValueType< Len > | shiftRightArithmetic (const ValueType< Len > &a, const ValueType< SALen > &sa) const |
| Returns arg shifted right arithmetically (with sign bit). | |
| template<size_t Len1, size_t Len2> | |
| ValueType< Len1 > | signedDivide (const ValueType< Len1 > &a, const ValueType< Len2 > &b) const |
| Divides two signed values. | |
| template<size_t Len1, size_t Len2> | |
| ValueType< Len2 > | signedModulo (const ValueType< Len1 > &a, const ValueType< Len2 > &b) const |
| Calculates modulo with signed values. | |
| template<size_t Len1, size_t Len2> | |
| ValueType< Len1+Len2 > | signedMultiply (const ValueType< Len1 > &a, const ValueType< Len2 > &b) const |
| Multiplies two signed values. | |
| template<size_t Len1, size_t Len2> | |
| ValueType< Len1 > | unsignedDivide (const ValueType< Len1 > &a, const ValueType< Len2 > &b) const |
| Divides two unsigned values. | |
| template<size_t Len1, size_t Len2> | |
| ValueType< Len2 > | unsignedModulo (const ValueType< Len1 > &a, const ValueType< Len2 > &b) const |
| Calculates modulo with unsigned values. | |
| template<size_t Len1, size_t Len2> | |
| ValueType< Len1+Len2 > | unsignedMultiply (const ValueType< Len1 > &a, const ValueType< Len2 > &b) const |
| Multiply two unsigned values. | |
| template<size_t Len> | |
| ValueType< Len > | xor_ (const ValueType< Len > &a, const ValueType< Len > &b) const |
| Computes bit-wise XOR of two values. | |
| const State< ValueType > & | get_state () const |
| Returns the current state. | |
| State< ValueType > & | get_state () |
| Returns the current state. | |
Protected Types | |
| typedef State< ValueType >::Memory | Memory |
Protected Attributes | |
| SgAsmInstruction * | cur_insn |
| Set by startInstruction(), cleared by finishInstruction(). | |
| State< ValueType > | orig_state |
| Original machine state, initialized by constructor and mem_write. | |
| State< ValueType > | cur_state |
| Current machine state updated by each processInstruction(). | |
| bool | p_discard_popped_memory |
| Property that determines how the stack behaves. | |
| size_t | ninsns |
| Total number of instructions processed. | |
| MemoryMap * | map |
| Initial known memory values for known addresses. | |
| const RegisterDictionary * | regdict |
| Registers stored in the various State objects for this Policy. | |
Friends | |
| std::ostream & | operator<< (std::ostream &o, const Policy &p) |
Classes | |
| struct | Exception |
typedef State<ValueType>::Memory VirtualMachineSemantics::Policy< State, ValueType >::Memory [protected] |
| enum VirtualMachineSemantics::Policy::MemRefType |
| VirtualMachineSemantics::Policy< State, ValueType >::Policy | ( | ) | [inline] |
| void VirtualMachineSemantics::Policy< State, ValueType >::set_map | ( | MemoryMap * | map | ) | [inline] |
Set the memory map that holds known values for known memory addresses.
This map is not modified by the policy and data is read from but not written to the map.
| size_t VirtualMachineSemantics::Policy< State, ValueType >::get_ninsns | ( | ) | const [inline] |
Returns the number of instructions processed.
This counter is incremented at the beginning of each instruction.
| void VirtualMachineSemantics::Policy< State, ValueType >::set_ninsns | ( | size_t | n | ) | [inline] |
Sets the number instructions processed.
This is the same counter incremented at the beginning of each instruction and returned by get_ninsns().
| SgAsmInstruction* VirtualMachineSemantics::Policy< State, ValueType >::get_insn | ( | ) | const [inline] |
Returns current instruction.
Returns the null pointer if no instruction is being processed.
| const State<ValueType>& VirtualMachineSemantics::Policy< State, ValueType >::get_state | ( | ) | const [inline] |
Returns the current state.
| State<ValueType>& VirtualMachineSemantics::Policy< State, ValueType >::get_state | ( | ) | [inline] |
Returns the current state.
| const State<ValueType>& VirtualMachineSemantics::Policy< State, ValueType >::get_orig_state | ( | ) | const [inline] |
Returns the original state.
The original state is initialized to be equal to the current state twice: once by the constructor, and then again when the first instruction is processed.
| State<ValueType>& VirtualMachineSemantics::Policy< State, ValueType >::get_orig_state | ( | ) | [inline] |
| const ValueType<32>& VirtualMachineSemantics::Policy< State, ValueType >::get_ip | ( | ) | const [inline] |
Returns the current instruction pointer.
| const ValueType<32>& VirtualMachineSemantics::Policy< State, ValueType >::get_orig_ip | ( | ) | const [inline] |
Returns the original instruction pointer.
See also get_orig_state().
| State< ValueType >::Memory VirtualMachineSemantics::Policy< State, ValueType >::memory_for_equality | ( | const State< ValueType > & | ) | const |
Returns a copy of the state after removing memory that is not pertinent to an equal_states() comparison.
| Memory VirtualMachineSemantics::Policy< State, ValueType >::memory_for_equality | ( | ) | const [inline] |
Returns a copy of the current state after removing memory that is not pertinent to an equal_states() comparison.
| bool VirtualMachineSemantics::Policy< State, ValueType >::equal_states | ( | const State< ValueType > & | , | |
| const State< ValueType > & | ||||
| ) | const |
Compares two states for equality.
The comarison looks at all register values and the memory locations that are different than their original value (but excluding differences due to clobbering). It does not compare memory that has only been read.
| void VirtualMachineSemantics::Policy< State, ValueType >::print | ( | std::ostream & | , | |
| RenameMap * | rmap = NULL | |||
| ) | const |
Print the current state of this policy.
If a rename map is specified then named values will be renamed to have a shorter name. See the ValueType<>::rename() method for details.
| bool VirtualMachineSemantics::Policy< State, ValueType >::on_stack | ( | const ValueType< 32 > & | value | ) | const |
Returns true if the specified value exists in memory and is provably at or above the stack pointer.
The stack pointer need not have a known value.
| void VirtualMachineSemantics::Policy< State, ValueType >::set_discard_popped_memory | ( | bool | b | ) | [inline] |
Changes how the policy treats the stack.
See the p_discard_popped_memory property data member for details.
| bool VirtualMachineSemantics::Policy< State, ValueType >::get_discard_popped_memory | ( | ) | const [inline] |
Returns the current setting for the property that determines how the stack behaves.
See the p_set_discard_popped_memory property data member for details.
| void VirtualMachineSemantics::Policy< State, ValueType >::print_diff | ( | std::ostream & | , | |
| const State< ValueType > & | , | |||
| const State< ValueType > & | , | |||
| RenameMap * | rmap = NULL | |||
| ) | const |
Print only the differences between two states.
If a rename map is specified then named values will be renamed to have a shorter name. See the ValueType<>::rename() method for details.
| void VirtualMachineSemantics::Policy< State, ValueType >::print_diff | ( | std::ostream & | o, | |
| const State< ValueType > & | state, | |||
| RenameMap * | rmap = NULL | |||
| ) | const [inline] |
Print the difference between a state and the initial state.
If a rename map is specified then named values will be renamed to have a shorter name. See the ValueType<>::rename() method for details.
| void VirtualMachineSemantics::Policy< State, ValueType >::print_diff | ( | std::ostream & | o, | |
| RenameMap * | rmap = NULL | |||
| ) | const [inline] |
Print the difference between the current state and the initial state.
If a rename map is specified then named values will be renamed to have a shorter name. See the ValueType<>::rename() method for details.
| std::string VirtualMachineSemantics::Policy< State, ValueType >::SHA1 | ( | ) | const |
Returns the SHA1 hash of the difference between the current state and the original state.
If libgcrypt is not available then the return value will be an empty string.
| bool VirtualMachineSemantics::Policy< State, ValueType >::SHA1 | ( | unsigned char * | digest | ) | const |
Obtains the binary SHA1 hash of the difference between the current state and the original state.
The hash is returned through the digest argument, which must be at least 20 bytes long. Returns true if the hash can be computed. If libgcrypt is not available then the first 20 bytes of digest will be set to zero and a false value is returned.
| ValueType<ToLen> VirtualMachineSemantics::Policy< State, ValueType >::signExtend | ( | const ValueType< FromLen > & | a | ) | const [inline] |
Sign extend from FromLen bits to ToLen bits.
| ValueType<EndAt-BeginAt> VirtualMachineSemantics::Policy< State, ValueType >::extract | ( | const ValueType< Len > & | a | ) | const [inline] |
Extracts certain bits from the specified value and shifts them to the low-order positions in the result.
The bits of the result include bits from BeginAt (inclusive) through EndAt (exclusive). The lsb is number zero.
| ValueType<ToLen> VirtualMachineSemantics::Policy< State, ValueType >::unsignedExtend | ( | const ValueType< FromLen > & | a | ) | const [inline] |
Return a newly sized value by either truncating the most significant bits or by adding more most significant bits that are set to zeros.
| ValueType<Len> VirtualMachineSemantics::Policy< State, ValueType >::mem_read | ( | State< ValueType > & | state, | |
| const ValueType< 32 > & | addr | |||
| ) | const [inline] |
Reads a value from memory in a way that always returns the same value provided there are not intervening writes that would clobber the value either directly or by aliasing.
Also, if appropriate, the value is added to the original memory state (thus changing the value at that address from an implicit named value to an explicit named value).
It is safe to call this function and supply the policy's original state as the state argument.
The documentation for MemoryCell has an example that demonstrates the desired behavior of mem_read() and mem_write().
| MemRefType VirtualMachineSemantics::Policy< State, ValueType >::memory_reference_type | ( | const State< ValueType > & | state, | |
| const ValueType< 32 > & | addr | |||
| ) | const [inline] |
Determines if the specified address is related to the current stack or frame pointer.
This is used by mem_write() when we're operating under the assumption that memory written via stack pointer is different than memory written via frame pointer, and that memory written by either pointer is different than all other memory.
| void VirtualMachineSemantics::Policy< State, ValueType >::mem_write | ( | State< ValueType > & | state, | |
| const ValueType< 32 > & | addr, | |||
| const ValueType< Len > & | data | |||
| ) | [inline] |
Writes a value to memory.
If the address written to is an alias for other addresses then the other addresses will be clobbered. Subsequent reads from clobbered addresses will return new values. See also, mem_read().
| const RegisterDictionary* VirtualMachineSemantics::Policy< State, ValueType >::get_register_dictionary | ( | ) | const [inline] |
Returns the register dictionary.
| void VirtualMachineSemantics::Policy< State, ValueType >::set_register_dictionary | ( | const RegisterDictionary * | regdict | ) | [inline] |
Sets the register dictionary.
| void VirtualMachineSemantics::Policy< State, ValueType >::startInstruction | ( | SgAsmInstruction * | insn | ) | [inline] |
| void VirtualMachineSemantics::Policy< State, ValueType >::finishInstruction | ( | SgAsmInstruction * | ) | [inline] |
| void VirtualMachineSemantics::Policy< State, ValueType >::startBlock | ( | rose_addr_t | addr | ) | [inline] |
| void VirtualMachineSemantics::Policy< State, ValueType >::finishBlock | ( | rose_addr_t | addr | ) | [inline] |
| ValueType<1> VirtualMachineSemantics::Policy< State, ValueType >::true_ | ( | ) | const [inline] |
True value.
| ValueType<1> VirtualMachineSemantics::Policy< State, ValueType >::false_ | ( | ) | const [inline] |
False value.
| ValueType<1> VirtualMachineSemantics::Policy< State, ValueType >::undefined_ | ( | ) | const [inline] |
Undefined Boolean.
| ValueType<Len> VirtualMachineSemantics::Policy< State, ValueType >::number | ( | uint64_t | n | ) | const [inline] |
Used to build a known constant.
| ValueType<32> VirtualMachineSemantics::Policy< State, ValueType >::filterCallTarget | ( | const ValueType< 32 > & | a | ) | const [inline] |
Called only for CALL instructions before assigning new value to IP register.
| ValueType<32> VirtualMachineSemantics::Policy< State, ValueType >::filterReturnTarget | ( | const ValueType< 32 > & | a | ) | const [inline] |
Called only for RET instructions before adjusting the IP register.
| ValueType<32> VirtualMachineSemantics::Policy< State, ValueType >::filterIndirectJumpTarget | ( | const ValueType< 32 > & | a | ) | const [inline] |
Called only for JMP instructions before adjusting the IP register.
| void VirtualMachineSemantics::Policy< State, ValueType >::hlt | ( | ) | [inline] |
Called only for the HLT instruction.
| void VirtualMachineSemantics::Policy< State, ValueType >::cpuid | ( | ) | [inline] |
Called only for the CPUID instruction.
| ValueType<64> VirtualMachineSemantics::Policy< State, ValueType >::rdtsc | ( | ) | [inline] |
Called only for the RDTSC instruction.
| void VirtualMachineSemantics::Policy< State, ValueType >::interrupt | ( | uint8_t | num | ) | [inline] |
Called only for the INT instruction.
| void VirtualMachineSemantics::Policy< State, ValueType >::sysenter | ( | ) | [inline] |
Called only for the SYSENTER instruction.
| const RegisterDescriptor& VirtualMachineSemantics::Policy< State, ValueType >::findRegister | ( | const std::string & | regname, | |
| size_t | nbits = 0 | |||
| ) | [inline] |
Finds a register by name.
| ValueType<Len> VirtualMachineSemantics::Policy< State, ValueType >::readRegister | ( | const char * | regname | ) | [inline] |
Reads from a named register.
| void VirtualMachineSemantics::Policy< State, ValueType >::writeRegister | ( | const char * | regname, | |
| const ValueType< Len > & | value | |||
| ) | [inline] |
Writes to a named register.
| ValueType<Len> VirtualMachineSemantics::Policy< State, ValueType >::readRegister | ( | const RegisterDescriptor & | reg | ) | [inline] |
Generic register read.
| void VirtualMachineSemantics::Policy< State, ValueType >::writeRegister | ( | const RegisterDescriptor & | reg, | |
| const ValueType< Len > & | value | |||
| ) | [inline] |
Generic register write.
| ValueType<Len> VirtualMachineSemantics::Policy< State, ValueType >::readMemory | ( | X86SegmentRegister | segreg, | |
| const ValueType< 32 > & | addr, | |||
| const ValueType< 1 > & | cond | |||
| ) | const [inline] |
Reads a value from memory.
| void VirtualMachineSemantics::Policy< State, ValueType >::writeMemory | ( | X86SegmentRegister | segreg, | |
| const ValueType< 32 > & | addr, | |||
| const ValueType< Len > & | data, | |||
| const ValueType< 1 > & | cond | |||
| ) | [inline] |
Writes a value to memory.
| ValueType<Len> VirtualMachineSemantics::Policy< State, ValueType >::add | ( | const ValueType< Len > & | a, | |
| const ValueType< Len > & | b | |||
| ) | const [inline] |
Adds two values.
| ValueType<Len> VirtualMachineSemantics::Policy< State, ValueType >::addWithCarries | ( | const ValueType< Len > & | a, | |
| const ValueType< Len > & | b, | |||
| const ValueType< 1 > & | c, | |||
| ValueType< Len > & | carry_out | |||
| ) | const [inline] |
Add two values of equal size and a carry bit.
Carry information is returned via carry_out argument. The carry_out value is the tick marks that are written above the first addend when doing long arithmetic like a 2nd grader would do (of course, they'd probably be adding two base-10 numbers). For instance, when adding 00110110 and 11100100:
'''..'.. <-- carry tick marks: '=carry .=no carry
00110110
+ 11100100
----------
100011010
The carry_out value is 11100100.
| ValueType<Len> VirtualMachineSemantics::Policy< State, ValueType >::and_ | ( | const ValueType< Len > & | a, | |
| const ValueType< Len > & | b | |||
| ) | const [inline] |
Computes bit-wise AND of two values.
| ValueType<1> VirtualMachineSemantics::Policy< State, ValueType >::equalToZero | ( | const ValueType< Len > & | a | ) | const [inline] |
Returns true_, false_, or undefined_ depending on whether argument is zero.
| ValueType<Len> VirtualMachineSemantics::Policy< State, ValueType >::invert | ( | const ValueType< Len > & | a | ) | const [inline] |
One's complement.
| ValueType<Len1+Len2> VirtualMachineSemantics::Policy< State, ValueType >::concat | ( | const ValueType< Len1 > & | a, | |
| const ValueType< Len2 > & | b | |||
| ) | const [inline] |
Concatenate the values of a and b so that the result has b in the high-order bits and a in the low order bits.
| ValueType<Len> VirtualMachineSemantics::Policy< State, ValueType >::ite | ( | const ValueType< 1 > & | sel, | |
| const ValueType< Len > & | ifTrue, | |||
| const ValueType< Len > & | ifFalse | |||
| ) | const [inline] |
Returns second or third arg depending on value of first arg.
| ValueType<Len> VirtualMachineSemantics::Policy< State, ValueType >::leastSignificantSetBit | ( | const ValueType< Len > & | a | ) | const [inline] |
Returns position of least significant set bit; zero when no bits are set.
| ValueType<Len> VirtualMachineSemantics::Policy< State, ValueType >::mostSignificantSetBit | ( | const ValueType< Len > & | a | ) | const [inline] |
Returns position of most significant set bit; zero when no bits are set.
| ValueType<Len> VirtualMachineSemantics::Policy< State, ValueType >::negate | ( | const ValueType< Len > & | a | ) | const [inline] |
Two's complement.
| ValueType<Len> VirtualMachineSemantics::Policy< State, ValueType >::or_ | ( | const ValueType< Len > & | a, | |
| const ValueType< Len > & | b | |||
| ) | const [inline] |
Computes bit-wise OR of two values.
| ValueType<Len> VirtualMachineSemantics::Policy< State, ValueType >::rotateLeft | ( | const ValueType< Len > & | a, | |
| const ValueType< SALen > & | sa | |||
| ) | const [inline] |
Rotate bits to the left.
| ValueType<Len> VirtualMachineSemantics::Policy< State, ValueType >::rotateRight | ( | const ValueType< Len > & | a, | |
| const ValueType< SALen > & | sa | |||
| ) | const [inline] |
Rotate bits to the right.
| ValueType<Len> VirtualMachineSemantics::Policy< State, ValueType >::shiftLeft | ( | const ValueType< Len > & | a, | |
| const ValueType< SALen > & | sa | |||
| ) | const [inline] |
Returns arg shifted left.
| ValueType<Len> VirtualMachineSemantics::Policy< State, ValueType >::shiftRight | ( | const ValueType< Len > & | a, | |
| const ValueType< SALen > & | sa | |||
| ) | const [inline] |
Returns arg shifted right logically (no sign bit).
| ValueType<Len> VirtualMachineSemantics::Policy< State, ValueType >::shiftRightArithmetic | ( | const ValueType< Len > & | a, | |
| const ValueType< SALen > & | sa | |||
| ) | const [inline] |
Returns arg shifted right arithmetically (with sign bit).
| ValueType<Len1> VirtualMachineSemantics::Policy< State, ValueType >::signedDivide | ( | const ValueType< Len1 > & | a, | |
| const ValueType< Len2 > & | b | |||
| ) | const [inline] |
Divides two signed values.
| ValueType<Len2> VirtualMachineSemantics::Policy< State, ValueType >::signedModulo | ( | const ValueType< Len1 > & | a, | |
| const ValueType< Len2 > & | b | |||
| ) | const [inline] |
Calculates modulo with signed values.
| ValueType<Len1+Len2> VirtualMachineSemantics::Policy< State, ValueType >::signedMultiply | ( | const ValueType< Len1 > & | a, | |
| const ValueType< Len2 > & | b | |||
| ) | const [inline] |
Multiplies two signed values.
| ValueType<Len1> VirtualMachineSemantics::Policy< State, ValueType >::unsignedDivide | ( | const ValueType< Len1 > & | a, | |
| const ValueType< Len2 > & | b | |||
| ) | const [inline] |
Divides two unsigned values.
| ValueType<Len2> VirtualMachineSemantics::Policy< State, ValueType >::unsignedModulo | ( | const ValueType< Len1 > & | a, | |
| const ValueType< Len2 > & | b | |||
| ) | const [inline] |
Calculates modulo with unsigned values.
| ValueType<Len1+Len2> VirtualMachineSemantics::Policy< State, ValueType >::unsignedMultiply | ( | const ValueType< Len1 > & | a, | |
| const ValueType< Len2 > & | b | |||
| ) | const [inline] |
Multiply two unsigned values.
| ValueType<Len> VirtualMachineSemantics::Policy< State, ValueType >::xor_ | ( | const ValueType< Len > & | a, | |
| const ValueType< Len > & | b | |||
| ) | const [inline] |
Computes bit-wise XOR of two values.
| std::ostream& operator<< | ( | std::ostream & | o, | |
| const Policy< State, ValueType > & | p | |||
| ) | [friend] |
SgAsmInstruction* VirtualMachineSemantics::Policy< State, ValueType >::cur_insn [protected] |
Set by startInstruction(), cleared by finishInstruction().
State<ValueType> VirtualMachineSemantics::Policy< State, ValueType >::orig_state [mutable, protected] |
Original machine state, initialized by constructor and mem_write.
This data member is mutable because a mem_read() operation, although conceptually const, may cache the value that was read so that subsquent reads from the same address will return the same value. This member is initialized by the first call to startInstruction() (as called by X86InstructionSemantics::processInstruction()) which allows the user to initialize the original conditions using the same interface that's used to process instructions. In other words, if one wants the stack pointer to contain a specific original value, then one may initialize the stack pointer by calling writeGPR() before processing the first instruction.
State<ValueType> VirtualMachineSemantics::Policy< State, ValueType >::cur_state [mutable, protected] |
Current machine state updated by each processInstruction().
The instruction pointer is updated before we process each instruction. This data member is mutable because a mem_read() operation, although conceptually const, may cache the value that was read so that subsequent reads from the same address will return the same value.
bool VirtualMachineSemantics::Policy< State, ValueType >::p_discard_popped_memory [protected] |
Property that determines how the stack behaves.
When set, any time the stack pointer is adjusted, memory below the stack pointer and having the same address name as the stack pointer is removed (the memory location becomes undefined). The default is false, that is, no special treatment for the stack.
size_t VirtualMachineSemantics::Policy< State, ValueType >::ninsns [protected] |
Total number of instructions processed.
This is incremented by startInstruction(), which is the first thing called by X86InstructionSemantics::processInstruction().
MemoryMap* VirtualMachineSemantics::Policy< State, ValueType >::map [protected] |
Initial known memory values for known addresses.
const RegisterDictionary* VirtualMachineSemantics::Policy< State, ValueType >::regdict [protected] |
Registers stored in the various State objects for this Policy.
This dictionary is used by the X86InstructionSemantics class to translate register names to register descriptors. For instance, to read from the "eax" register, the semantics will look up "eax" in the policy's register dictionary and then pass that descriptor to the policy's readRegister() method. Register descriptors are also stored in instructions then the instruction is disassembled, so the disassembler and policy should probably be using the same dictionary.
1.4.7