Package ghidra.program.model.lang
Class ParamListStandard
java.lang.Object
ghidra.program.model.lang.ParamListStandard
- All Implemented Interfaces:
ParamList
- Direct Known Subclasses:
ParamListStandardOut
Standard analysis for parameter lists
-
Nested Class Summary
Nested classes/interfaces inherited from interface ghidra.program.model.lang.ParamList
ParamList.WithSlotRec -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected ParamEntry[]protected Languageprotected ModelRule[]protected intprotected AddressSpaceprotected booleanprotected boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintassignAddress(DataType dt, PrototypePieces proto, int pos, DataTypeManager dtManager, int[] status, ParameterPieces res) Fill in the Address and other details for the given parameter Attempt to apply a ModelRule first.intassignAddressFallback(StorageClass resource, DataType tp, boolean matchExact, int[] status, ParameterPieces param) Assign storage for given parameter class, using the fallback assignment algorithm Given a resource list, a data-type, and the status of previously allocated slots, select the storage location for the parameter.voidassignMap(PrototypePieces proto, DataTypeManager dtManager, ArrayList<ParameterPieces> res, boolean addAutoParams) Given a list of datatypes, calculate the storage locations used for passing those data-typesvoidIf there is a ParamEntry corresponding to the stack resource in this list, return it.extractTiles(StorageClass resType) Extract all ParamEntry that have the given storage class and are single registers.getEntry(int index) Within this list, get the ParamEntry at the given indexintGet a list of all parameter storage locations consisting of a single registerGet the address space associated with any stack based parameters in this list.intReturn the amount of alignment used for parameters passed on the stack, or -1 if there are no stack paramsFind the boundary offset that separates parameters on the stack from other local variables This is usually the address of the first stack parameter, but if the stack grows positive, this is the first address AFTER the parameters on the stackbooleanisEquivalent(ParamList obj) Determine if this ParmList is equivalent to another instancebooleanReturn true if the this pointer occurs before an indirect return pointer The automatic parameters: this parameter and the hidden return value pointer both tend to be allocated from the initial general purpose registers reserved for parameter passing.booleanpossibleParamWithSlot(Address loc, int size, ParamList.WithSlotRec res) Determine if a particular address range is a possible parameter, and if so what slot(s) it occupiesvoidrestoreXml(XmlPullParser parser, CompilerSpec cspec)
-
Field Details
-
language
-
numgroup
protected int numgroup -
thisbeforeret
protected boolean thisbeforeret -
autoKilledByCall
protected boolean autoKilledByCall -
splitMetatype
protected boolean splitMetatype -
entry
-
modelRules
-
spacebase
-
-
Constructor Details
-
ParamListStandard
public ParamListStandard()
-
-
Method Details
-
assignAddressFallback
public int assignAddressFallback(StorageClass resource, DataType tp, boolean matchExact, int[] status, ParameterPieces param) Assign storage for given parameter class, using the fallback assignment algorithm Given a resource list, a data-type, and the status of previously allocated slots, select the storage location for the parameter. The status array is indexed by group: a positive value indicates how many slots have been allocated from that group, and a -1 indicates the group/resource is fully consumed. If an Address can be assigned to the parameter, it and other details are passed back in the ParameterPieces object and the SUCCESS code is returned. Otherwise, the FAIL code is returned.- Parameters:
resource- is the resource list to allocate fromtp- is the data-type of the parametermatchExact- is false if TYPECLASS_GENERAL is considered a match for any storage classstatus- is an array marking how many slots have already been consumed in a groupparam- will hold the address and other details of the assigned parameter- Returns:
- either SUCCESS or FAIL
-
assignAddress
public int assignAddress(DataType dt, PrototypePieces proto, int pos, DataTypeManager dtManager, int[] status, ParameterPieces res) Fill in the Address and other details for the given parameter Attempt to apply a ModelRule first. If these do not succeed, use the fallback assignment algorithm.- Parameters:
dt- is the data-type assigned to the parameterproto- is the description of the function prototypepos- is the position of the parameter to assign (pos=-1 for output, pos >=0 for input)dtManager- is the data-type manager for (possibly) transforming the parameter's data-typestatus- is the consumed resource status arrayres- is parameter description to be filled in- Returns:
- the response code
-
getNumParamEntry
public int getNumParamEntry()- Returns:
- the number of ParamEntry objets in this list
-
getEntry
Within this list, get the ParamEntry at the given index- Parameters:
index- is the given index- Returns:
- the selected ParamEntry
-
assignMap
public void assignMap(PrototypePieces proto, DataTypeManager dtManager, ArrayList<ParameterPieces> res, boolean addAutoParams) Description copied from interface:ParamListGiven a list of datatypes, calculate the storage locations used for passing those data-types -
getPotentialRegisterStorage
Description copied from interface:ParamListGet a list of all parameter storage locations consisting of a single register- Specified by:
getPotentialRegisterStoragein interfaceParamList- Parameters:
prog- is the controlling program- Returns:
- an array of VariableStorage
-
encode
- Specified by:
encodein interfaceParamList- Throws:
IOException
-
restoreXml
- Specified by:
restoreXmlin interfaceParamList- Throws:
XmlParseException
-
getStackParameterAlignment
public int getStackParameterAlignment()Description copied from interface:ParamListReturn the amount of alignment used for parameters passed on the stack, or -1 if there are no stack params- Specified by:
getStackParameterAlignmentin interfaceParamList- Returns:
- the alignment
-
getStackParameterOffset
Description copied from interface:ParamListFind the boundary offset that separates parameters on the stack from other local variables This is usually the address of the first stack parameter, but if the stack grows positive, this is the first address AFTER the parameters on the stack- Specified by:
getStackParameterOffsetin interfaceParamList- Returns:
- the boundary offset
-
possibleParamWithSlot
Description copied from interface:ParamListDetermine if a particular address range is a possible parameter, and if so what slot(s) it occupies- Specified by:
possibleParamWithSlotin interfaceParamList- Parameters:
loc- is the starting address of the rangesize- is the size of the range in bytesres- holds the resulting slot and slotsize- Returns:
- true if the range is a possible parameter
-
getLanguage
- Specified by:
getLanguagein interfaceParamList- Returns:
- the associated Language
-
getSpacebase
Description copied from interface:ParamListGet the address space associated with any stack based parameters in this list.- Specified by:
getSpacebasein interfaceParamList- Returns:
- the stack address space, if this models parameters passed on the stack, null otherwise
-
isEquivalent
Description copied from interface:ParamListDetermine if this ParmList is equivalent to another instance- Specified by:
isEquivalentin interfaceParamList- Parameters:
obj- is the other instance- Returns:
- true if they are equivalent
-
isThisBeforeRetPointer
public boolean isThisBeforeRetPointer()Description copied from interface:ParamListReturn true if the this pointer occurs before an indirect return pointer The automatic parameters: this parameter and the hidden return value pointer both tend to be allocated from the initial general purpose registers reserved for parameter passing. This method returns true if the this parameter is allocated first.- Specified by:
isThisBeforeRetPointerin interfaceParamList- Returns:
- false if the hidden return value pointer is allocated first
-
extractTiles
Extract all ParamEntry that have the given storage class and are single registers.- Parameters:
resType- is the given storage class- Returns:
- the array of registers
-
extractStack
If there is a ParamEntry corresponding to the stack resource in this list, return it.- Returns:
- the stack ParamEntry or null
-