mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 10:19:23 +02:00
Added getSplit based on lane subset
This commit is contained in:
parent
4f925923c5
commit
2f3415de8c
2 changed files with 23 additions and 1 deletions
|
@ -373,8 +373,9 @@ TransformVar *TransformManager::newSplit(Varnode *vn,const LaneDescription &desc
|
||||||
{
|
{
|
||||||
TransformVar *res = new TransformVar[numLanes];
|
TransformVar *res = new TransformVar[numLanes];
|
||||||
pieceMap[vn->getCreateIndex()] = res;
|
pieceMap[vn->getCreateIndex()] = res;
|
||||||
|
int4 baseBitPos = description.getPosition(startLane) * 8;
|
||||||
for(int4 i=0;i<numLanes;++i) {
|
for(int4 i=0;i<numLanes;++i) {
|
||||||
int4 bitpos = description.getPosition(startLane + i) * 8;
|
int4 bitpos = description.getPosition(startLane + i) * 8 - baseBitPos;
|
||||||
int4 byteSize = description.getSize(startLane + i);
|
int4 byteSize = description.getSize(startLane + i);
|
||||||
TransformVar *newVar = &res[i];
|
TransformVar *newVar = &res[i];
|
||||||
if (vn->isConstant())
|
if (vn->isConstant())
|
||||||
|
@ -511,6 +512,26 @@ TransformVar *TransformManager::getSplit(Varnode *vn,const LaneDescription &desc
|
||||||
return newSplit(vn,description);
|
return newSplit(vn,description);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// \brief Find (or create) placeholder nodes splitting a Varnode into a subset of lanes from a description
|
||||||
|
///
|
||||||
|
/// Given a big Varnode and a specific subset of a lane description, look up placeholders
|
||||||
|
/// for all the explicit pieces. If they don't exist, create them.
|
||||||
|
/// \param vn is the big Varnode to split
|
||||||
|
/// \param description describes all the possible lanes
|
||||||
|
/// \param numLanes is the number of lanes in the subset
|
||||||
|
/// \param startLane is the starting (least significant) lane in the subset
|
||||||
|
/// \return an array of the TransformVar placeholders from least to most significant
|
||||||
|
TransformVar *TransformManager::getSplit(Varnode *vn,const LaneDescription &description,int4 numLanes,int4 startLane)
|
||||||
|
|
||||||
|
{
|
||||||
|
map<int4,TransformVar *>::const_iterator iter;
|
||||||
|
iter = pieceMap.find(vn->getCreateIndex());
|
||||||
|
if (iter != pieceMap.end()) {
|
||||||
|
return (*iter).second;
|
||||||
|
}
|
||||||
|
return newSplit(vn,description,numLanes,startLane);
|
||||||
|
}
|
||||||
|
|
||||||
/// \brief Handle some special PcodeOp marking
|
/// \brief Handle some special PcodeOp marking
|
||||||
/// If a PcodeOp is an INDIRECT creation, we need to do special marking of the op and Varnodes
|
/// If a PcodeOp is an INDIRECT creation, we need to do special marking of the op and Varnodes
|
||||||
/// \param rop is the placeholder op with the special requirement
|
/// \param rop is the placeholder op with the special requirement
|
||||||
|
|
|
@ -143,6 +143,7 @@ public:
|
||||||
TransformVar *getPreexistingVarnode(Varnode *vn); ///< Get (or create) placeholder for preexisting Varnode
|
TransformVar *getPreexistingVarnode(Varnode *vn); ///< Get (or create) placeholder for preexisting Varnode
|
||||||
TransformVar *getPiece(Varnode *vn,int4 bitSize,int4 lsbOffset); ///< Get (or create) placeholder piece
|
TransformVar *getPiece(Varnode *vn,int4 bitSize,int4 lsbOffset); ///< Get (or create) placeholder piece
|
||||||
TransformVar *getSplit(Varnode *vn,const LaneDescription &description);
|
TransformVar *getSplit(Varnode *vn,const LaneDescription &description);
|
||||||
|
TransformVar *getSplit(Varnode *vn,const LaneDescription &description,int4 numLanes,int4 startLane);
|
||||||
void opSetInput(TransformOp *rop,TransformVar *rvn,int4 slot); ///< Mark given variable as input to given op
|
void opSetInput(TransformOp *rop,TransformVar *rvn,int4 slot); ///< Mark given variable as input to given op
|
||||||
void opSetOutput(TransformOp *rop,TransformVar *rvn); ///< Mark given variable as output of given op
|
void opSetOutput(TransformOp *rop,TransformVar *rvn); ///< Mark given variable as output of given op
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue