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

Description of logical lanes within a big Varnode. More...

#include <transform.hh>

Public Member Functions

 LaneDescription (const LaneDescription &op2)
 Copy constructor. More...
 
 LaneDescription (int4 origSize, int4 sz)
 Construct uniform lanes. More...
 
 LaneDescription (int4 origSize, int4 lo, int4 hi)
 Construct two lanes of arbitrary size. More...
 
bool subset (int4 lsbOffset, int4 size)
 Trim this to a subset of the original lanes. More...
 
int4 getNumLanes (void) const
 Get the total number of lanes.
 
int4 getWholeSize (void) const
 Get the size of the region being split.
 
int4 getSize (int4 i) const
 Get the size of the i-th lane.
 
int4 getPosition (int4 i) const
 Get the significance offset of the i-th lane.
 
int4 getBoundary (int4 bytePos) const
 Get index of lane that starts at the given byte position. More...
 
bool restriction (int4 numLanes, int4 skipLanes, int4 bytePos, int4 size, int4 &resNumLanes, int4 &resSkipLanes) const
 Decide if a given truncation is natural for this description. More...
 
bool extension (int4 numLanes, int4 skipLanes, int4 bytePos, int4 size, int4 &resNumLanes, int4 &resSkipLanes) const
 Decide if a given subset of lanes can be extended naturally for this description. More...
 

Private Attributes

int4 wholeSize
 Size of the region being split in bytes.
 
vector< int4 > laneSize
 Size of lanes in bytes.
 
vector< int4 > lanePosition
 Significance positions of lanes in bytes.
 

Detailed Description

Description of logical lanes within a big Varnode.

A lane is a byte offset and size within a Varnode. Lanes within a Varnode are disjoint. In general, we expect a Varnode to be tiled with lanes all of the same size, but the API allows for possibly non-uniform lanes.

Constructor & Destructor Documentation

LaneDescription::LaneDescription ( const LaneDescription op2)

Copy constructor.

Parameters
op2is the lane description to copy from

References lanePosition, laneSize, and wholeSize.

LaneDescription::LaneDescription ( int4  origSize,
int4  sz 
)

Construct uniform lanes.

Create lanes that are all the same size

Parameters
origSizeis the size of the whole in bytes
szis the size of a lane in bytes

References lanePosition, laneSize, and wholeSize.

LaneDescription::LaneDescription ( int4  origSize,
int4  lo,
int4  hi 
)

Construct two lanes of arbitrary size.

Parameters
origSizeis the size of the whole in bytes
lois the size of the least significant lane in bytes
hiis the size of the most significant lane in bytes

References lanePosition, laneSize, and wholeSize.

Member Function Documentation

bool LaneDescription::extension ( int4  numLanes,
int4  skipLanes,
int4  bytePos,
int4  size,
int4 &  resNumLanes,
int4 &  resSkipLanes 
) const

Decide if a given subset of lanes can be extended naturally for this description.

A subset of lanes are specified and their position within an extension (given by a byte position). The size in bytes of the extension is also given. If the extension is contained within this description, and the boundaries of the extension don't split any lanes, then return true and pass back the number of lanes and starting lane of the extension.

Parameters
numLanesis the number of lanes in the original subset
skipLanesis the starting (least significant) lane index of the original subset
bytePosis the number of bytes to truncate from the front (least significant portion) of the extension
sizeis the number of bytes in the extension
resNumLaneswill hold the number of lanes in the extension
resSkipLaneswill hold the starting lane in the extension
Returns
true if the extension is natural

References getBoundary(), and lanePosition.

int4 LaneDescription::getBoundary ( int4  bytePos) const

Get index of lane that starts at the given byte position.

Position 0 will map to index 0 and a position equal to whole size will map to the number of lanes. Positions that are out of bounds or that do not fall on a lane boundary will return -1.

Parameters
bytePosis the given byte position to test
Returns
the index of the lane that start at the given position

References lanePosition, and wholeSize.

Referenced by extension(), restriction(), and subset().

bool LaneDescription::restriction ( int4  numLanes,
int4  skipLanes,
int4  bytePos,
int4  size,
int4 &  resNumLanes,
int4 &  resSkipLanes 
) const

Decide if a given truncation is natural for this description.

A subset of lanes are specified and a truncation (given by a byte position and byte size). If the truncation, relative to the subset, contains at least 1 lane and does not split any lanes, then return true and pass back the number of lanes and starting lane of the truncation.

Parameters
numLanesis the number of lanes in the original subset
skipLanesis the starting (least significant) lane index of the original subset
bytePosis the number of bytes to truncate from the front (least significant portion) of the subset
sizeis the number of bytes to include in the truncation
resNumLaneswill hold the number of lanes in the truncation
resSkipLaneswill hold the starting lane in the truncation
Returns
true if the truncation is natural

References getBoundary(), and lanePosition.

bool LaneDescription::subset ( int4  lsbOffset,
int4  size 
)

Trim this to a subset of the original lanes.

Given a subrange, specified as an offset into the whole and size, throw out any lanes in this that aren't in the subrange, so that the size of whole is the size of the subrange. If the subrange intersects partially with any of the lanes, return false.

Parameters
lsbOffsetis the number of bytes to remove from the front of the description
sizeis the number of bytes in the subrange
Returns
true if this was successfully transformed to the subrange

References getBoundary(), lanePosition, laneSize, and wholeSize.


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