Class GoParamStorageAllocator
java.lang.Object
ghidra.app.util.bin.format.golang.GoParamStorageAllocator
Logic and helper for allocating storage for a function's parameters and return value.
Not threadsafe.
-
Constructor Summary
ConstructorDescriptionGoParamStorageAllocator
(Program program, GoVer goVersion) Creates a new golang function call storage allocator for the specified Ghidra Language. -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
clone()
Returns the integer parameter that follows the supplied register.Returns a list ofregisters
that will successfully store the specified data type, as well as marking those registers as used and unavailable.getRegistersFor
(DataType dt, boolean allowEndianFixups) Returns a list ofregisters
that will successfully store the specified data type, as well as marking those registers as used and unavailable.long
Returns the stack offset that should be used to store the data type on the stack, as well as marking that stack area as used and unavailable.long
boolean
boolean
void
void
void
setStackOffset
(long newStackOffset)
-
Constructor Details
-
GoParamStorageAllocator
Creates a new golang function call storage allocator for the specified Ghidra Language.See
GoRegisterInfoManager.getRegisterInfoForLang(Language, GoVer)
- Parameters:
program
-Program
goVersion
- version of go used to create the program
-
-
Method Details
-
clone
-
getArchDescription
-
isBigEndian
public boolean isBigEndian() -
resetRegAllocation
public void resetRegAllocation() -
setAbi0Mode
public void setAbi0Mode() -
isAbi0Mode
public boolean isAbi0Mode() -
getNextIntParamRegister
Returns the integer parameter that follows the supplied register.- Parameters:
reg
- register in the integer reg list- Returns:
- the following register of the queried register, or null if no following register found
-
getRegistersFor
Returns a list ofregisters
that will successfully store the specified data type, as well as marking those registers as used and unavailable. -
getRegistersFor
Returns a list ofregisters
that will successfully store the specified data type, as well as marking those registers as used and unavailable.- Parameters:
dt
-DataType
to allocate register space forallowEndianFixups
- boolean flag, if true the result (if it contains more than a single location) will automatically be adjusted in little endian programs to match how storage varnodes are laid-out, if false the result will not be adjusted- Returns:
- list of
registers
, possibly empty if the data type was zero-length, possibly null if the data type is not compatible with register storage
-
getStackAllocation
Returns the stack offset that should be used to store the data type on the stack, as well as marking that stack area as used and unavailable.- Parameters:
dt
-DataType
to allocate stack space for- Returns:
- offset in stack where the data item will be located
-
getStackOffset
public long getStackOffset() -
setStackOffset
public void setStackOffset(long newStackOffset) -
alignStackFor
-
alignStack
public void alignStack()
-