ROSE  0.9.9.139
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 217 of file BinaryCallingConvention.h.

#include <BinaryCallingConvention.h>

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

Public Types

enum  ParameterOrder {
  ORDER_LTR = LEFT_TO_RIGHT,
  ORDER_RTL = RIGHT_TO_LEFT,
  ORDER_UNKNOWN = ORDER_UNSPECIFIED
}
 
enum  ThisPointerLocation {
  THIS_FIRST_PARAM,
  THIS_REGISTER,
  THIS_NOT_APPLICABLE,
  THIS_UNKNOWN
}
 
enum  ReturnValueLocation {
  RETVAL_STACK,
  RETVAL_REGISTER,
  RETVAL_NOT_APPLICABLE,
  RETVAL_UNKNOWN
}
 
typedef Sawyer::SharedPointer< DefinitionPtr
 Reference counting pointer to calling convention definition. More...
 
typedef std::vector< RegisterDescriptorRegisterVector
 
typedef std::set< RegisterDescriptorRegisterSet
 

Public Member Functions

void clearParameters ()
 Erase all parameters. More...
 
const std::vector< ParameterLocation > & 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< ParameterLocation > & 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...
 
void print (std::ostream &, const RegisterDictionary *regDict=NULL) const
 Print detailed information about this calling convention. More...
 
size_t get_word_size () const ROSE_DEPRECATED("use wordWidth property instead")
 
void set_word_size (size_t w) ROSE_DEPRECATED("use wordWidth property instead")
 
const std::string & get_name () const ROSE_DEPRECATED("use \"name\" property instead")
 
void set_name (const std::string &n) ROSE_DEPRECATED("use \"name\" property instead")
 
const std::string & get_compiler () const ROSE_DEPRECATED("use \"comment\" property instead")
 
void set_compiler (const std::string &c) ROSE_DEPRECATED("use \"comment\" property instead")
 
const std::string & get_comment () const ROSE_DEPRECATED("use \"comment\" property instead")
 
void set_comment (const std::string &c) ROSE_DEPRECATED("use \"comment\" property instead")
 
ParameterOrder get_param_order () const ROSE_DEPRECATED("use stackParameterOrder property instead")
 
void set_param_order (ParameterOrder order) ROSE_DEPRECATED("use stackParameterOrder property instead")
 
ThisPointerLocation get_this_location () const ROSE_DEPRECATED("use thisParameter property instead")
 
void set_this_register (const RegisterDescriptor *reg) ROSE_DEPRECATED("use thisParameter property instead")
 
ReturnValueLocation get_retval_location () const ROSE_DEPRECATED("use outputParameters property instead")
 
void set_retval_register (const RegisterDescriptor *reg) ROSE_DEPRECATED("use appendOutputParameter instead")
 
StackCleanup get_stack_cleanup () const ROSE_DEPRECATED("use stackCleanup property instead")
 
void set_stack_cleanup (StackCleanup cleanup) ROSE_DEPRECATED("use stackCleanup property instead")
 
RegisterVector get_reg_params () const ROSE_DEPRECATED("use inputParameters property instead")
 
void add_reg_param (const RegisterDescriptor *reg) ROSE_DEPRECATED("use appendInputParameter instead")
 
const RegisterSet & get_nonvolatile () const ROSE_DEPRECATED("use calleeSavedRegisters property instead")
 
void add_nonvolatile (const RegisterDictionary *dict, const std::string &name) ROSE_DEPRECATED("use calleeSavedRegisters property instead")
 
void add_nonvolatile (const RegisterDescriptor *rd) ROSE_DEPRECATED("use calleeSavedRegisters property instead")
 
void add_nonvolatile (const RegisterSet &regs) ROSE_DEPRECATED("use calleeSavedRegisters property instead")
 
void report (const RegisterDictionary *regdict) const ROSE_DEPRECATED("use \"print\" instead")
 
const RegisterDictionaryregisterDictionary () const
 Property: Register dictionary. More...
 
void registerDictionary (const RegisterDictionary *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...
 
void appendInputParameter (const ParameterLocation &)
 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 ParameterLocation &)
 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 ParameterLocationthisParameter () const
 Property: Object pointer parameter. More...
 
