IDA C++ SDK 9.2
Loading...
Searching...
No Matches
Argument location types

Topics

 Standard C-language models for x86

Classes

struct  rrel_t
 Register-relative argument location. More...
struct  custloc_desc_t
 Description of a custom argloc. More...
class  argloc_t
 Describes an argument location. More...
struct  argpart_t
 Subsection of an argument location. More...
class  scattered_aloc_t
 Used to manage arguments that are described by multiple locations (also see ALOC_DIST) More...
struct  aloc_visitor_t
 Visit all argument locations. More...
struct  const_aloc_visitor_t
 Same as aloc_visitor_t, but may not modify the argloc. More...
struct  stkarg_area_info_t
struct  custom_callcnv_t
 Description of a custom calling convention. More...

Typedefs

typedef qvector< argloc_targlocs_t
 vector of argument locations
typedef qvector< argpart_targpartvec_t

Enumerations

enum  argreg_policy_t {
  ARGREGS_POLICY_UNDEFINED , ARGREGS_GP_ONLY , ARGREGS_INDEPENDENT , ARGREGS_BY_SLOTS ,
  ARGREGS_FP_MASKS_GP , ARGREGS_MIPS_O32 , ARGREGS_RISCV
}
 Function argument passing: how GP & FP registers cooperate with each other. More...

Functions

idaman int ida_export install_custom_argloc (const custloc_desc_t *custloc)
 Save a custom argloc.
idaman bool ida_export remove_custom_argloc (int idx)
 Delete the custom argloc at the given index.
idaman const custloc_desc_t *ida_export retrieve_custom_argloc (int idx)
 Retrieve the custom argloc at the given index.
 DECLARE_TYPE_AS_MOVABLE (argloc_t)
 DECLARE_TYPE_AS_MOVABLE (argpart_t)
 DECLARE_TYPE_AS_MOVABLE (scattered_aloc_t)
idaman int ida_export verify_argloc (const argloc_t &vloc, int size, const rangeset_t *gaps)
 Verify argloc_t.
idaman bool ida_export optimize_argloc (argloc_t *vloc, int size, const rangeset_t *gaps)
 Verify and optimize scattered argloc into simple form.
idaman size_t ida_export print_argloc (char *buf, size_t bufsize, const argloc_t &vloc, int size=0, int vflags=0)
 Convert an argloc to human readable form.
idaman int ida_export for_all_arglocs (aloc_visitor_t &vv, argloc_t &vloc, int size, int off=0)
 Compress larger argloc types and initiate the aloc visitor.
int idaapi for_all_const_arglocs (const_aloc_visitor_t &vv, const argloc_t &vloc, int size, int off=0)
 See for_all_arglocs()
callcnv_t helper_get_cc (cm_t cm, callcnv_t new_callcnv)
void helper_set_cc (cm_t *cm, callcnv_t *new_callcnv, callcnv_t cc)
callcnv_t get_effective_cc (callcnv_t cc)
 Get effective calling convention (with respect to default CC)
constexpr THREAD_SAFE bool is_user_cc (callcnv_t cc)
 Does the calling convention specify argument locations explicitly?
constexpr THREAD_SAFE bool is_vararg_cc (callcnv_t cc)
 Does the calling convention use ellipsis?
constexpr THREAD_SAFE bool is_purging_cc (callcnv_t cc)
 Does the calling convention clean the stack arguments upon return?
constexpr bool is_golang_cc (callcnv_t cc)
 GO language calling convention (return value in stack)?
bool is_custom_callcnv (callcnv_t cc)
 Is custom calling convention?
constexpr bool is_swift_cc (callcnv_t cc)
 Swift calling convention (arguments and return values in registers)?
idaman bool ida_export get_stkarg_area_info (stkarg_area_info_t *out, callcnv_t cc)
 Some calling conventions foresee special areas on the stack for call arguments.
 DECLARE_TYPE_AS_MOVABLE (custom_callcnv_t)
idaman callcnv_t ida_export register_custom_callcnv (const custom_callcnv_t &ccinf)
 Register a calling convention.
idaman bool ida_export unregister_custom_callcnv (callcnv_t callcnv)
 Unregister a calling convention.
idaman const custom_callcnv_t *ida_export get_custom_callcnv (callcnv_t callcnv)
 Retrieve custom calling convention details.
idaman callcnv_t ida_export find_custom_callcnv (const char *name)
 Find a calling convention by its name.
idaman size_t ida_export get_custom_callcnvs (qstrvec_t *names, callcnvs_t *codes)
 Get all custom calling conventions.
callcnv_t compiler_info_t::get_cc () const
void compiler_info_t::set_cc (callcnv_t cc)
const argloc_type_t ALOC_NONE = 0
 none
const argloc_type_t ALOC_STACK = 1
 stack offset
const argloc_type_t ALOC_DIST = 2
 distributed (scattered)
const argloc_type_t ALOC_REG1 = 3
 one register (and offset within it)
const argloc_type_t ALOC_REG2 = 4
 register pair
const argloc_type_t ALOC_RREL = 5
 register relative
const argloc_type_t ALOC_STATIC = 6
 global address
const argloc_type_t ALOC_CUSTOM = 7
 custom argloc (7 or higher)

Detailed Description

Typedef Documentation

◆ arglocs_t

vector of argument locations

◆ argpartvec_t

Enumeration Type Documentation

◆ argreg_policy_t

Function argument passing: how GP & FP registers cooperate with each other.

Enumerator
ARGREGS_POLICY_UNDEFINED 
ARGREGS_GP_ONLY 

GP registers used for all arguments.

ARGREGS_INDEPENDENT 

FP/GP registers used separately (like gcc64)

ARGREGS_BY_SLOTS 

fixed FP/GP register per each slot (like vc64)

ARGREGS_FP_MASKS_GP 

FP register also consumes one or more GP regs but not vice versa (aix ppc ABI)

ARGREGS_MIPS_O32 

MIPS ABI o32.

ARGREGS_RISCV 

Risc-V API FP arguments are passed in GP registers if FP registers are exhausted and GP ones are not.

Wide FP arguments are passed in GP registers. Variadic FP arguments are passed in GP registers.

Function Documentation

◆ install_custom_argloc()

idaman int ida_export install_custom_argloc ( const custloc_desc_t * custloc)

Save a custom argloc.

◆ remove_custom_argloc()

idaman bool ida_export remove_custom_argloc ( int idx)

Delete the custom argloc at the given index.

◆ retrieve_custom_argloc()

idaman const custloc_desc_t *ida_export retrieve_custom_argloc ( int idx)

Retrieve the custom argloc at the given index.

◆ DECLARE_TYPE_AS_MOVABLE() [1/4]

DECLARE_TYPE_AS_MOVABLE ( argloc_t )

◆ DECLARE_TYPE_AS_MOVABLE() [2/4]

DECLARE_TYPE_AS_MOVABLE ( argpart_t )

◆ DECLARE_TYPE_AS_MOVABLE() [3/4]

DECLARE_TYPE_AS_MOVABLE ( scattered_aloc_t )

◆ verify_argloc()

idaman int ida_export verify_argloc ( const argloc_t & vloc,
int size,
const rangeset_t * gaps )

Verify argloc_t.

Parameters
vlocargloc to verify
sizetotal size of the variable
gapsif not nullptr, specifies gaps in structure definition. these gaps should not map to any argloc, but everything else must be covered
Returns
0 if ok, otherwise an interr code.

◆ optimize_argloc()

idaman bool ida_export optimize_argloc ( argloc_t * vloc,
int size,
const rangeset_t * gaps )

Verify and optimize scattered argloc into simple form.

All new arglocs must be processed by this function.

Return values
truesuccess
falsethe input argloc was illegal

◆ print_argloc()

idaman size_t ida_export print_argloc ( char * buf,
size_t bufsize,
const argloc_t & vloc,
int size = 0,
int vflags = 0 )

Convert an argloc to human readable form.

◆ for_all_arglocs()

idaman int ida_export for_all_arglocs ( aloc_visitor_t & vv,
argloc_t & vloc,
int size,
int off = 0 )

Compress larger argloc types and initiate the aloc visitor.

◆ for_all_const_arglocs()

int idaapi for_all_const_arglocs ( const_aloc_visitor_t & vv,
const argloc_t & vloc,
int size,
int off = 0 )
inline

◆ helper_get_cc()

callcnv_t helper_get_cc ( cm_t cm,
callcnv_t new_callcnv )
inline

◆ helper_set_cc()

void helper_set_cc ( cm_t * cm,
callcnv_t * new_callcnv,
callcnv_t cc )
inline

◆ get_effective_cc()

callcnv_t get_effective_cc ( callcnv_t cc)
inline

Get effective calling convention (with respect to default CC)

◆ is_user_cc()

THREAD_SAFE bool is_user_cc ( callcnv_t cc)
inlineconstexpr

Does the calling convention specify argument locations explicitly?

◆ is_vararg_cc()

THREAD_SAFE bool is_vararg_cc ( callcnv_t cc)
inlineconstexpr

Does the calling convention use ellipsis?

◆ is_purging_cc()

THREAD_SAFE bool is_purging_cc ( callcnv_t cc)
inlineconstexpr

Does the calling convention clean the stack arguments upon return?

Note
this function is valid only for x86 code

◆ is_golang_cc()

bool is_golang_cc ( callcnv_t cc)
inlineconstexpr

GO language calling convention (return value in stack)?

◆ is_custom_callcnv()

bool is_custom_callcnv ( callcnv_t cc)
inline

Is custom calling convention?

◆ is_swift_cc()

bool is_swift_cc ( callcnv_t cc)
inlineconstexpr

Swift calling convention (arguments and return values in registers)?

◆ get_stkarg_area_info()

idaman bool ida_export get_stkarg_area_info ( stkarg_area_info_t * out,
callcnv_t cc )

Some calling conventions foresee special areas on the stack for call arguments.

This structure lists their sizes.

◆ DECLARE_TYPE_AS_MOVABLE() [4/4]

DECLARE_TYPE_AS_MOVABLE ( custom_callcnv_t )

◆ register_custom_callcnv()

idaman callcnv_t ida_export register_custom_callcnv ( const custom_callcnv_t & ccinf)

Register a calling convention.

Parameters
ccinfdescription of the custom calling convention. this object must be alive until unregister_custom_callcnv(), after that it can destroyed
Returns
CM_CC_INVALID means failure:
  • bad ccinf.name
  • ccinf.name already exists
  • the calling convention is special (usercall, purging, vararg) and there are too many of them already

◆ unregister_custom_callcnv()

idaman bool ida_export unregister_custom_callcnv ( callcnv_t callcnv)

Unregister a calling convention.

Returns
true if successfully unregistered the custom calling convention

◆ get_custom_callcnv()

idaman const custom_callcnv_t *ida_export get_custom_callcnv ( callcnv_t callcnv)

Retrieve custom calling convention details.

◆ find_custom_callcnv()

idaman callcnv_t ida_export find_custom_callcnv ( const char * name)

Find a calling convention by its name.

Returns
CM_CC_INVALID is not found

◆ get_custom_callcnvs()

idaman size_t ida_export get_custom_callcnvs ( qstrvec_t * names,
callcnvs_t * codes )

Get all custom calling conventions.

Parameters
namesoutput buffer for the convention names
codesoutput buffer for the convention codes The two output buffers correspond to each other.
Returns
number of the calling conventions added to the output buffers

◆ get_cc()

callcnv_t compiler_info_t::get_cc ( ) const
inline

◆ set_cc()

void compiler_info_t::set_cc ( callcnv_t cc)
inline

Variable Documentation

◆ ALOC_NONE

const argloc_type_t ALOC_NONE = 0

none

◆ ALOC_STACK

const argloc_type_t ALOC_STACK = 1

stack offset

◆ ALOC_DIST

const argloc_type_t ALOC_DIST = 2

distributed (scattered)

◆ ALOC_REG1

const argloc_type_t ALOC_REG1 = 3

one register (and offset within it)

◆ ALOC_REG2

const argloc_type_t ALOC_REG2 = 4

register pair

◆ ALOC_RREL

const argloc_type_t ALOC_RREL = 5

register relative

◆ ALOC_STATIC

const argloc_type_t ALOC_STATIC = 6

global address

◆ ALOC_CUSTOM

const argloc_type_t ALOC_CUSTOM = 7

custom argloc (7 or higher)