Ghidra 11.3.2
Ghidra internal decompiler documentation.
Loading...
Searching...
No Matches
ghidra::MultiSlotDualAssign Class Reference

Consume multiple registers from different storage classes to pass a data-type. More...

#include <modelrules.hh>

Inheritance diagram for ghidra::MultiSlotDualAssign:
[legend]
Collaboration diagram for ghidra::MultiSlotDualAssign:
[legend]

Public Member Functions

 MultiSlotDualAssign (const ParamListStandard *res)
 Constructor for use with decode.
 
 MultiSlotDualAssign (type_class baseStore, type_class altStore, bool mostSig, bool justRight, const ParamListStandard *res)
 Constructor.
 
virtual AssignActionclone (const ParamListStandard *newResource) const
 Make a copy of this action.
 
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.
 
virtual bool fillinOutputMap (ParamActive *active) const
 Test if this action could produce return value storage matching the given set of trials.
 
virtual void decode (Decoder &decoder)
 Configure any details of how this action should behave from the stream.
 
- Public Member Functions inherited from ghidra::AssignAction
 AssignAction (const ParamListStandard *res)
 Constructor.
 
bool canAffectFillinOutput (void) const
 Return true if fillinOutputMap is active.
 

Private Member Functions

void initializeEntries (void)
 Cache specific ParamEntry needed by the action.
 
list< ParamEntry >::const_iterator getFirstUnused (list< ParamEntry >::const_iterator iter, type_class storage, vector< int4 > &status) const
 Get the first unused ParamEntry that matches the given storage class.
 
int4 getTileClass (const PrimitiveExtractor &primitives, int4 off, int4 &index) const
 Get the storage class to use for the specific section of the data-type.
 

Private Attributes

type_class baseType
 Resource list from which to consume general tiles.
 
type_class altType
 Resource list from which to consume alternate tiles.
 
bool consumeMostSig
 True if resources are consumed starting with most significant bytes.
 
bool justifyRight
 True if initial bytes are padding for odd data-type sizes.
 
int4 tileSize
 Number of bytes in a tile.
 
list< ParamEntry >::const_iterator baseIter
 Iterator to first element in the base resource list.
 
list< ParamEntry >::const_iterator altIter
 Iterator to first element in alternate resource list.
 

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.
 
static AssignActiondecodeSideeffect (Decoder &decoder, const ParamListStandard *res)
 Read the next model rule sideeffect element from the stream.
 
- Protected Attributes inherited from ghidra::AssignAction
const ParamListStandardresource
 Resources to which this action applies.
 
bool fillinOutputActive
 If true, fillinOutputMap is active.
 

Detailed Description

Consume multiple registers from different storage classes to pass a data-type.

This action is for calling conventions that can use both floating-point and general purpose registers when assigning storage for a single composite data-type, such as the X86-64 System V ABI

Constructor & Destructor Documentation

◆ MultiSlotDualAssign()

ghidra::MultiSlotDualAssign::MultiSlotDualAssign ( const ParamListStandard res)

Constructor for use with decode.

Set default configuration

Parameters
resis the new resource set to associate with this action

References altType, baseType, consumeMostSig, ghidra::AssignAction::fillinOutputActive, ghidra::ParamListStandard::getSpacebase(), ghidra::AddrSpace::isBigEndian(), justifyRight, tileSize, ghidra::TYPECLASS_FLOAT, and ghidra::TYPECLASS_GENERAL.

Member Function Documentation

◆ assignAddress()

uint4 ghidra::MultiSlotDualAssign::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::ParameterPieces::addr, altIter, altType, baseIter, baseType, consumeMostSig, ghidra::PrimitiveExtractor::containsHoles(), ghidra::AssignAction::fail, ghidra::AddrSpaceManager::findAddJoin(), ghidra::ParameterPieces::flags, ghidra::VarnodeData::getAddr(), ghidra::ParamEntry::getAddrBySlot(), ghidra::TypeFactory::getArch(), ghidra::ParamListStandard::getEntry(), getFirstUnused(), ghidra::ParamEntry::getGroup(), ghidra::Address::getOffset(), ghidra::ParamEntry::getSize(), ghidra::Datatype::getSize(), ghidra::Address::getSpace(), getTileClass(), ghidra::JoinRecord::getUnified(), ghidra::PrimitiveExtractor::isValid(), justifyRight, ghidra::AssignAction::resource, ghidra::PrimitiveExtractor::size(), ghidra::AssignAction::success, and ghidra::ParameterPieces::type.

