Ghidra Decompiler Analysis Engine
|
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 | 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... | |
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.
LaneDescription::LaneDescription | ( | const LaneDescription & | op2 | ) |
Copy constructor.
op2 | is the lane description to copy from |
LaneDescription::LaneDescription | ( | int4 | origSize, |
int4 | sz | ||
) |
Construct uniform lanes.
Create lanes that are all the same size
origSize | is the size of the whole in bytes |
sz | is the size of a lane in bytes |
LaneDescription::LaneDescription | ( | int4 | origSize, |
int4 | lo, | ||
int4 | hi | ||
) |
Construct two lanes of arbitrary size.
origSize | is the size of the whole in bytes |
lo | is the size of the least significant lane in bytes |
hi | is the size of the most significant lane in bytes |
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.
numLanes | is the number of lanes in the original subset |
skipLanes | is the starting (least significant) lane index of the original subset |
bytePos | is the number of bytes to truncate from the front (least significant portion) of the extension |
size | is the number of bytes in the extension |
resNumLanes | will hold the number of lanes in the extension |
resSkipLanes | will hold the starting lane in the extension |
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.
bytePos | is the given byte position to test |
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.
numLanes | is the number of lanes in the original subset |
skipLanes | is the starting (least significant) lane index of the original subset |
bytePos | is the number of bytes to truncate from the front (least significant portion) of the subset |
size | is the number of bytes to include in the truncation |
resNumLanes | will hold the number of lanes in the truncation |
resSkipLanes | will hold the starting lane in the truncation |
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.
lsbOffset | is the number of bytes to remove from the front of the description |
size | is the number of bytes in the subrange |