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
Modifier and TypeFieldDescriptionprotected ParamEntry[]
protected ModelRule[]
protected int
protected AddressSpace
protected boolean
protected boolean
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
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.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.void
assignMap
(PrototypePieces proto, DataTypeManager dtManager, ArrayList<ParameterPieces> res, boolean addAutoParams) Given a list of datatypes, calculate the storage locations used for passing those data-typesvoid
getEntry
(int index) Within this list, get the ParamEntry at the given indexint
Get a list of all parameter storage locations consisting of a single registerGet the address space associated with any stack based parameters in this list.int
Return 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 stackboolean
isEquivalent
(ParamList obj) Determine if this ParmList is equivalent to another instanceboolean
Return 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.boolean
possibleParamWithSlot
(Address loc, int size, ParamList.WithSlotRec res) Determine if a particular address range is a possible parameter, and if so what slot(s) it occupiesvoid
restoreXml
(XmlPullParser parser, CompilerSpec cspec)
-
Field Details
-
numgroup
protected int numgroup -
thisbeforeret
protected boolean thisbeforeret -
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:ParamList
Given a list of datatypes, calculate the storage locations used for passing those data-types -
getPotentialRegisterStorage
Description copied from interface:ParamList
Get a list of all parameter storage locations consisting of a single register- Specified by:
getPotentialRegisterStorage
in interfaceParamList
- Parameters:
prog
- is the controlling program- Returns:
- an array of VariableStorage
-
encode
- Specified by:
encode
in interfaceParamList
- Throws:
IOException
-
restoreXml
- Specified by:
restoreXml
in interfaceParamList
- Throws:
XmlParseException
-
getStackParameterAlignment
public int getStackParameterAlignment()Description copied from interface:ParamList
Return the amount of alignment used for parameters passed on the stack, or -1 if there are no stack params- Specified by:
getStackParameterAlignment
in interfaceParamList
- Returns:
- the alignment
-
getStackParameterOffset
Description copied from interface:ParamList
Find 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:
getStackParameterOffset
in interfaceParamList
- Returns:
- the boundary offset
-
possibleParamWithSlot
Description copied from interface:ParamList
Determine if a particular address range is a possible parameter, and if so what slot(s) it occupies- Specified by:
possibleParamWithSlot
in 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
-
getSpacebase
Description copied from interface:ParamList
Get the address space associated with any stack based parameters in this list.- Specified by:
getSpacebase
in interfaceParamList
- Returns:
- the stack address space, if this models parameters passed on the stack, null otherwise
-
isEquivalent
Description copied from interface:ParamList
Determine if this ParmList is equivalent to another instance- Specified by:
isEquivalent
in interfaceParamList
- Parameters:
obj
- is the other instance- Returns:
- true if they are equivalent
-
isThisBeforeRetPointer
public boolean isThisBeforeRetPointer()Description copied from interface:ParamList
Return 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:
isThisBeforeRetPointer
in interfaceParamList
- Returns:
- false if the hidden return value pointer is allocated first
-