Class GoParamStorageAllocator

java.lang.Object
ghidra.app.util.bin.format.golang.GoParamStorageAllocator

public class GoParamStorageAllocator extends Object
Logic and helper for allocating storage for a function's parameters and return value.

Not threadsafe.

  • Constructor Details

  • Method Details

    • clone

      public GoParamStorageAllocator clone()
      Overrides:
      clone in class Object
    • getArchDescription

      public String getArchDescription()
    • isBigEndian

      public boolean isBigEndian()
    • resetRegAllocation

      public void resetRegAllocation()
    • setAbi0Mode

      public void setAbi0Mode()
    • isAbi0Mode

      public boolean isAbi0Mode()
    • getNextIntParamRegister

      public Register getNextIntParamRegister(Register reg)
      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

      public List<Register> getRegistersFor(DataType dt)
      Returns a list of registers 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 for
      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
    • getRegistersFor

      public List<Register> getRegistersFor(DataType dt, boolean allowEndianFixups)
      Returns a list of registers 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 for
      allowEndianFixups - 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

      public long getStackAllocation(DataType dt)
      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

      public void alignStackFor(DataType dt)
    • alignStack

      public void alignStack()