decompiler 1.0.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ghidra::ConsumeExtra Class Reference

Consume additional registers from an alternate resource list. More...

#include <modelrules.hh>

Inheritance diagram for ghidra::ConsumeExtra:
ghidra::AssignAction

Public Member Functions

 ConsumeExtra (const ParamListStandard *res)
 Constructor for use with decode.
 
 ConsumeExtra (type_class store, bool match, const ParamListStandard *res)
 Constructor.
 
virtual AssignActionclone (const ParamListStandard *newResource) const
 Make a copy of this action. More...
 
virtual uint4 assignAddress (Datatype *dt, const PrototypePieces &proto, int4 pos, TypeFactory &tlist, vector< int4 > &status, ParameterPieces &res) const
 Assign an address and other meta-data for a specific parameter or for return storage in context. More...
 
virtual void decode (Decoder &decoder)
 Configure any details of how this action should behave from the stream. More...
 
- Public Member Functions inherited from ghidra::AssignAction
 AssignAction (const ParamListStandard *res)
 Constructor.
 
bool canAffectFillinOutput (void) const
 Return true if fillinOutputMap is active.
 
virtual AssignActionclone (const ParamListStandard *newResource) const =0
 Make a copy of this action. More...
 
virtual uint4 assignAddress (Datatype *dt, const PrototypePieces &proto, int4 pos, TypeFactory &tlist, vector< int4 > &status, ParameterPieces &res) const =0
 Assign an address and other meta-data for a specific parameter or for return storage in context. More...
 
virtual bool fillinOutputMap (ParamActive *active) const
 Test if this action could produce return value storage matching the given set of trials. More...
 
virtual void decode (Decoder &decoder)=0
 Configure any details of how this action should behave from the stream. More...
 

Private Member Functions

void initializeEntries (void)
 Cache specific ParamEntry needed by the action. More...
 

Private Attributes

type_class resourceType
 The other resource list to consume from.
 
bool matchSize
 false, if side-effect only consumes a single register
 
vector< const ParamEntry * > tiles
 List of registers that can be consumed.
 

Additional Inherited Members

- Public Types inherited from ghidra::AssignAction
enum  {
  success , fail , no_assignment , hiddenret_ptrparam ,
  hiddenret_specialreg , hiddenret_specialreg_void
}
 
- Static Public Member Functions inherited from ghidra::AssignAction
static AssignActiondecodeAction (Decoder &decoder, const ParamListStandard *res)
 Read the next model rule action element from the stream. More...
 
static AssignActiondecodePrecondition (Decoder &decoder, const ParamListStandard *res)
 Read the next model rule precondition element from the stream. More...
 
static AssignActiondecodeSideeffect (Decoder &decoder, const ParamListStandard *res)
 Read the next model rule sideeffect element from the stream. More...
 
static void justifyPieces (vector< VarnodeData > &pieces, int4 offset, bool isBigEndian, bool consumeMostSig, bool justifyRight)
 Truncate a tiling by a given number of bytes. More...
 
- Protected Attributes inherited from ghidra::AssignAction
const ParamListStandardresource
 Resources to which this action applies.
 
bool fillinOutputActive
 If true, fillinOutputMap is active.
 

Detailed Description

Consume additional registers from an alternate resource list.

This action is a side-effect and doesn't assign an address for the current parameter. The resource list, resourceType, is specified. If the side-effect is triggered, register resources from this list are consumed. If matchSize is true (the default), registers are consumed, until the number of bytes in the data-type is reached. Otherwise, only a single register is consumed. If all registers are already consumed, no action is taken.

Member Function Documentation

◆ assignAddress()

uint4 ghidra::ConsumeExtra::assignAddress ( Datatype dt,
const PrototypePieces proto,
int4  pos,
TypeFactory tlist,
vector< int4 > &  status,
ParameterPieces res 
) const
virtual

Assign an address and other meta-data for a specific parameter or for return storage in context.

The Address is assigned based on the data-type of the parameter, available register resources, and other details of the function prototype. Consumed resources are marked. This method returns a response code:

  • success - indicating the Address was successfully assigned
  • fail - if the Address could not be assigned
  • hiddenret_ptrparam - if an additional hidden return parameter is required
Parameters
dtis the data-type of the parameter or return value
protois the high-level description of the function prototype
posis the position of the parameter (pos>=0) or return storage (pos=-1)
tlistis a data-type factory for (possibly) transforming the data-type
statusis the resource consumption array
reswill hold the resulting description of the parameter
Returns
the response code

Implements ghidra::AssignAction.

References ghidra::ParamEntry::getGroup(), ghidra::ParamEntry::getSize(), ghidra::Datatype::getSize(), matchSize, ghidra::AssignAction::success, and tiles.

◆ clone()

virtual AssignAction * ghidra::ConsumeExtra::clone ( const ParamListStandard newResource) const
inlinevirtual

Make a copy of this action.

Parameters
newResourceis the new resource object that will own the clone
Returns
the newly allocated copy

Implements ghidra::AssignAction.

References ConsumeExtra(), matchSize, and resourceType.

◆ decode()

void ghidra::ConsumeExtra::decode ( Decoder decoder)
virtual

Configure any details of how this action should behave from the stream.

Parameters
decoderis the given stream decoder

Implements ghidra::AssignAction.

References ghidra::Decoder::closeElement(), ghidra::Decoder::getNextAttributeId(), initializeEntries(), matchSize, ghidra::Decoder::openElement(), ghidra::Decoder::readBool(), ghidra::Decoder::readString(), and resourceType.

◆ initializeEntries()

void ghidra::ConsumeExtra::initializeEntries ( void  )
private

Cache specific ParamEntry needed by the action.

Find the first ParamEntry matching the resourceType.

References ghidra::ParamListStandard::extractTiles(), ghidra::AssignAction::resource, resourceType, and tiles.

Referenced by ConsumeExtra(), and decode().


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