Class CallingConventionUtil
java.lang.Object
com.pnfsoftware.jeb.core.units.code.asm.type.CallingConventionUtil
Utility routines for calling convention objects.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetInputRegisters
(ICallingConvention cc, Endianness endian) static Collection<Long>
static Collection<Long>
getOutputRegisters
(ICallingConvention cc, Endianness endian) static int
getParameterIndexByArgumentStackOffset
(ICallingConvention cc, IPrototypeItem proto, int stackOffset, int stackSlotSize) Given a calling convention and a stack offset, determine a method's parameter index (if the parameter is on the stack on of course).getParameterRegisters
(ICallingConventionManager ccManager, Endianness endian) Collect parameter registers from all defined calling conventions in the given manager.getSpoiledRegisters
(ICallingConventionManager ccManager) Collect spoiled registers from all defined calling conventions in the given manager.static boolean
isValidForProcessor
(ICallingConvention cc, List<ProcessorType> candidateProcessors) static CallingConventionBuilder
Parse and create a new calling convention object.static ICallingConvention
parseAndBuild
(String data, boolean build)
-
Constructor Details
-
CallingConventionUtil
public CallingConventionUtil()
-
-
Method Details
-
getOrderedSingleInputRegisters
public static Collection<Long> getOrderedSingleInputRegisters(ICallingConvention cc, Endianness endian) -
getOrderedSingleOutputRegisters
public static Collection<Long> getOrderedSingleOutputRegisters(ICallingConvention cc, Endianness endian) -
getInputRegisters
- Parameters:
cc
- calling convention- Returns:
- a set of native register ids
-
getOutputRegisters
- Parameters:
cc
- calling convention- Returns:
- a set of native register ids
-
getParameterRegisters
public static Set<Long> getParameterRegisters(ICallingConventionManager ccManager, Endianness endian) Collect parameter registers from all defined calling conventions in the given manager.- Parameters:
ccManager
-- Returns:
- ids of the registers used as parameter in the known calling conventions
-
getSpoiledRegisters
Collect spoiled registers from all defined calling conventions in the given manager.- Parameters:
ccManager
-- Returns:
- ids of the registers used as parameter in the known calling conventions
-
getParameterIndexByArgumentStackOffset
public static int getParameterIndexByArgumentStackOffset(ICallingConvention cc, IPrototypeItem proto, int stackOffset, int stackSlotSize) Given a calling convention and a stack offset, determine a method's parameter index (if the parameter is on the stack on of course).- Parameters:
cc
-proto
-stackOffset
-stackSlotSize
-- Returns:
- -1 if undetermined
-
parseAndBuild
- Parameters:
data
-build
-- Returns:
-
parse
Parse and create a new calling convention object.- Parameters:
data
- definition of a calling convention, formatted as yaml data (see doc)- Returns:
- a calling convention object (the method throws
IllegalArgumentException
on error)
-
isValidForProcessor
public static boolean isValidForProcessor(ICallingConvention cc, List<ProcessorType> candidateProcessors)
-