void thisParameter (const ParameterLocation &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 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...
 
- 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 RegisterDictionary *)
 Constructs a new pre-defined calling convention based on a register dictionary.
 
static Ptr x86_stdcall (const RegisterDictionary *)
 Constructs a new pre-defined calling convention based on a register dictionary.
 
static Ptr x86_fastcall (const RegisterDictionary *)
 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 RegisterDictionary *regDict)
 Allocating constructor. More...
 
static Ptr instance (size_t wordWidth, const std::string &name, const std::string &comment, const RegisterDictionary *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...
 

Member Typedef Documentation

Reference counting pointer to calling convention definition.

Definition at line 220 of file BinaryCallingConvention.h.

Constructor & Destructor Documentation

Rose::BinaryAnalysis::CallingConvention::Definition::Definition ( )
inlineprotected

Default constructor.

Constructs a new calling convention with no name or parameters.

Definition at line 267 of file BinaryCallingConvention.h.

Referenced by instance().

Rose::BinaryAnalysis::CallingConvention::Definition::Definition ( size_t  wordWidth,
const std::string &  name,
const std::string &  comment,
const RegisterDictionary regDict 
)
inlineprotected

Allocating constructor.

Definition at line 276 of file BinaryCallingConvention.h.

Member Function Documentation

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

Allocating constructor.

Definition at line 284 of file BinaryCallingConvention.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.

const RegisterDictionary* Rose::BinaryAnalysis::CallingConvention::Definition::registerDictionary ( ) const
inline

Property: Register dictionary.

The register dictionary imparts names to the various register descriptors.

Definition at line 313 of file BinaryCallingConvention.h.

void Rose::BinaryAnalysis::CallingConvention::Definition::registerDictionary ( const RegisterDictionary d)
inline

Property: Register dictionary.

The register dictionary imparts names to the various register descriptors.

Definition at line 314 of file BinaryCallingConvention.h.

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 325 of file BinaryCallingConvention.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 326 of file BinaryCallingConvention.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 336 of file BinaryCallingConvention.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 337 of file BinaryCallingConvention.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 349 of file BinaryCallingConvention.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 350 of file BinaryCallingConvention.h.

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

Erase all parameters.

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

Definition at line 359 of file BinaryCallingConvention.h.

References clearInputParameters(), and clearOutputParameters().

const std::vector<ParameterLocation>& 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 369 of file BinaryCallingConvention.h.

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

Compute the set of input registers.

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 378 of file BinaryCallingConvention.h.

Referenced by clearParameters().

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

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 387 of file BinaryCallingConvention.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 390 of file BinaryCallingConvention.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 393 of file BinaryCallingConvention.h.

References appendInputParameter().

const std::vector<ParameterLocation>& 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 402 of file BinaryCallingConvention.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 411 of file BinaryCallingConvention.h.

Referenced by clearParameters().

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

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 422 of file BinaryCallingConvention.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 425 of file BinaryCallingConvention.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 428 of file BinaryCallingConvention.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 443 of file BinaryCallingConvention.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 444 of file BinaryCallingConvention.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 454 of file BinaryCallingConvention.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 455 of file BinaryCallingConvention.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 465 of file BinaryCallingConvention.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 468 of file BinaryCallingConvention.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 480 of file BinaryCallingConvention.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 481 of file BinaryCallingConvention.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 491 of file BinaryCallingConvention.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 492 of file BinaryCallingConvention.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 501 of file BinaryCallingConvention.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 502 of file BinaryCallingConvention.h.

const ParameterLocation& 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 519 of file BinaryCallingConvention.h.

Referenced by thisParameter().

void Rose::BinaryAnalysis::CallingConvention::Definition::thisParameter ( const ParameterLocation 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 520 of file BinaryCallingConvention.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 521 of file BinaryCallingConvention.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 524 of file BinaryCallingConvention.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 527 of file BinaryCallingConvention.h.

References thisParameter().

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 543 of file BinaryCallingConvention.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 544 of file BinaryCallingConvention.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 557 of file BinaryCallingConvention.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 558 of file BinaryCallingConvention.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 RegisterDictionary regDict = NULL 
) 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: