decompiler  1.0.0
Public Member Functions | Private Attributes | List of all members
ContextBitRange Class Reference

Description of a context variable within the disassembly context blob. More...

#include <globalcontext.hh>

Public Member Functions

 ContextBitRange (void)
 Constructor for use with restoreXml()
 
 ContextBitRange (int4 sbit, int4 ebit)
 Construct a context value given an absolute bit range. More...
 
int4 getShift (void) const
 Return the shift-amount for this value.
 
uintm getMask (void) const
 Return the mask for this value.
 
int4 getWord (void) const
 Return the word index for this value.
 
void setValue (uintm *vec, uintm val) const
 Set this value within a given context blob. More...
 
uintm getValue (const uintm *vec) const
 Retrieve this value from a given context blob. More...
 

Private Attributes

int4 word
 Index of word containing this context value.
 
int4 startbit
 Starting bit of the value within its word (0=most significant bit 1=least significant)
 
int4 endbit
 Ending bit of the value within its word.
 
int4 shift
 Right-shift amount to apply when unpacking this value from its word.
 
uintm mask
 Mask to apply (after shifting) when unpacking this value from its word.
 

Detailed Description

Description of a context variable within the disassembly context blob.

Disassembly context is stored as individual (integer) values packed into a sequence of words. This class represents the info for encoding or decoding a single value within this sequence. A value is a contiguous range of bits within one context word. Size can range from 1 bit up to the size of a word.

Constructor & Destructor Documentation

ContextBitRange::ContextBitRange ( int4  sbit,
int4  ebit 
)

Construct a context value given an absolute bit range.

Bits within the whole context blob are labeled starting with 0 as the most significant bit in the first word in the sequence. The new context value must be contained within a single word.

Parameters
sbitis the starting (most significant) bit of the new value
ebitis the ending (least significant) bit of the new value

References endbit, mask, shift, startbit, and word.

Member Function Documentation

uintm ContextBitRange::getValue ( const uintm *  vec) const
inline

Retrieve this value from a given context blob.

Parameters
vecis the given context blob (as an array of uintm words)
Returns
the recovered integer value

Referenced by ContextDatabase::getDefaultValue(), and ContextDatabase::getVariable().

void ContextBitRange::setValue ( uintm *  vec,
uintm  val 
) const
inline

Set this value within a given context blob.

Parameters
vecis the given context blob to alter (as an array of uintm words)
valis the integer value to set

References mask, shift, and word.

Referenced by ContextInternal::restoreContext(), ContextDatabase::setVariable(), ContextDatabase::setVariableDefault(), and ContextDatabase::setVariableRegion().


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