mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 02:09:44 +02:00
GP-4300 Full extended division in optimized division rules
This commit is contained in:
parent
c63be6d2c3
commit
4bbbba3e5a
17 changed files with 821 additions and 228 deletions
|
@ -372,6 +372,36 @@ Varnode *Funcdata::setInputVarnode(Varnode *vn)
|
|||
return vn;
|
||||
}
|
||||
|
||||
/// Construct a constant Varnode up to 128 bits, using INT_ZEXT and PIECE if necessary.
|
||||
/// This method is temporary until we have full extended precision constants.
|
||||
/// \param s is the size of the Varnode in bytes
|
||||
/// \param val is the 128-bit value in 2 64-bit chunks
|
||||
/// \param op is point before which any new PcodeOp should get inserted
|
||||
/// \return the new effective constant Varnode
|
||||
Varnode *Funcdata::newExtendedConstant(int4 s,uint8 *val,PcodeOp *op)
|
||||
|
||||
{
|
||||
if (s <= 8)
|
||||
return newConstant(s, val[0]);
|
||||
Varnode *newConstVn;
|
||||
if (val[1] == 0) {
|
||||
PcodeOp *extOp = newOp(1,op->getAddr());
|
||||
opSetOpcode(extOp,CPUI_INT_ZEXT);
|
||||
newConstVn = newUniqueOut(s,extOp);
|
||||
opSetInput(extOp,newConstant(8,val[0]),0);
|
||||
opInsertBefore(extOp,op);
|
||||
}
|
||||
else {
|
||||
PcodeOp *pieceOp = newOp(2,op->getAddr());
|
||||
opSetOpcode(pieceOp,CPUI_PIECE);
|
||||
newConstVn = newUniqueOut(s,pieceOp);
|
||||
opSetInput(pieceOp,newConstant(8,val[1]),0); // Most significant piece
|
||||
opSetInput(pieceOp,newConstant(8,val[0]),1); // Least significant piece
|
||||
opInsertBefore(pieceOp,op);
|
||||
}
|
||||
return newConstVn;
|
||||
}
|
||||
|
||||
/// \brief Adjust input Varnodes contained in the given range
|
||||
///
|
||||
/// After this call, a single \e input Varnode will exist that fills the given range.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue