decompiler  1.0.0
Public Types | Public Member Functions | List of all members
ParamList Class Referenceabstract

#include <fspec.hh>

Inheritance diagram for ParamList:
ParamListStandard ParamListMerged ParamListRegister ParamListStandardOut

Public Types

enum  { p_standard, p_standard_out, p_register, p_merged }
 

Public Member Functions

virtual ~ParamList (void)
 Destructor.
 
virtual uint4 getType (void) const =0
 Get the type of parameter list.
 
virtual void assignMap (const vector< Datatype * > &proto, bool isinput, TypeFactory &typefactory, vector< ParameterPieces > &res) const =0
 Given list of data-types, map the list positions to storage locations. More...
 
virtual void fillinMap (ParamActive *active) const =0
 Given an unordered list of storage locations, calculate a function prototype. More...
 
virtual bool checkJoin (const Address &hiaddr, int4 hisize, const Address &loaddr, int4 losize) const =0
 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 =0
 Check if it makes sense to split a single storage location into two parameters. More...
 
virtual int4 characterizeAsParam (const Address &loc, int4 size) const =0
 Characterize whether the given range overlaps parameter storage. More...
 
virtual bool possibleParam (const Address &loc, int4 size) const =0
 Does the given storage location make sense as a parameter. More...
 
virtual bool possibleParamWithSlot (const Address &loc, int4 size, int4 &slot, int4 &slotsize) const =0
 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 =0
 Pass-back the biggest parameter contained within the given range. More...
 
virtual bool unjustifiedContainer (const Address &loc, int4 size, VarnodeData &res) const =0
 Check if the given storage location looks like an unjustified parameter. More...
 
virtual OpCode assumedExtension (const Address &addr, int4 size, VarnodeData &res) const =0
 Get the type of extension and containing parameter for the given storage. More...
 
virtual AddrSpacegetSpacebase (void) const =0
 Get the address space associated with any stack based parameters in this list. More...
 
virtual void getRangeList (AddrSpace *spc, RangeList &res) const =0
 For a given address space, collect all the parameter locations within that space. More...
 
virtual int4 getMaxDelay (void) const =0
 Return the maximum heritage delay across all possible parameters. More...
 
virtual void restoreXml (const Element *el, const AddrSpaceManager *manage, vector< EffectRecord > &effectlist, bool normalstack)=0
 Restore the model from an XML stream. More...
 
virtual ParamListclone (void) const =0
 Clone this parameter list model.
 

Detailed Description

A group of ParamEntry objects that form a complete set for passing parameters in one direction (either input or output). The main tasks this class must perform are:

Member Enumeration Documentation

anonymous enum
Enumerator
p_standard 

Standard input parameter model.

p_standard_out 

Standard output (return value) model.

p_register 

Unordered parameter passing locations model.

p_merged 

A merged model (multiple models merged together)

Member Function Documentation

virtual void ParamList::assignMap ( const vector< Datatype * > &  proto,
bool  isinput,
TypeFactory typefactory,
vector< ParameterPieces > &  res 
) const
pure 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
isinputis true for the input prototype, false for output prototype
typefactoryis the TypeFactory (for constructing pointers)
reswill contain the storage locations corresponding to the datatypes

Implemented in ParamListMerged, ParamListStandardOut, and ParamListStandard.

virtual OpCode ParamList::assumedExtension ( const Address addr,
int4  size,
VarnodeData res 
) const
pure virtual

Get the type of extension and containing parameter for the given storage.

If the given storage is properly contained within a normal parameter and the model typically extends a small value into the full container, pass back the full container and the type of extension.

Parameters
addris the starting address of the given storage
sizeis the number of bytes in the given storage
resis the parameter storage to pass back
Returns
the extension operator (INT_ZEXT INT_SEXT) or INT_COPY if there is no extension. INT_PIECE indicates the extension is determined by the specific prototype.

Implemented in ParamListStandard.

Referenced by ProtoModel::assumedInputExtension(), and ProtoModel::assumedOutputExtension().

virtual int4 ParamList::characterizeAsParam ( const Address loc,
int4  size 
) const
pure virtual

Characterize whether the given range overlaps parameter storage.

Does the range naturally fit inside a potential parameter entry from this list or does it contain a parameter entry. Return one of three values indicating this characterization:

  • 0 means there is no intersection between the range and any parameter in this list
  • 1 means that at least one parameter contains the range in a properly justified manner
  • 2 means no parameter contains the range, but the range contains at least one ParamEntry
    Parameters
    locis the starting address of the given range
    sizeis the number of bytes in the given range
    Returns
    the characterization code

Implemented in ParamListStandard.

Referenced by ProtoModel::characterizeAsInputParam().

virtual bool ParamList::checkJoin ( const Address hiaddr,
int4  hisize,
const Address loaddr,
int4  losize 
) const
pure virtual

Check if the given two storage locations can represent a single logical parameter.

Within the conventions of this model, do the two (hi/lo) locations represent consecutive parameter locations that can be replaced by a single logical parameter.

Parameters
hiaddris the address of the most significant part of the value
hisizeis the size of the most significant part in bytes
loaddris the address of the least significant part of the value
losizeis the size of the least significant part in bytes
Returns
true if the two pieces can be joined

Implemented in ParamListStandard.

Referenced by ProtoModel::checkInputJoin(), and ProtoModel::checkOutputJoin().

virtual bool ParamList::checkSplit ( const Address loc,
int4  size,
int4  splitpoint 
) const
pure virtual

Check if it makes sense to split a single storage location into two parameters.

A storage location and split point is provided, implying two new storage locations. Does this model allow these locations to be considered parameters.

Parameters
locis the starting address of provided storage location
sizeis the size of the location in bytes
splitpointis the number of bytes to consider in the first (in address order) piece
Returns
true if the storage location can be split

Implemented in ParamListStandard.

Referenced by ProtoModel::checkInputSplit().

virtual void ParamList::fillinMap ( ParamActive active) const
pure 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

Implemented in ParamListMerged, ParamListRegister, ParamListStandardOut, and ParamListStandard.

Referenced by ProtoModel::deriveInputMap(), and ProtoModel::deriveOutputMap().

virtual bool ParamList::getBiggestContainedParam ( const Address loc,
int4  size,
VarnodeData res 
) const
pure virtual

Pass-back the biggest parameter contained within the given range.

Parameters
locis the starting address of the given range
sizeis the number of bytes in the range
reswill hold the parameter storage description being passed back
Returns
true if there is at least one parameter contained in the range

Implemented in ParamListStandard.

Referenced by ProtoModel::getBiggestContainedInputParam().

virtual int4 ParamList::getMaxDelay ( void  ) const
pure virtual

Return the maximum heritage delay across all possible parameters.

Depending on the address space, data-flow for a parameter may not be available until extra transform passes have completed. This method returns the number of passes that must occur before we can guarantee that all parameters have data-flow info.

Returns
the maximum number of passes across all parameters in this model

Implemented in ParamListStandard.

Referenced by ProtoModel::getMaxInputDelay(), and ProtoModel::getMaxOutputDelay().

virtual void ParamList::getRangeList ( AddrSpace spc,
RangeList res 
) const
pure virtual

For a given address space, collect all the parameter locations within that space.

Pass back the memory ranges for any parameter that is stored in the given address space.

Parameters
spcis the given address space
reswill hold the set of matching memory ranges

Implemented in ParamListStandard.

virtual AddrSpace* ParamList::getSpacebase ( void  ) const
pure virtual

Get the address space associated with any stack based parameters in this list.

Returns
the stack address space, if this models parameters passed on the stack, NULL otherwise

Implemented in ParamListStandard.

Referenced by ProtoModel::getSpacebase().

virtual bool ParamList::possibleParam ( const Address loc,
int4  size 
) const
pure 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

Implemented in ParamListStandardOut, and ParamListStandard.

Referenced by ProtoModel::possibleInputParam(), and ProtoModel::possibleOutputParam().

virtual bool ParamList::possibleParamWithSlot ( const Address loc,
int4  size,
int4 &  slot,
int4 &  slotsize 
) const
pure virtual

Pass-back the slot and slot size for the given storage location as a parameter.

This checks if the given storage location acts as a parameter in this model and passes back the number of slots that it occupies.

Parameters
locis the starting address of the storage location
sizeis the number of bytes in the storage location
slotif the slot number to pass back
slotsizeis the number of consumed slots to pass back
Returns
true if the location can be a parameter

Implemented in ParamListStandard.

Referenced by ProtoModel::possibleInputParamWithSlot(), and ProtoModel::possibleOutputParamWithSlot().

virtual void ParamList::restoreXml ( const Element el,
const AddrSpaceManager manage,
vector< EffectRecord > &  effectlist,
bool  normalstack 
)
pure virtual

Restore the model from an XML stream.

Parameters
elis the root <input> or <output> element
manageis used to resolve references to address spaces
effectlistis a container collecting EffectRecords across all parameters
normalstackis true if parameters are pushed on the stack in the normal order

Implemented in ParamListStandardOut, and ParamListStandard.

virtual bool ParamList::unjustifiedContainer ( const Address loc,
int4  size,
VarnodeData res 
) const
pure virtual

Check if the given storage location looks like an unjustified parameter.

The storage for a value may be contained in a normal parameter location but be unjustified within that container, i.e. the least significant bytes are not being used. If this is the case, pass back the full parameter location and return true.

Parameters
locis the starting address of the given storage
sizeis the number of bytes in the given storage
resis the full parameter storage to pass back
Returns
true if the given storage is unjustified within its parameter container

Implemented in ParamListStandard.

Referenced by ProtoModel::unjustifiedInputParam().


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