ROSE  0.11.145.0
Classes | Typedefs | Enumerations | Functions | Variables
Rose::BinaryAnalysis::CallingConvention Namespace Reference

Description

Support for binary calling conventions.

This namespace has three main classes and a number of auxiliary classes. The main classes are:

Classes

class  Analysis
 Function calling convention. More...
 
class  Definition
 Information about calling conventions. More...
 

Typedefs

using DefinitionPtr = Sawyer::SharedPointer< Definition >
 Reference counting pointer. More...
 
typedef std::vector< Definition::PtrDictionary
 A ordered collection of calling convention definitions. More...
 

Enumerations

enum  StackParameterOrder {
  StackParameterOrder::LEFT_TO_RIGHT,
  StackParameterOrder::RIGHT_TO_LEFT,
  StackParameterOrder::UNSPECIFIED
}
 The order that arguments are pushed onto the stack. More...
 
enum  StackDirection {
  StackDirection::GROWS_UP,
  StackDirection::GROWS_DOWN
}
 The direction in which the stack grows. More...
 
enum  StackCleanup {
  StackCleanup::BY_CALLER,
  StackCleanup::BY_CALLEE,
  StackCleanup::UNSPECIFIED
}
 Who is responsible for popping stack parameters. More...
 

Functions

void initDiagnostics ()
 Initialize diagnostics. More...
 
const DictionarydictionaryAmd64 ()
 Common calling conventions for amd64 (x86-64). More...
 
const DictionarydictionaryAarch32 ()
 Common calling conventions for ARM AArch32. More...
 
const DictionarydictionaryAarch64 ()
 Common calling conventions for ARM AArch64. More...
 
const DictionarydictionaryM68k ()
 Common calling conventions for m68k. More...
 
const DictionarydictionaryMips ()
 Common calling conventions for MIPS. More...
 
const DictionarydictionaryPowerpc32 ()
 Common calling conventions for PowerPC-32. More...
 
const DictionarydictionaryPowerpc64 ()
 Common calling conventions for PowerPC-64. More...
 
const DictionarydictionaryX86 ()
 Common calling conventions for 32-bit x86. More...
 
InstructionSemantics::BaseSemantics::SValuePtr readArgument (const InstructionSemantics::BaseSemantics::RiscOperatorsPtr &, const Definition::Ptr &, size_t argNumber)
 Read a function argument from a semantic state. More...
 
void writeArgument (const InstructionSemantics::BaseSemantics::RiscOperatorsPtr &, const Definition::Ptr &, size_t argNumber, const InstructionSemantics::BaseSemantics::SValuePtr &value)
 Write a function argument to a semantic state. More...
 
InstructionSemantics::BaseSemantics::SValuePtr readReturnValue (const InstructionSemantics::BaseSemantics::RiscOperatorsPtr &, const Definition::Ptr &)
 Read the return value that a function is returning. More...
 
void writeReturnValue (const InstructionSemantics::BaseSemantics::RiscOperatorsPtr &, const Definition::Ptr &, const InstructionSemantics::BaseSemantics::SValuePtr &returnValue)
 Write a value to a function return semantic state. More...
 
void simulateFunctionReturn (const InstructionSemantics::BaseSemantics::RiscOperatorsPtr &, const Definition::Ptr &)
 Simulate a function return. More...
 
std::ostream & operator<< (std::ostream &, const Definition &)
 Print a definition. More...
 
std::ostream & operator<< (std::ostream &, const Analysis &)
 Print analysis information. More...
 

Variables

Sawyer::Message::Facility mlog
 Facility for diagnostic output. More...
 

Typedef Documentation

Reference counting pointer.

Definition at line 71 of file BinaryAnalysis/BasicTypes.h.

A ordered collection of calling convention definitions.

Definition at line 499 of file CallingConvention.h.

Enumeration Type Documentation

The order that arguments are pushed onto the stack.

Enumerator
LEFT_TO_RIGHT 

Stack parameters pushed left to right (Pascal order).

RIGHT_TO_LEFT 

Stack parameters pushed right to left (C order).

UNSPECIFIED 

Stack parameter order is unknown or unspecified.

Definition at line 60 of file CallingConvention.h.

The direction in which the stack grows.

Enumerator
GROWS_UP 

A push increments the stack pointer.

GROWS_DOWN 

A push decrements the stack pointer.

Definition at line 67 of file CallingConvention.h.

Who is responsible for popping stack parameters.

Enumerator
BY_CALLER 

The caller pops all stack parameters.

BY_CALLEE 

The called function pops all stack parameters.

UNSPECIFIED 

Stack parameter cleanup is unknown or unspecified.

Definition at line 73 of file CallingConvention.h.

Function Documentation

void Rose::BinaryAnalysis::CallingConvention::initDiagnostics ( )

Initialize diagnostics.

This is normally called as part of ROSE's diagnostics initialization, but it doesn't hurt to call it often.

const Dictionary& Rose::BinaryAnalysis::CallingConvention::dictionaryAmd64 ( )

Common calling conventions for amd64 (x86-64).

const Dictionary& Rose::BinaryAnalysis::CallingConvention::dictionaryAarch32 ( )

Common calling conventions for ARM AArch32.

const Dictionary& Rose::BinaryAnalysis::CallingConvention::dictionaryAarch64 ( )

Common calling conventions for ARM AArch64.

const Dictionary& Rose::BinaryAnalysis::CallingConvention::dictionaryM68k ( )

Common calling conventions for m68k.

const Dictionary& Rose::BinaryAnalysis::CallingConvention::dictionaryMips ( )

Common calling conventions for MIPS.

const Dictionary& Rose::BinaryAnalysis::CallingConvention::dictionaryPowerpc32 ( )

Common calling conventions for PowerPC-32.

const Dictionary& Rose::BinaryAnalysis::CallingConvention::dictionaryPowerpc64 ( )

Common calling conventions for PowerPC-64.

const Dictionary& Rose::BinaryAnalysis::CallingConvention::dictionaryX86 ( )

Common calling conventions for 32-bit x86.

InstructionSemantics::BaseSemantics::SValuePtr Rose::BinaryAnalysis::CallingConvention::readArgument ( const InstructionSemantics::BaseSemantics::RiscOperatorsPtr ,
const Definition::Ptr ,
size_t  argNumber 
)

Read a function argument from a semantic state.

void Rose::BinaryAnalysis::CallingConvention::writeArgument ( const InstructionSemantics::BaseSemantics::RiscOperatorsPtr ,
const Definition::Ptr ,
size_t  argNumber,
const InstructionSemantics::BaseSemantics::SValuePtr value 
)

Write a function argument to a semantic state.

InstructionSemantics::BaseSemantics::SValuePtr Rose::BinaryAnalysis::CallingConvention::readReturnValue ( const InstructionSemantics::BaseSemantics::RiscOperatorsPtr ,
const Definition::Ptr  
)

Read the return value that a function is returning.

void Rose::BinaryAnalysis::CallingConvention::writeReturnValue ( const InstructionSemantics::BaseSemantics::RiscOperatorsPtr ,
const Definition::Ptr ,
const InstructionSemantics::BaseSemantics::SValuePtr returnValue 
)

Write a value to a function return semantic state.

void Rose::BinaryAnalysis::CallingConvention::simulateFunctionReturn ( const InstructionSemantics::BaseSemantics::RiscOperatorsPtr ,
const Definition::Ptr  
)

Simulate a function return.

The RISC operator's current state is adjusted as if a function with the specified calling convention returned.

std::ostream& Rose::BinaryAnalysis::CallingConvention::operator<< ( std::ostream &  ,
const Definition  
)

Print a definition.

std::ostream& Rose::BinaryAnalysis::CallingConvention::operator<< ( std::ostream &  ,
const Analysis  
)

Print analysis information.

Variable Documentation

Sawyer::Message::Facility Rose::BinaryAnalysis::CallingConvention::mlog

Facility for diagnostic output.

The facility can be controlled directly or via ROSE's command-line.