decompiler  1.0.0
Public Member Functions | List of all members
ghidra::ParamListRegisterOut Class Reference

A model for passing back return values from a function. More...

#include <fspec.hh>

Inheritance diagram for ghidra::ParamListRegisterOut:
ghidra::ParamListStandard ghidra::ParamList ghidra::ParamListStandardOut

Public Member Functions

 ParamListRegisterOut (void)
 Constructor.
 
 ParamListRegisterOut (const ParamListRegisterOut &op2)
 Copy constructor.
 
virtual uint4 getType (void) const
 Get the type of parameter list.
 
virtual void assignMap (const vector< Datatype *> &proto, TypeFactory &typefactory, vector< ParameterPieces > &res) const
 Given list of data-types, map the list positions to storage locations. More...
 
virtual void fillinMap (ParamActive *active) const
 Given an unordered list of storage locations, calculate a function prototype. More...
 
virtual bool possibleParam (const Address &loc, int4 size) const
 Does the given storage location make sense as a parameter. More...
 
virtual ParamListclone (void) const
 Clone this parameter list model.
 
- Public Member Functions inherited from ghidra::ParamListStandard
 ParamListStandard (void)
 Construct for use with decode()
 
 ParamListStandard (const ParamListStandard &op2)
 Copy constructor.
 
const list< ParamEntry > & getEntry (void) const
 Get the list of parameter entries.
 
virtual bool checkJoin (const Address &hiaddr, int4 hisize, const Address &loaddr, int4 losize) const
 Check if the given two storage locations can represent a single logical parameter. More...
 
virtual bool checkSplit (const Address &loc, int4 size, int4 splitpoint) const
 Check if it makes sense to split a single storage location into two parameters. More...
 
virtual int4 characterizeAsParam (const Address &loc, int4 size) const
 Characterize whether the given range overlaps parameter storage. More...
 
virtual bool possibleParamWithSlot (const Address &loc, int4 size, int4 &slot, int4 &slotsize) const
 Pass-back the slot and slot size for the given storage location as a parameter. More...
 
virtual bool getBiggestContainedParam (const Address &loc, int4 size, VarnodeData &res) const
 Pass-back the biggest parameter contained within the given range. More...
 
virtual bool unjustifiedContainer (const Address &loc, int4 size, VarnodeData &res) const
 Check if the given storage location looks like an unjustified parameter. More...
 
virtual OpCode assumedExtension (const Address &addr, int4 size, VarnodeData &res) const
 Get the type of extension and containing parameter for the given storage. More...
 
virtual AddrSpacegetSpacebase (void) const
 Get the address space associated with any stack based parameters in this list. More...
 
virtual void getRangeList (AddrSpace *spc, RangeList &res) const
 For a given address space, collect all the parameter locations within that space. More...
 
virtual int4 getMaxDelay (void) const
 Return the maximum heritage delay across all possible parameters. More...
 
virtual void decode (Decoder &decoder, vector< EffectRecord > &effectlist, bool normalstack)
 Restore the model from an <input> or <output> element in the stream. More...
 
- Public Member Functions inherited from ghidra::ParamList
virtual ~ParamList (void)
 Destructor.
 

Additional Inherited Members

- Public Types inherited from ghidra::ParamList
enum  {
  p_standard, p_standard_out, p_register, p_register_out,
  p_merged
}
 
- Protected Member Functions inherited from ghidra::ParamListStandard
const ParamEntryfindEntry (const Address &loc, int4 size) const
 Given storage location find matching ParamEntry. More...
 
Address assignAddress (const Datatype *tp, vector< int4 > &status) const
 Assign storage for given parameter data-type. More...
 
const ParamEntryselectUnreferenceEntry (int4 grp, type_metatype prefType) const
 Select entry to fill an unreferenced param. More...
 
void buildTrialMap (ParamActive *active) const
 Build map from parameter trials to model ParamEntrys. More...
 
void separateSections (ParamActive *active, vector< int4 > &trialStart) const
 Calculate the range of trials in each resource sections. More...
 
void calcDelay (void)
 Calculate the maximum heritage delay for any potential parameter in this list.
 
void addResolverRange (AddrSpace *spc, uintb first, uintb last, ParamEntry *paramEntry, int4 position)
 Internal method for adding a single address range to the ParamEntryResolvers. More...
 
void populateResolver (void)
 Build the ParamEntry resolver maps. More...
 
