ROSE  0.9.9.139
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | List of all members
Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterStateX86 Class Reference

Description

The set of all registers and their values for a 32-bit x86 architecture.

This register state is probably not too useful anymore; use RegisterStateGeneric instead.

The general purpose registers are stored as 32-bit values; subparts thereof will require calls to the RiscOperators extract() or concat() operators. The status bits from the EFLAGS register are stored individually since that's how they're typically accessed; access to the FLAGS/EFLAGS register as a whole will require calls to the RISC operators.

Definition at line 938 of file BaseSemantics2.h.

#include <BaseSemantics2.h>

Inheritance diagram for Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterStateX86:
Inheritance graph
[legend]
Collaboration diagram for Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterStateX86:
Collaboration graph
[legend]

Public Member Functions

virtual RegisterStatePtr create (const SValuePtr &protoval, const RegisterDictionary *regdict) const ROSE_OVERRIDE
 Virtual constructor. More...
 
virtual RegisterStatePtr clone () const ROSE_OVERRIDE
 Make a copy of this register state. More...
 
virtual void clear () ROSE_OVERRIDE
 Removes stored values from the register state. More...
 
virtual void zero () ROSE_OVERRIDE
 Set all registers to the zero. More...
 
virtual SValuePtr readRegister (RegisterDescriptor reg, const SValuePtr &dflt, RiscOperators *ops) ROSE_OVERRIDE
 Read a value from a register. More...
 
virtual void writeRegister (RegisterDescriptor reg, const SValuePtr &value, RiscOperators *ops) ROSE_OVERRIDE
 Write a value to a register. More...
 
virtual void print (std::ostream &, Formatter &) const ROSE_OVERRIDE
 Print the register contents. More...
 
virtual bool merge (const RegisterStatePtr &other, RiscOperators *ops) ROSE_OVERRIDE
 Merge register states for data flow analysis. More...
 
- Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterState
SValuePtr protoval () const
 Return the protoval. More...
 
SValuePtr get_protoval () const ROSE_DEPRECATED("use protoval instead")
 
MergerPtr merger () const
 Property: Merger. More...
 
void merger (const MergerPtr &m)
 Property: Merger. More...
 
const RegisterDictionaryget_register_dictionary () const
 The register dictionary should be compatible with the register dictionary used for other parts of binary analysis. More...
 
void set_register_dictionary (const RegisterDictionary *rd)
 The register dictionary should be compatible with the register dictionary used for other parts of binary analysis. More...
 
void print (std::ostream &stream, const std::string prefix="") const
 Print the register contents. More...
 
WithFormatter with_format (Formatter &fmt)
 Used for printing register states with formatting. More...
 
WithFormatter operator+ (Formatter &fmt)
 Used for printing register states with formatting. More...
 

Static Public Member Functions

static RegisterStateX86Ptr instance (const SValuePtr &protoval, const RegisterDictionary *regdict)
 Instantiate a new register state. More...
 
static RegisterStateX86Ptr instance (const RegisterStateX86Ptr &other)
 Instantiate a new copy of an existing register state. More...
 
static RegisterStateX86Ptr promote (const RegisterStatePtr &from)
 Run-time promotion of a base register state pointer to a RegisterStateX86 pointer. More...
 
- Static Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterState
static RegisterStatePtr promote (const RegisterStatePtr &x)
 

Public Attributes

SValuePtr ip
 Instruction pointer. More...
 
SValuePtr gpr [n_gprs]
 General-purpose registers.
 
SValuePtr segreg [n_segregs]
 Segmentation registers. More...
 
SValuePtr flag [n_flags]
 Control/status flags (i.e., FLAG register). More...
 
SValuePtr st [n_st]
 Floating point circular stack. More...
 
SValuePtr fpstatus
 Floating-point status word. More...
 
SValuePtr xmm [n_xmm]
 XMM registers. More...
 

Static Public Attributes

static const size_t n_gprs = 8
 Number of general-purpose registers in this state. More...
 
static const size_t n_segregs = 6
 Number of segmentation registers in this state. More...
 
static const size_t n_flags = 32
 Number of flag registers in this state. More...
 
static const size_t n_st = 8
 Number of ST registers (not counting _st_top pseudo register). More...
 
static const size_t n_xmm = 8
 Number f XMM registers. More...
 

Protected Member Functions

 RegisterStateX86 (const SValuePtr &protoval, const RegisterDictionary *regdict)
 
 RegisterStateX86 (const RegisterStateX86 &other)
 
virtual SValuePtr readRegisterGpr (RegisterDescriptor reg, RiscOperators *ops)
 
virtual SValuePtr readRegisterFlag (RegisterDescriptor reg, RiscOperators *ops)
 
virtual SValuePtr readRegisterSeg (RegisterDescriptor reg, RiscOperators *ops)
 
virtual SValuePtr readRegisterIp (RegisterDescriptor reg, RiscOperators *ops)
 
virtual SValuePtr readRegisterSt (RegisterDescriptor reg, RiscOperators *ops)
 
virtual SValuePtr readRegisterXmm (RegisterDescriptor reg, RiscOperators *ops)
 
virtual SValuePtr readRegisterFpStatus (RegisterDescriptor reg, RiscOperators *ops)
 
virtual void writeRegisterGpr (RegisterDescriptor reg, const SValuePtr &value, RiscOperators *ops)
 
virtual void writeRegisterFlag (RegisterDescriptor reg, const SValuePtr &value, RiscOperators *ops)
 
virtual void writeRegisterSeg (RegisterDescriptor reg, const SValuePtr &value, RiscOperators *ops)
 
virtual void writeRegisterIp (RegisterDescriptor reg, const SValuePtr &value, RiscOperators *ops)
 
virtual void writeRegisterSt (RegisterDescriptor reg, const SValuePtr &value, RiscOperators *ops)
 
virtual void writeRegisterXmm (RegisterDescriptor reg, const SValuePtr &value, RiscOperators *ops)
 
virtual void writeRegisterFpStatus (RegisterDescriptor reg, const SValuePtr &value, RiscOperators *ops)
 
virtual std::string initialValueName (RegisterDescriptor) const
 
- Protected Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterState
 RegisterState (const SValuePtr &protoval, const RegisterDictionary *regdict)
 

Additional Inherited Members

- Public Types inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterState
typedef RegisterStatePtr Ptr
 Shared-ownership pointer for a RegisterState object. More...
 
- Protected Attributes inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterState
const RegisterDictionaryregdict
 Registers that are able to be stored by this state. More...
 

Member Function Documentation

static RegisterStateX86Ptr Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterStateX86::instance ( const SValuePtr protoval,
const RegisterDictionary regdict 
)
inlinestatic

Instantiate a new register state.

The protoval argument must be a non-null pointer to a semantic value which will be used only to create additional instances of the value via its virtual constructors. The prototypical value is normally of the same type for all parts of a semantic analysis: its state and operator classes.

Definition at line 983 of file BaseSemantics2.h.

Referenced by Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::State::clone(), create(), and Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::State::create().

static RegisterStateX86Ptr Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterStateX86::instance ( const RegisterStateX86Ptr other)
inlinestatic

Instantiate a new copy of an existing register state.

Definition at line 988 of file BaseSemantics2.h.

virtual RegisterStatePtr Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterStateX86::create ( const SValuePtr protoval,
const RegisterDictionary regdict 
) const
inlinevirtual

Virtual constructor.

The protoval argument must be a non-null pointer to a semantic value which will be used only to create additional instances of the value via its virtual constructors. The prototypical value is normally of the same type for all parts of a semantic analysis. The register state must be compatible with the rest of the binary analysis objects in use.

Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterState.

Definition at line 995 of file BaseSemantics2.h.

References instance(), Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterState::protoval(), and Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterState::regdict.

virtual RegisterStatePtr Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterStateX86::clone ( ) const
inlinevirtual

Make a copy of this register state.

Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterState.

Definition at line 999 of file BaseSemantics2.h.

static RegisterStateX86Ptr Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterStateX86::promote ( const RegisterStatePtr from)
inlinestatic

Run-time promotion of a base register state pointer to a RegisterStateX86 pointer.

This is a checked conversion–it will fail if from does not point to a RegisterStateX86 object.

Definition at line 1008 of file BaseSemantics2.h.

virtual void Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterStateX86::clear ( )
virtual

Removes stored values from the register state.

Depending on the register state implementation, this could either store new, distinct undefined values in each register, or it could simply erase all information about stored values leaving the register state truly empty. For instance, RegisterStateX86, which stores register values using fixed length arrays assigns new undefined values to each element of those arrays, whereas RegisterStateGeneric, which uses variable length arrays to store information about a dynamically changing set of registers, clears its arrays to zero length.

Register states can also be initialized by clearing them or by explicitly writing new values into each desired register (or both). See RegisterStateGeneric::initialize_nonoverlapping for one way to initialize that register state.

Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterState.

virtual void Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterStateX86::zero ( )
virtual
virtual SValuePtr Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterStateX86::readRegister ( RegisterDescriptor  reg,
const SValuePtr dflt,
RiscOperators ops 
)
virtual

Read a value from a register.

The register descriptor, reg, not only describes which register, but also which bits of that register (e.g., "al", "ah", "ax", "eax", and "rax" are all the same hardware register on an amd64, but refer to different parts of that register). The RISC operations are provided so that they can be used to extract the correct bits from a wider hardware register if necessary.

The dflt value is written into the register state if the register was not defined in the state. By doing this, a subsequent read of the same register will return the same value. Some register states cannot distinguish between a register that was never accessed and a register that was only read, in which case dflt is not used since all registers are already initialized.

See RiscOperators::readRegister for more details.

Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterState.

Referenced by Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RiscOperators::readRegister().

virtual void Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterStateX86::writeRegister ( RegisterDescriptor  reg,
const SValuePtr value,
RiscOperators ops 
)
virtual

Write a value to a register.

The register descriptor, reg, not only describes which register, but also which bits of that register (e.g., "al", "ah", "ax", "eax", and "rax" are all the same hardware register on an amd64, but refer to different parts of that register). The RISC operations are provided so that they can be used to insert the value bits into a wider the hardware register if necessary. See RiscOperators::readRegister for more details.

Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterState.

virtual void Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterStateX86::print ( std::ostream &  ,
Formatter  
) const
virtual
virtual bool Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterStateX86::merge ( const RegisterStatePtr other,
RiscOperators ops 
)
virtual

Merge register states for data flow analysis.

Merges the other state into this state, returning true if this state changed.

Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterState.

Member Data Documentation

const size_t Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterStateX86::n_gprs = 8
static

Number of general-purpose registers in this state.

Definition at line 940 of file BaseSemantics2.h.

const size_t Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterStateX86::n_segregs = 6
static

Number of segmentation registers in this state.

Definition at line 941 of file BaseSemantics2.h.

const size_t Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterStateX86::n_flags = 32
static

Number of flag registers in this state.

Definition at line 942 of file BaseSemantics2.h.

const size_t Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterStateX86::n_st = 8
static

Number of ST registers (not counting _st_top pseudo register).

Definition at line 943 of file BaseSemantics2.h.

const size_t Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterStateX86::n_xmm = 8
static

Number f XMM registers.

Definition at line 944 of file BaseSemantics2.h.

SValuePtr Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterStateX86::ip

Instruction pointer.

Definition at line 946 of file BaseSemantics2.h.

SValuePtr Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterStateX86::segreg[n_segregs]

Segmentation registers.

Definition at line 948 of file BaseSemantics2.h.

SValuePtr Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterStateX86::flag[n_flags]

Control/status flags (i.e., FLAG register).

Definition at line 949 of file BaseSemantics2.h.

SValuePtr Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterStateX86::st[n_st]

Floating point circular stack.

Definition at line 950 of file BaseSemantics2.h.

SValuePtr Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterStateX86::fpstatus

Floating-point status word.

Definition at line 951 of file BaseSemantics2.h.

SValuePtr Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RegisterStateX86::xmm[n_xmm]

XMM registers.

Definition at line 952 of file BaseSemantics2.h.


The documentation for this class was generated from the following file: