| IDA SDK

Modules | Classes | Macros | Typedefs | Enumerations | Functions
Argument locations
CM

## Detailed Description

## Modules
| Argument location types
| 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...

## Macros
#define | PRALOC_VERIFY 0x01
| interr if illegal argloc
#define | PRALOC_STKOFF 0x02
| print stack offsets

## Typedefs
typedef int | argloc_type_t
| Specifies the location type of a function argument - see Argument location types.
typedef qvector< argloc_t > | arglocs_t
| vector of argument locations
typedef qvector< argpart_t > | argpartvec_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.
idaman int ida_export | verify_argloc (const argloc_t &vloc, int size, const rangeset_t *gaps)
| Verify argloc_t. More...
idaman bool ida_export | optimize_argloc (argloc_t *vloc, int size, const rangeset_t *gaps)
| Verify and optimize scattered argloc into simple form. More...
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()
constexpr THREAD_SAFE cm_t | get_cc (cm_t cm)
| Get the calling convention.
cm_t | get_effective_cc (cm_t cm)
| Get effective calling convention (with respect to default CC)
constexpr THREAD_SAFE bool | is_user_cc (cm_t cm)
| Does the calling convention specify argument locations explicitly?
constexpr THREAD_SAFE bool | is_vararg_cc (cm_t cm)
| Does the calling convention use ellipsis?
constexpr THREAD_SAFE bool | is_purging_cc (cm_t cm)
| Does the calling convention clean the stack arguments upon return?. More...
constexpr bool | is_golang_cc (cm_t cc)
| GO language calling convention (return value in stack)?
constexpr bool | is_swift_cc (cm_t cc)
| Swift calling convention (arguments and return values in registers)?

## Enumeration Type Documentation

## ◆ argreg_policy_t

enum argreg_policy_t

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

Enumerator
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

## ◆ verify_argloc()

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

Verify argloc_t.

Parameters

  vloc | argloc to verify
  size | total size of the variable
  gaps | if 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

  true | success
  false | the input argloc was illegal

## ◆ is_purging_cc()

constexpr THREAD_SAFE bool is_purging_cc | ( | cm_t | cm | ) |
| inline constexpr

Does the calling convention clean the stack arguments upon return?.

Note
  this function is valid only for x86 code