◆ clone()

virtual AssignAction * ghidra::MultiSlotDualAssign::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 altType, baseType, consumeMostSig, and justifyRight.

◆ decode()

void ghidra::MultiSlotDualAssign::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 altType, baseType, ghidra::Decoder::closeElement(), ghidra::Decoder::getNextAttributeId(), initializeEntries(), justifyRight, ghidra::Decoder::openElement(), ghidra::Decoder::readBool(), and ghidra::Decoder::readString().

◆ fillinOutputMap()

bool ghidra::MultiSlotDualAssign::fillinOutputMap ( ParamActive active) const
virtual

Test if this action could produce return value storage matching the given set of trials.

If there is a return value data-type that could be assigned storage matching the trials by this action, return true. The trials have their matching ParamEntry and offset already set and are already sorted.

Parameters
activeis the given set of trials
Returns
true if the trials could form a valid return value

Reimplemented from ghidra::AssignAction.

References altType, baseType, consumeMostSig, ghidra::ParamTrial::getEntry(), ghidra::ParamEntry::getGroup(), ghidra::ParamActive::getNumTrials(), ghidra::ParamTrial::getOffset(), ghidra::ParamEntry::getSize(), ghidra::ParamTrial::getSize(), ghidra::ParamActive::getTrial(), ghidra::ParamEntry::getType(), ghidra::ParamEntry::isFirstInClass(), justifyRight, and ghidra::TYPECLASS_GENERAL.

◆ getFirstUnused()

list< ParamEntry >::const_iterator ghidra::MultiSlotDualAssign::getFirstUnused ( list< ParamEntry >::const_iterator  iter,
type_class  storage,
vector< int4 > &  status 
) const
private

Get the first unused ParamEntry that matches the given storage class.

Parameters
iterpoints to the starting entry to search
storageis the given storage class to match
statusis the usage information for the entries
Returns
the iterator to the unused ParamEntry

References ghidra::ParamEntry::getAllGroups(), ghidra::ParamListStandard::getEntry(), ghidra::ParamEntry::getGroup(), ghidra::ParamEntry::getType(), ghidra::ParamEntry::isExclusion(), and ghidra::AssignAction::resource.

Referenced by assignAddress().

◆ getTileClass()

int4 ghidra::MultiSlotDualAssign::getTileClass ( const PrimitiveExtractor primitives,
int4  off,
int4 &  index 
) const
private

Get the storage class to use for the specific section of the data-type.

For the section starting at off extending through tileSize bytes, if any primitive overlaps the boundary of the section, return -1. Otherwise, if all the primitive data-types in the section match the alternate storage class, return 1, or if one or more does not match, return 0. The index of the first primitive after the start of the section is provided and is then updated to be the first primitive after the end of the section.

Parameters
primitivesis the list of primitive data-types making up the data-type
offis the starting offset of the section
indexis the index of the first primitive in the section
Returns
0 for a base tile, 1 for an alternate tile, -1 for boundary overlaps

References altType, ghidra::PrimitiveExtractor::Primitive::dt, ghidra::PrimitiveExtractor::get(), ghidra::Datatype::getMetatype(), ghidra::Datatype::getSize(), ghidra::PrimitiveExtractor::Primitive::offset, ghidra::PrimitiveExtractor::size(), and tileSize.

Referenced by assignAddress().

◆ initializeEntries()

void ghidra::MultiSlotDualAssign::initializeEntries ( void  )
private

Cache specific ParamEntry needed by the action.

Find the first ParamEntry matching the baseType, and the first matching altType.

References altIter, altType, baseIter, baseType, ghidra::ParamListStandard::getEntry(), ghidra::ParamListStandard::getFirstIter(), ghidra::AssignAction::resource, and tileSize.

Referenced by decode(), and MultiSlotDualAssign().


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