void parsePentry (Decoder &decoder, vector< EffectRecord > &effectlist, int4 groupid, bool normalstack, bool autokill, bool splitFloat, bool grouped)
 Parse a <pentry> element and add it to this list. More...
 
void parseGroup (Decoder &decoder, vector< EffectRecord > &effectlist, int4 groupid, bool normalstack, bool autokill, bool splitFloat)
 Parse a sequence of <pentry> elements that are allocated as a group. More...
 
- Static Protected Member Functions inherited from ghidra::ParamListStandard
static void markGroupNoUse (ParamActive *active, int4 activeTrial, int4 trialStart)
 Mark all the trials within the indicated groups as not used, except for one specified index. More...
 
static void markBestInactive (ParamActive *active, int4 group, int4 groupStart, type_metatype prefType)
 From among multiple inactive trials, select the most likely to be active and mark others as not used. More...
 
static void forceExclusionGroup (ParamActive *active)
 Enforce exclusion rules for the given set of parameter trials. More...
 
static void forceNoUse (ParamActive *active, int4 start, int4 stop)
 Mark every trial above the first "definitely not used" as inactive. More...
 
static void forceInactiveChain (ParamActive *active, int4 maxchain, int4 start, int4 stop, int4 groupstart)
 Enforce rules about chains of inactive slots. More...
 
- Protected Attributes inherited from ghidra::ParamListStandard
int4 numgroup
 Number of groups in this parameter convention.
 
int4 maxdelay
 Maximum heritage delay across all parameters.
 
int4 pointermax
 If non-zero, maximum size of a data-type before converting to a pointer.
 
bool thisbeforeret
 Does a this parameter come before a hidden return parameter.
 
vector< int4 > resourceStart
 The starting group for each resource section.
 
list< ParamEntryentry
 The ordered list of parameter entries.
 
vector< ParamEntryResolver * > resolverMap
 Map from space id to resolver.
 
AddrSpacespacebase
 Address space containing relative offset parameters.
 

Detailed Description

A model for passing back return values from a function.

This is a resource list of potential storage locations for a return value, at most 1 of which will be chosen for a given function. This models a simple strategy for selecting a storage location. When assigning based on data-type (assignMap), the first list entry that fits is chosen. When assigning from a set of actively used locations (fillinMap), this class chooses the location that is the closest fitting match to an entry in the resource list.

Member Function Documentation

◆ assignMap()

void ghidra::ParamListRegisterOut::assignMap ( const vector< Datatype *> &  proto,
TypeFactory typefactory,
vector< ParameterPieces > &  res 
) const
virtual

Given list of data-types, map the list positions to storage locations.

If we know the function prototype, recover how parameters are actually stored using the model.

Parameters
protois the ordered list of data-types
typefactoryis the TypeFactory (for constructing pointers)
reswill contain the storage locations corresponding to the datatypes

Reimplemented from ghidra::ParamListStandard.

Reimplemented in ghidra::ParamListStandardOut.

References ghidra::TYPE_VOID.

◆ fillinMap()

void ghidra::ParamListRegisterOut::fillinMap ( ParamActive active) const
virtual

Given an unordered list of storage locations, calculate a function prototype.

A list of input (or output) trials is given, which may have holes, invalid inputs etc. Decide on the formal ordered parameter list. Trials within the ParamActive are added, removed, or reordered as needed.

Parameters
activeis the given list of trials

Reimplemented from ghidra::ParamListStandard.

References ghidra::ParamEntry::getMinSize(), ghidra::ParamActive::getNumTrials(), ghidra::ParamTrial::getSize(), ghidra::ParamActive::getTrial(), ghidra::ParamEntry::getType(), ghidra::ParamEntry::isParamCheckHigh(), ghidra::ParamEntry::isParamCheckLow(), ghidra::ParamEntry::justifiedContain(), ghidra::ParamTrial::markNoUse(), ghidra::ParamActive::sortTrials(), and ghidra::TYPE_PTR.

◆ possibleParam()

bool ghidra::ParamListRegisterOut::possibleParam ( const Address loc,
int4  size 
) const
virtual

Does the given storage location make sense as a parameter.

Within this model, decide if the storage location can be considered a parameter.

Parameters
locis the starting address of the storage location
sizeis the number of bytes in the storage location
Returns
true if the location can be a parameter

Reimplemented from ghidra::ParamListStandard.


The documentation for this class was generated from the following files: