ROSE  0.11.145.0
Public Types | Public Member Functions | Protected Member Functions | List of all members
Rose::BinaryAnalysis::CallingConvention::Definition Class Reference

Description

Information about calling conventions.

A definition typically comes from external documentation rather than direct analysis.

Definition at line 86 of file CallingConvention.h.

#include <Rose/BinaryAnalysis/CallingConvention.h>

Inheritance diagram for Rose::BinaryAnalysis::CallingConvention::Definition:
Inheritance graph
[legend]
Collaboration diagram for Rose::BinaryAnalysis::CallingConvention::Definition:
Collaboration graph
[legend]

Public Types

using Ptr = DefinitionPtr
 Reference counting pointer to calling convention definition. More...
 

Public Member Functions

void clearParameters ()
 Erase all parameters. More...
 
const std::vector< ConcreteLocation > & inputParameters () const
 Property: Enumerated input parameters. More...
 
RegisterParts inputRegisterParts () const
 Compute the set of input registers. More...
 
void clearInputParameters ()
 Erase enumerated input parameters. More...
 
const std::vector< ConcreteLocation > & outputParameters () const
 Property: List of output parameters. More...
 
RegisterParts outputRegisterParts () const
 Computes the set of output registers. More...
 
void clearOutputParameters ()
 Erase output parameters. More...
 
RegisterParts calleeSavedRegisterParts () const
 Compute the set of callee-saved registers. More...
 
RegisterParts scratchRegisterParts () const
 Computes the set of scratch registers. More...
 
RegisterParts getUsedRegisterParts () const
 Returns all registers mentioned in this definition. More...
 
RegisterDictionaryPtr registerDictionary () const
 Property: Register dictionary. More...
 
void registerDictionary (const RegisterDictionaryPtr &d)
 Property: Register dictionary. More...
 
const std::string & name () const
 Property: Short name of calling convention. More...
 
void name (const std::string &s)
 Property: Short name of calling convention. More...
 
const std::string & comment () const
 Property: Full name of calling convention. More...
 
void comment (const std::string &s)
 Property: Full name of calling convention. More...
 
size_t wordWidth () const
 Property: Word size in bits. More...
 
void wordWidth (size_t nBits)
 Property: Word size in bits. More...
 
const std::vector< ConcreteLocation > & nonParameterInputs () const
 Non-parameter inputs. More...
 
std::vector< ConcreteLocation > & nonParameterInputs ()
 Non-parameter inputs. More...
 
void appendInputParameter (const ConcreteLocation &)
 Append input parameter. More...
 
void appendInputParameter (RegisterDescriptor reg)
 Append input parameter. More...
 
void appendInputParameter (RegisterDescriptor reg, int64_t offset)
 Append input parameter. More...
 
void appendInputParameter (rose_addr_t va)
 Append input parameter. More...
 
void appendOutputParameter (const ConcreteLocation &)
 Append output parameter. More...
 
void appendOutputParameter (RegisterDescriptor reg)
 Append output parameter. More...
 
void appendOutputParameter (RegisterDescriptor reg, int64_t offset)
 Append output parameter. More...
 
void appendOutputParameter (rose_addr_t va)
 Append output parameter. More...
 
StackParameterOrder stackParameterOrder () const
 Property: Stack parameter order. More...
 
void stackParameterOrder (StackParameterOrder x)
 Property: Stack parameter order. More...
 
const RegisterDescriptor stackPointerRegister () const
 Property: Register for implied stack parameters. More...
 
void stackPointerRegister (RegisterDescriptor r)
 Property: Register for implied stack parameters. More...
 
size_t nonParameterStackSize () const
 Property: Size of non-parameter stack area. More...
 
void nonParameterStackSize (size_t nBytes)
 Property: Size of non-parameter stack area. More...
 
StackDirection stackDirection () const
 Property: Direction that stack grows for a push operation. More...
 
void stackDirection (StackDirection x)
 Property: Direction that stack grows for a push operation. More...
 
StackCleanup stackCleanup () const
 Property: Who pops stack parameters. More...
 
void stackCleanup (StackCleanup x)
 Property: Who pops stack parameters. More...
 
size_t stackAlignment () const
 Property: Stack alignment. More...
 
void stackAlignment (size_t nBytes)
 Property: Stack alignment. More...
 
const ConcreteLocationthisParameter () const
 Property: Object pointer parameter. More...
 
void thisParameter (const ConcreteLocation &x)
 Property: Object pointer parameter. More...
 
void thisParameter (RegisterDescriptor reg)
 Property: Object pointer parameter. More...
 
void thisParameter (RegisterDescriptor reg, int64_t offset)
 Property: Object pointer parameter. More...
 
void thisParameter (rose_addr_t va)
 Property: Object pointer parameter. More...
 
const ConcreteLocationreturnAddressLocation () const
 Property: Location of return address. More...
 
void returnAddressLocation (const ConcreteLocation &x)
 Property: Location of return address. More...
 
RegisterDescriptor instructionPointerRegister () const
 Property: Register that points to next instruction to execute.
 
void instructionPointerRegister (RegisterDescriptor x)
 Property: Register that points to next instruction to execute.
 
const std::set< RegisterDescriptor > & calleeSavedRegisters () const
 Property: Callee-saved registers. More...
 
std::set< RegisterDescriptor > & calleeSavedRegisters ()
 Property: Callee-saved registers. More...
 
const std::set< RegisterDescriptor > & scratchRegisters () const
 Property: Scratch registers. More...
 
std::set< RegisterDescriptor > & scratchRegisters ()
 Property: Scratch registers. More...
 
void print (std::ostream &) const
 Print detailed information about this calling convention. More...
 
void print (std::ostream &, const RegisterDictionaryPtr &regDict) const
 Print detailed information about this calling convention. More...
 
- Public Member Functions inherited from Sawyer::SharedObject
 SharedObject ()
 Default constructor. More...
 
 SharedObject (const SharedObject &)
 Copy constructor. More...
 
virtual ~SharedObject ()
 Virtual destructor. More...
 
SharedObjectoperator= (const SharedObject &)
 Assignment. More...
 

Static Public Member Functions

static Ptr x86_cdecl (const RegisterDictionaryPtr &)
 Constructs a new pre-defined calling convention based on a register dictionary.
 
static Ptr x86_stdcall (const RegisterDictionaryPtr &)
 Constructs a new pre-defined calling convention based on a register dictionary.
 
static Ptr x86_fastcall (const RegisterDictionaryPtr &)
 Constructs a new pre-defined calling convention based on a register dictionary.
 
static Ptr ppc_ibm (const RegisterDictionaryPtr &)
 Constructs a new pre-defined calling convention based on a register dictionary.
 

Protected Member Functions

 Definition ()
 Default constructor. More...
 

) and is a single word. The comment

Construct a new calling convention.

The name of the calling convention usually comes from the documentation (see is a more complete name for the convention perhaps including the operating system and architecture but not containing line termination.

 Definition (size_t wordWidth, const std::string &name, const std::string &comment, const RegisterDictionaryPtr &)
 Allocating constructor. More...
 
 ~Definition ()
 Allocating constructor. More...
 
static Ptr instance (size_t wordWidth, const std::string &name, const std::string &comment, const RegisterDictionaryPtr &regs)
 Allocating constructor. More...
 
static Ptr x86_32bit_cdecl ()
 Returns a predefined, cached calling convention.
 
static Ptr x86_64bit_cdecl ()
 Allocating constructor. More...
 
static Ptr x86_32bit_stdcall ()
 Allocating constructor. More...
 
static Ptr x86_64bit_stdcall ()
 Allocating constructor. More...
 
static Ptr x86_32bit_fastcall ()
 Allocating constructor. More...
 
static Ptr x86_64bit_sysv ()
 Allocating constructor. More...
 
static Ptr ppc_32bit_ibm ()
 Allocating constructor. More...
 

Member Typedef Documentation

Reference counting pointer to calling convention definition.

Definition at line 89 of file CallingConvention.h.

Constructor & Destructor Documentation

Rose::BinaryAnalysis::CallingConvention::Definition::Definition ( )
protected

Default constructor.

Constructs a new calling convention with no name or parameters.

Referenced by instance().

Rose::BinaryAnalysis::CallingConvention::Definition::Definition ( size_t  wordWidth,
const std::string &  name,
const std::string &  comment,
const RegisterDictionaryPtr  
)
protected

Allocating constructor.

Rose::BinaryAnalysis::CallingConvention::Definition::~Definition ( )

Allocating constructor.

Member Function Documentation

static Ptr Rose::BinaryAnalysis::CallingConvention::Definition::instance ( size_t  wordWidth,
const std::string &  name,
const std::string &  comment,
const RegisterDictionaryPtr regs 
)
inlinestatic

Allocating constructor.

Definition at line 157 of file CallingConvention.h.

References Definition().

static Ptr Rose::BinaryAnalysis::CallingConvention::Definition::x86_64bit_cdecl ( )
static

Allocating constructor.

static Ptr Rose::BinaryAnalysis::CallingConvention::Definition::x86_32bit_stdcall ( )
static

Allocating constructor.

static Ptr Rose::BinaryAnalysis::CallingConvention::Definition::x86_64bit_stdcall ( )
static

Allocating constructor.

static Ptr Rose::BinaryAnalysis::CallingConvention::Definition::x86_32bit_fastcall ( )
static

Allocating constructor.

static Ptr Rose::BinaryAnalysis::CallingConvention::Definition::x86_64bit_sysv ( )
static

Allocating constructor.

static Ptr Rose::BinaryAnalysis::CallingConvention::Definition::ppc_32bit_ibm ( )
static

Allocating constructor.

RegisterDictionaryPtr Rose::BinaryAnalysis::CallingConvention::Definition::registerDictionary ( ) const

Property: Register dictionary.

The register dictionary imparts names to the various register descriptors.

void Rose::BinaryAnalysis::CallingConvention::Definition::registerDictionary ( const RegisterDictionaryPtr d)

Property: Register dictionary.

The register dictionary imparts names to the various register descriptors.

const std::string& Rose::BinaryAnalysis::CallingConvention::Definition::name ( ) const
inline

Property: Short name of calling convention.

Standard calling conventions have documented names, like "stdcall" and that's what should appear here. They're usually a single word. It is not necessary to include information like compiler, OS, wordsize, etc. Instead, the calling convention dictionary will have more than one convention named "stdcall" for the various architectures, one for x86 32-bit, another for x86-64, etc. Also, the comment property can contain a more complete name.

Definition at line 200 of file CallingConvention.h.

void Rose::BinaryAnalysis::CallingConvention::Definition::name ( const std::string &  s)
inline

Property: Short name of calling convention.

Standard calling conventions have documented names, like "stdcall" and that's what should appear here. They're usually a single word. It is not necessary to include information like compiler, OS, wordsize, etc. Instead, the calling convention dictionary will have more than one convention named "stdcall" for the various architectures, one for x86 32-bit, another for x86-64, etc. Also, the comment property can contain a more complete name.

Definition at line 201 of file CallingConvention.h.

const std::string& Rose::BinaryAnalysis::CallingConvention::Definition::comment ( ) const
inline

Property: Full name of calling convention.

Whereas the Naming tips property contains a single-word name, this property contains the full name of the calling convention. The full name may include an operating system, compiler, architecture, word-size etc. It should not contain any line termination.

Definition at line 211 of file CallingConvention.h.

void Rose::BinaryAnalysis::CallingConvention::Definition::comment ( const std::string &  s)
inline

Property: Full name of calling convention.

Whereas the Naming tips property contains a single-word name, this property contains the full name of the calling convention. The full name may include an operating system, compiler, architecture, word-size etc. It should not contain any line termination.

Definition at line 212 of file CallingConvention.h.

size_t Rose::BinaryAnalysis::CallingConvention::Definition::wordWidth ( ) const
inline

Property: Word size in bits.

This is the natural width of a word measured in bits. When searching for a matching calling convention only those calling conventions having the desired word width are considered.

This is named "width" instead of "size" because the binary analysis API generally uses "width" to measure in units of bits, while "size" measures in units of bytes.

Definition at line 224 of file CallingConvention.h.

void Rose::BinaryAnalysis::CallingConvention::Definition::wordWidth ( size_t  nBits)
inline

Property: Word size in bits.

This is the natural width of a word measured in bits. When searching for a matching calling convention only those calling conventions having the desired word width are considered.

This is named "width" instead of "size" because the binary analysis API generally uses "width" to measure in units of bits, while "size" measures in units of bytes.

Definition at line 225 of file CallingConvention.h.

const std::vector<ConcreteLocation>& Rose::BinaryAnalysis::CallingConvention::Definition::nonParameterInputs ( ) const
inline

Non-parameter inputs.

This is the list of all allowed inputs that are not function parameters. For instance, things like the instruction pointer which the caller initializes to be the entry point of the function, or the x86 direction flag "df" which is normally set by the caller but not considered a function argument.

Definition at line 238 of file CallingConvention.h.

std::vector<ConcreteLocation>& Rose::BinaryAnalysis::CallingConvention::Definition::nonParameterInputs ( )
inline

Non-parameter inputs.

This is the list of all allowed inputs that are not function parameters. For instance, things like the instruction pointer which the caller initializes to be the entry point of the function, or the x86 direction flag "df" which is normally set by the caller but not considered a function argument.

Definition at line 239 of file CallingConvention.h.

void Rose::BinaryAnalysis::CallingConvention::Definition::clearParameters ( )
inline

Erase all parameters.

Removes all input parameters, output parameters, and object pointer parameter.

Definition at line 245 of file CallingConvention.h.

References clearInputParameters(), and clearOutputParameters().

const std::vector<ConcreteLocation>& Rose::BinaryAnalysis::CallingConvention::Definition::inputParameters ( ) const
inline

Property: Enumerated input parameters.

Returns the vector of input (and in-out) parameters that have been enumerated; does not include implied stack parameters. This property is read-only; see also appendInputParameter and clearInputParameters.

Definition at line 256 of file CallingConvention.h.

RegisterParts Rose::BinaryAnalysis::CallingConvention::Definition::inputRegisterParts ( ) const

Compute the set of input registers.

The returned list is all registers that might serve as function inputs, both function input parameters and non-parameter inputs.

void Rose::BinaryAnalysis::CallingConvention::Definition::clearInputParameters ( )
inline

Erase enumerated input parameters.

Removes all enumerated input parameters. In-out parameters, those input parameters that are also listed as outputs, are only removed from the input parameter list, effectively converting them to output-only parameters.

Definition at line 268 of file CallingConvention.h.

Referenced by clearParameters().

void Rose::BinaryAnalysis::CallingConvention::Definition::appendInputParameter ( const ConcreteLocation )

Append input parameter.

This method appends a new parameter to the list of enumerated input or in-out parameters. Generally only non-stack parameters need to be enumerated since any parameter with a higher index is assumed to be located on the stack.

Referenced by appendInputParameter().

void Rose::BinaryAnalysis::CallingConvention::Definition::appendInputParameter ( RegisterDescriptor  reg)
inline

Append input parameter.

This method appends a new parameter to the list of enumerated input or in-out parameters. Generally only non-stack parameters need to be enumerated since any parameter with a higher index is assumed to be located on the stack.

Definition at line 277 of file CallingConvention.h.

References appendInputParameter().

void Rose::BinaryAnalysis::CallingConvention::Definition::appendInputParameter ( RegisterDescriptor  reg,
int64_t  offset 
)
inline

Append input parameter.

This method appends a new parameter to the list of enumerated input or in-out parameters. Generally only non-stack parameters need to be enumerated since any parameter with a higher index is assumed to be located on the stack.

Definition at line 280 of file CallingConvention.h.

References appendInputParameter().

void Rose::BinaryAnalysis::CallingConvention::Definition::appendInputParameter ( rose_addr_t  va)
inline

Append input parameter.

This method appends a new parameter to the list of enumerated input or in-out parameters. Generally only non-stack parameters need to be enumerated since any parameter with a higher index is assumed to be located on the stack.

Definition at line 283 of file CallingConvention.h.

References appendInputParameter().

const std::vector<ConcreteLocation>& Rose::BinaryAnalysis::CallingConvention::Definition::outputParameters ( ) const
inline

Property: List of output parameters.

Returns the vector of output (and in-out) parameters. This property is read-only; see also appendOutputParameter and clearOutputParameters.

Definition at line 292 of file CallingConvention.h.

RegisterParts Rose::BinaryAnalysis::CallingConvention::Definition::outputRegisterParts ( ) const

Computes the set of output registers.

void Rose::BinaryAnalysis::CallingConvention::Definition::clearOutputParameters ( )
inline

Erase output parameters.

Removes all output parameters. In-out parameters, those output parameters that are also listed as inputs, are only removed from the output parameter list, effectively converting them to input-only parameters.

Definition at line 301 of file CallingConvention.h.

Referenced by clearParameters().

void Rose::BinaryAnalysis::CallingConvention::Definition::appendOutputParameter ( const ConcreteLocation )

Append output parameter.

This method appends a new output parameter. Output parameters may be the same as input parameters. For instance, if an input parameter is the EAX register then EAX can also be an output parameter, such as during a Linux system call where the input is the system call number and the output is the system call return value. Outputs written to the stack need not be enumerated in the calling convention dictionary.

Referenced by appendOutputParameter().

void Rose::BinaryAnalysis::CallingConvention::Definition::appendOutputParameter ( RegisterDescriptor  reg)
inline

Append output parameter.

This method appends a new output parameter. Output parameters may be the same as input parameters. For instance, if an input parameter is the EAX register then EAX can also be an output parameter, such as during a Linux system call where the input is the system call number and the output is the system call return value. Outputs written to the stack need not be enumerated in the calling convention dictionary.

Definition at line 312 of file CallingConvention.h.

References appendOutputParameter().

void Rose::BinaryAnalysis::CallingConvention::Definition::appendOutputParameter ( RegisterDescriptor  reg,
int64_t  offset 
)
inline

Append output parameter.

This method appends a new output parameter. Output parameters may be the same as input parameters. For instance, if an input parameter is the EAX register then EAX can also be an output parameter, such as during a Linux system call where the input is the system call number and the output is the system call return value. Outputs written to the stack need not be enumerated in the calling convention dictionary.

Definition at line 315 of file CallingConvention.h.

References appendOutputParameter().

void Rose::BinaryAnalysis::CallingConvention::Definition::appendOutputParameter ( rose_addr_t  va)
inline

Append output parameter.

This method appends a new output parameter. Output parameters may be the same as input parameters. For instance, if an input parameter is the EAX register then EAX can also be an output parameter, such as during a Linux system call where the input is the system call number and the output is the system call return value. Outputs written to the stack need not be enumerated in the calling convention dictionary.

Definition at line 318 of file CallingConvention.h.

References appendOutputParameter().

StackParameterOrder Rose::BinaryAnalysis::CallingConvention::Definition::stackParameterOrder ( ) const
inline

Property: Stack parameter order.

Stack-based input parameters need not be enumerated. If N input parameters are enumerated, numbered 0 through N-1, then parameters N and above are assumed to be on the stack and are called the "implied stack parameters". This stackParameterOrder property describes whether a source code statement like function_call(a, b, c) pushes a first (LEFT_TO_RIGHT) or first (RIGHT_TO_LEFT).

If the enumerated input parameter list contains any stack parameters then implied stack parameters are not allowed.

Definition at line 333 of file CallingConvention.h.

void Rose::BinaryAnalysis::CallingConvention::Definition::stackParameterOrder ( StackParameterOrder  x)
inline

Property: Stack parameter order.

Stack-based input parameters need not be enumerated. If N input parameters are enumerated, numbered 0 through N-1, then parameters N and above are assumed to be on the stack and are called the "implied stack parameters". This stackParameterOrder property describes whether a source code statement like function_call(a, b, c) pushes a first (LEFT_TO_RIGHT) or first (RIGHT_TO_LEFT).

If the enumerated input parameter list contains any stack parameters then implied stack parameters are not allowed.

Definition at line 334 of file CallingConvention.h.

const RegisterDescriptor Rose::BinaryAnalysis::CallingConvention::Definition::stackPointerRegister ( ) const
inline

Property: Register for implied stack parameters.

This property holds the register that should be used for implied stack parameters. For instance, on 32-bit x86 this is probably ESP, where the base address is the ESP value immediately after the call instruction. This property need not be defined if implied stack parameters are not possible.

Definition at line 344 of file CallingConvention.h.

void Rose::BinaryAnalysis::CallingConvention::Definition::stackPointerRegister ( RegisterDescriptor  r)
inline

Property: Register for implied stack parameters.

This property holds the register that should be used for implied stack parameters. For instance, on 32-bit x86 this is probably ESP, where the base address is the ESP value immediately after the call instruction. This property need not be defined if implied stack parameters are not possible.

Definition at line 345 of file CallingConvention.h.

size_t Rose::BinaryAnalysis::CallingConvention::Definition::nonParameterStackSize ( ) const
inline

Property: Size of non-parameter stack area.

This is the size in bytes of the final non-parameter information pushed onto the stack by the function call instruction. For instance, the 32-bit x86 call instruction pushes a 4-byte return address, but some architectures use a link register instead, pushing nothing onto the stack.

Definition at line 355 of file CallingConvention.h.

void Rose::BinaryAnalysis::CallingConvention::Definition::nonParameterStackSize ( size_t  nBytes)
inline

Property: Size of non-parameter stack area.

This is the size in bytes of the final non-parameter information pushed onto the stack by the function call instruction. For instance, the 32-bit x86 call instruction pushes a 4-byte return address, but some architectures use a link register instead, pushing nothing onto the stack.

Definition at line 358 of file CallingConvention.h.

StackDirection Rose::BinaryAnalysis::CallingConvention::Definition::stackDirection ( ) const
inline

Property: Direction that stack grows for a push operation.

Most stacks grow downward for each push operation, so down is the default. Some odd architecture might grow up instead. In either case, it is assumed that the stack pointer is pointing to the last item pushed rather than one past the last item.

Definition at line 370 of file CallingConvention.h.

void Rose::BinaryAnalysis::CallingConvention::Definition::stackDirection ( StackDirection  x)
inline

Property: Direction that stack grows for a push operation.

Most stacks grow downward for each push operation, so down is the default. Some odd architecture might grow up instead. In either case, it is assumed that the stack pointer is pointing to the last item pushed rather than one past the last item.

Definition at line 371 of file CallingConvention.h.

StackCleanup Rose::BinaryAnalysis::CallingConvention::Definition::stackCleanup ( ) const
inline

Property: Who pops stack parameters.

This property indicates whether the caller is responsible for popping stack parameters, or whether the called function is responsible for popping stack parameters. In either case, the non-parameter stack area (usually a return address) is popped by the called function.

Definition at line 381 of file CallingConvention.h.

void Rose::BinaryAnalysis::CallingConvention::Definition::stackCleanup ( StackCleanup  x)
inline

Property: Who pops stack parameters.

This property indicates whether the caller is responsible for popping stack parameters, or whether the called function is responsible for popping stack parameters. In either case, the non-parameter stack area (usually a return address) is popped by the called function.

Definition at line 382 of file CallingConvention.h.

size_t Rose::BinaryAnalysis::CallingConvention::Definition::stackAlignment ( ) const
inline

Property: Stack alignment.

This is the stack alignment measured in bytes for the stack pointer before the caller pushes any non-parameters (e.g., return address) or parameters. A value of zero means the alignment is unknown or unspecified.

Definition at line 391 of file CallingConvention.h.

void Rose::BinaryAnalysis::CallingConvention::Definition::stackAlignment ( size_t  nBytes)
inline

Property: Stack alignment.

This is the stack alignment measured in bytes for the stack pointer before the caller pushes any non-parameters (e.g., return address) or parameters. A value of zero means the alignment is unknown or unspecified.

Definition at line 392 of file CallingConvention.h.

const ConcreteLocation& Rose::BinaryAnalysis::CallingConvention::Definition::thisParameter ( ) const
inline

Property: Object pointer parameter.

Object oriented code has method calls that are usually implemented as functions that take an extra parameter that isn't always explicitly listed in the high-level source code. This property describes where the object pointer is located and should not be included in the list of input parameters. The reason for not including it in the list of input parameters is because of the rule that implicit input parameter are allowed only if there are no explicit stack-based input parameters, and we want to be able to support having a stack-based object pointer along with implicit input parameters.

It is permissible for an object method to not list its object pointer as an object pointer, but rather treat it as a normal explicit or implicit input parameter. Doing so will make the calling convention look like its a plain function rather than an object method.

Definition at line 409 of file CallingConvention.h.

Referenced by thisParameter().

void Rose::BinaryAnalysis::CallingConvention::Definition::thisParameter ( const ConcreteLocation x)
inline

Property: Object pointer parameter.

Object oriented code has method calls that are usually implemented as functions that take an extra parameter that isn't always explicitly listed in the high-level source code. This property describes where the object pointer is located and should not be included in the list of input parameters. The reason for not including it in the list of input parameters is because of the rule that implicit input parameter are allowed only if there are no explicit stack-based input parameters, and we want to be able to support having a stack-based object pointer along with implicit input parameters.

It is permissible for an object method to not list its object pointer as an object pointer, but rather treat it as a normal explicit or implicit input parameter. Doing so will make the calling convention look like its a plain function rather than an object method.

Definition at line 410 of file CallingConvention.h.

void Rose::BinaryAnalysis::CallingConvention::Definition::thisParameter ( RegisterDescriptor  reg)
inline

Property: Object pointer parameter.

Object oriented code has method calls that are usually implemented as functions that take an extra parameter that isn't always explicitly listed in the high-level source code. This property describes where the object pointer is located and should not be included in the list of input parameters. The reason for not including it in the list of input parameters is because of the rule that implicit input parameter are allowed only if there are no explicit stack-based input parameters, and we want to be able to support having a stack-based object pointer along with implicit input parameters.

It is permissible for an object method to not list its object pointer as an object pointer, but rather treat it as a normal explicit or implicit input parameter. Doing so will make the calling convention look like its a plain function rather than an object method.

Definition at line 411 of file CallingConvention.h.

References thisParameter().

void Rose::BinaryAnalysis::CallingConvention::Definition::thisParameter ( RegisterDescriptor  reg,
int64_t  offset 
)
inline

Property: Object pointer parameter.

Object oriented code has method calls that are usually implemented as functions that take an extra parameter that isn't always explicitly listed in the high-level source code. This property describes where the object pointer is located and should not be included in the list of input parameters. The reason for not including it in the list of input parameters is because of the rule that implicit input parameter are allowed only if there are no explicit stack-based input parameters, and we want to be able to support having a stack-based object pointer along with implicit input parameters.

It is permissible for an object method to not list its object pointer as an object pointer, but rather treat it as a normal explicit or implicit input parameter. Doing so will make the calling convention look like its a plain function rather than an object method.

Definition at line 414 of file CallingConvention.h.

References thisParameter().

void Rose::BinaryAnalysis::CallingConvention::Definition::thisParameter ( rose_addr_t  va)
inline

Property: Object pointer parameter.

Object oriented code has method calls that are usually implemented as functions that take an extra parameter that isn't always explicitly listed in the high-level source code. This property describes where the object pointer is located and should not be included in the list of input parameters. The reason for not including it in the list of input parameters is because of the rule that implicit input parameter are allowed only if there are no explicit stack-based input parameters, and we want to be able to support having a stack-based object pointer along with implicit input parameters.

It is permissible for an object method to not list its object pointer as an object pointer, but rather treat it as a normal explicit or implicit input parameter. Doing so will make the calling convention look like its a plain function rather than an object method.

Definition at line 417 of file CallingConvention.h.

References thisParameter().

const ConcreteLocation& Rose::BinaryAnalysis::CallingConvention::Definition::returnAddressLocation ( ) const
inline

Property: Location of return address.

This property stores the location where the function return address is stored. I.e., the location contains the address to which this function returns after being called.

Definition at line 428 of file CallingConvention.h.

void Rose::BinaryAnalysis::CallingConvention::Definition::returnAddressLocation ( const ConcreteLocation x)
inline

Property: Location of return address.

This property stores the location where the function return address is stored. I.e., the location contains the address to which this function returns after being called.

Definition at line 429 of file CallingConvention.h.

const std::set<RegisterDescriptor>& Rose::BinaryAnalysis::CallingConvention::Definition::calleeSavedRegisters ( ) const
inline

Property: Callee-saved registers.

This is the set of registers that the called function must preserve across the call, either by not modifying them or by saving and then restoring them. Registers that are used to return values should obviously not be listed here since they need to be modified in order to return a value.

Registers that are not restored but which are also not listed as output parameters (return values) are assumed to be scratch registers. Status flags are typically in this category, as are the stack pointer and instruction pointer. Most calling conventions have at least a few general purpose registers that can be used as scratch space.

Definition at line 450 of file CallingConvention.h.

std::set<RegisterDescriptor>& Rose::BinaryAnalysis::CallingConvention::Definition::calleeSavedRegisters ( )
inline

Property: Callee-saved registers.

This is the set of registers that the called function must preserve across the call, either by not modifying them or by saving and then restoring them. Registers that are used to return values should obviously not be listed here since they need to be modified in order to return a value.

Registers that are not restored but which are also not listed as output parameters (return values) are assumed to be scratch registers. Status flags are typically in this category, as are the stack pointer and instruction pointer. Most calling conventions have at least a few general purpose registers that can be used as scratch space.

Definition at line 451 of file CallingConvention.h.

RegisterParts Rose::BinaryAnalysis::CallingConvention::Definition::calleeSavedRegisterParts ( ) const

Compute the set of callee-saved registers.

const std::set<RegisterDescriptor>& Rose::BinaryAnalysis::CallingConvention::Definition::scratchRegisters ( ) const
inline

Property: Scratch registers.

This is the set of registers that are not parameters or return values but which are nonetheless can be modified and not restored by the called function. These are also known as caller-saved registers since the caller must save and restore the value across the call if necessary.

Definition at line 464 of file CallingConvention.h.

std::set<RegisterDescriptor>& Rose::BinaryAnalysis::CallingConvention::Definition::scratchRegisters ( )
inline

Property: Scratch registers.

This is the set of registers that are not parameters or return values but which are nonetheless can be modified and not restored by the called function. These are also known as caller-saved registers since the caller must save and restore the value across the call if necessary.

Definition at line 465 of file CallingConvention.h.

RegisterParts Rose::BinaryAnalysis::CallingConvention::Definition::scratchRegisterParts ( ) const

Computes the set of scratch registers.

RegisterParts Rose::BinaryAnalysis::CallingConvention::Definition::getUsedRegisterParts ( ) const

Returns all registers mentioned in this definition.

The registers are returned as a RegisterParts, which tracks which bits of registers are present but not which individual registers were inserted into the container. For instance, if x86 AX is inserted first, then inserting the overlapping AL and AH registers is a no-op since their bits are already present.

The return value does not include registers that are incidental to a parameter's location. For instance, the stack pointer register is not included in this list unless its listed as a return register, callee-saved register, or scratch register.

void Rose::BinaryAnalysis::CallingConvention::Definition::print ( std::ostream &  ) const

Print detailed information about this calling convention.

If a register dictionary is supplied then that dictionary is used instead of any dictionary already attached to this definition. This feature is mostly for backward compatibility.

void Rose::BinaryAnalysis::CallingConvention::Definition::print ( std::ostream &  ,
const RegisterDictionaryPtr regDict 
) const

Print detailed information about this calling convention.

If a register dictionary is supplied then that dictionary is used instead of any dictionary already attached to this definition. This feature is mostly for backward compatibility.


The documentation for this class was generated from the following file: