mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-25 13:42:06 +00:00
GP-3609 Split based on endianess of output AddrSpace
This commit is contained in:
parent
b796fe5233
commit
0b13fc7109
@ -2085,11 +2085,11 @@ bool SplitDatatype::generateConstants(Varnode *vn,vector<Varnode *> &inVarnodes)
|
||||
/// based on the input offsets in \b dataTypePieces.
|
||||
/// \param rootVn is the given root constant
|
||||
/// \param inVarnodes is the container for the new Varnodes
|
||||
void SplitDatatype::buildInConstants(Varnode *rootVn,vector<Varnode *> &inVarnodes)
|
||||
/// \param bigEndian is \b true if the output address space is big endian
|
||||
void SplitDatatype::buildInConstants(Varnode *rootVn,vector<Varnode *> &inVarnodes,bool bigEndian)
|
||||
|
||||
{
|
||||
uintb baseVal = rootVn->getOffset();
|
||||
bool bigEndian = rootVn->getSpace()->isBigEndian();
|
||||
for(int4 i=0;i<dataTypePieces.size();++i) {
|
||||
Datatype *dt = dataTypePieces[i].inType;
|
||||
int4 off = dataTypePieces[i].offset;
|
||||
@ -2346,7 +2346,7 @@ bool SplitDatatype::splitCopy(PcodeOp *copyOp,Datatype *inType,Datatype *outType
|
||||
vector<Varnode *> inVarnodes;
|
||||
vector<Varnode *> outVarnodes;
|
||||
if (inVn->isConstant())
|
||||
buildInConstants(inVn,inVarnodes);
|
||||
buildInConstants(inVn,inVarnodes,outVn->getSpace()->isBigEndian());
|
||||
else
|
||||
buildInSubpieces(inVn,copyOp,inVarnodes);
|
||||
buildOutVarnodes(outVn,outVarnodes);
|
||||
@ -2461,9 +2461,10 @@ bool SplitDatatype::splitStore(PcodeOp *storeOp,Datatype *outType)
|
||||
return false;
|
||||
}
|
||||
|
||||
AddrSpace *storeSpace = storeOp->getIn(0)->getSpaceFromConst();
|
||||
vector<Varnode *> inVarnodes;
|
||||
if (inVn->isConstant())
|
||||
buildInConstants(inVn,inVarnodes);
|
||||
buildInConstants(inVn,inVarnodes,storeSpace->isBigEndian());
|
||||
else if (loadOp != (PcodeOp *)0) {
|
||||
vector<Varnode *> loadPtrs;
|
||||
buildPointers(loadRoot.pointer, loadRoot.ptrType, loadRoot.baseOffset, loadOp, loadPtrs, true);
|
||||
@ -2485,7 +2486,6 @@ bool SplitDatatype::splitStore(PcodeOp *storeOp,Datatype *outType)
|
||||
|
||||
vector<Varnode *> storePtrs;
|
||||
buildPointers(storeRoot.pointer, storeRoot.ptrType, storeRoot.baseOffset, storeOp, storePtrs, false);
|
||||
AddrSpace *storeSpace = storeOp->getIn(0)->getSpaceFromConst();
|
||||
// Preserve original STORE object, so that INDIRECT references are still valid
|
||||
// but convert it into the first of the smaller STOREs
|
||||
data.opSetInput(storeOp,storePtrs[0],1);
|
||||
|
@ -188,7 +188,7 @@ class SplitDatatype {
|
||||
bool testDatatypeCompatibility(Datatype *inBase,Datatype *outBase,bool inConstant);
|
||||
bool testCopyConstraints(PcodeOp *copyOp);
|
||||
bool generateConstants(Varnode *vn,vector<Varnode *> &inVarnodes);
|
||||
void buildInConstants(Varnode *rootVn,vector<Varnode *> &inVarnodes);
|
||||
void buildInConstants(Varnode *rootVn,vector<Varnode *> &inVarnodes,bool bigEndian);
|
||||
void buildInSubpieces(Varnode *rootVn,PcodeOp *followOp,vector<Varnode *> &inVarnodes);
|
||||
void buildOutVarnodes(Varnode *rootVn,vector<Varnode *> &outVarnodes);
|
||||
void buildOutConcats(Varnode *rootVn,PcodeOp *previousOp,vector<Varnode *> &outVarnodes);
|
||||
|
Loading…
Reference in New Issue
Block a user