mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
GP-3307 Stack strings
This commit is contained in:
parent
9b6ba66aa0
commit
5604178194
37 changed files with 1653 additions and 419 deletions
|
@ -297,6 +297,47 @@ Varnode *Funcdata::findSpacebaseInput(AddrSpace *id) const
|
|||
return vn;
|
||||
}
|
||||
|
||||
/// \brief If it doesn't exist, create an input Varnode of the base register corresponding to the given address space
|
||||
///
|
||||
/// The address space must have a base register associated with it or an exception is thrown.
|
||||
/// If a Varnode representing the incoming base register already exists, it is returned. Otherwise
|
||||
/// a new Varnode is created and returned. In either case, the Varnode will have the TypeSpacebase data-type set.
|
||||
/// \param id is the given address space
|
||||
/// \return the input Varnode corresponding to the base register
|
||||
Varnode *Funcdata::constructSpacebaseInput(AddrSpace *id)
|
||||
|
||||
{
|
||||
Varnode *spacePtr = findSpacebaseInput(id);
|
||||
if (spacePtr != (Varnode *)0)
|
||||
return spacePtr;
|
||||
if (id->numSpacebase() == 0)
|
||||
throw LowlevelError("Unable to construct pointer into space: "+id->getName());
|
||||
const VarnodeData &point(id->getSpacebase(0));
|
||||
Datatype *ct = glb->types->getTypeSpacebase(id,getAddress());
|
||||
Datatype *ptr = glb->types->getTypePointer(point.size,ct,id->getWordSize());
|
||||
spacePtr = newVarnode(point.size, point.getAddr(), ptr);
|
||||
spacePtr = setInputVarnode(spacePtr);
|
||||
spacePtr->setFlags(Varnode::spacebase);
|
||||
spacePtr->updateType(ptr, true, true);
|
||||
return spacePtr;
|
||||
}
|
||||
|
||||
/// \brief Create a constant representing the \e base of the given global address space
|
||||
///
|
||||
/// The constant will have the TypeSpacebase data-type set.
|
||||
/// \param id is the given address space
|
||||
/// \return the constant base Varnode
|
||||
Varnode *Funcdata::constructConstSpacebase(AddrSpace *id)
|
||||
|
||||
{
|
||||
Datatype *ct = glb->types->getTypeSpacebase(id,Address());
|
||||
Datatype *ptr = glb->types->getTypePointer(id->getAddrSize(),ct,id->getWordSize());
|
||||
Varnode *spacePtr = newConstant(id->getAddrSize(),0);
|
||||
spacePtr->updateType(ptr,true,true);
|
||||
spacePtr->setFlags(Varnode::spacebase);
|
||||
return spacePtr;
|
||||
}
|
||||
|
||||
/// \brief Convert a constant pointer into a \e ram CPUI_PTRSUB
|
||||
///
|
||||
/// A constant known to be a pointer into an address space like \b ram is converted
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue