mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
adjustments to resolveConstant
This commit is contained in:
parent
612c0d6f3e
commit
4edff2b9f0
10 changed files with 51 additions and 20 deletions
|
@ -333,7 +333,7 @@ void Funcdata::spacebaseConstant(PcodeOp *op,int4 slot,SymbolEntry *entry,const
|
|||
outvn = outvn2;
|
||||
opInsertBefore(extraop,op);
|
||||
}
|
||||
if (sz != origsize) { // There is a change in size from address -> varnode
|
||||
if (sz < origsize) { // The new constant is smaller than the original varnode, so we extend it
|
||||
PcodeOp *zextop = newOp(1,op->getAddr());
|
||||
Varnode *outvn2 = newUniqueOut(origsize,zextop);
|
||||
opSetOpcode(zextop,CPUI_INT_ZEXT); // Create an extension to get back to original varnode size
|
||||
|
@ -341,6 +341,15 @@ void Funcdata::spacebaseConstant(PcodeOp *op,int4 slot,SymbolEntry *entry,const
|
|||
opInsertBefore(zextop,op);
|
||||
outvn = outvn2;
|
||||
}
|
||||
else if (origsize < sz) { // The new constant is bigger than the original varnode, truncate it
|
||||
PcodeOp *subOp = newOp(2,op->getAddr());
|
||||
Varnode *outvn3 = newUniqueOut(origsize,subOp);
|
||||
opSetOpcode(subOp,CPUI_SUBPIECE);
|
||||
opSetInput(subOp,outvn,0);
|
||||
opSetInput(subOp,newConstant(4, 0), 1); // Take least significant piece
|
||||
opInsertBefore(subOp,op);
|
||||
outvn = outvn3;
|
||||
}
|
||||
opSetInput(op,outvn,slot);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue