Ruby: ext/fiddle/libffi-3.2.1/src/aarch64/ffi.c File Reference

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

Data Structures | Macros | Functions
ffi.c File Reference
`#include <stdio.h>`
`#include <ffi.h>`
`#include <ffi_common.h>`
`#include <stdlib.h>`

Go to the source code of this file.

## Data Structures
union | _d
struct | call_context
struct | arg_state

## Macros
#define | AARCH64_STACK_ALIGN 16
#define | N_X_ARG_REG 8
#define | N_V_ARG_REG 8
#define | AARCH64_FFI_WITH_V (1 << AARCH64_FFI_WITH_V_BIT)
#define | FFI_INIT_TRAMPOLINE(TRAMP, FUN, CTX, FLAGS)

## Functions
void | ffi_call_SYSV (unsigned(*)(struct call_context *context, unsigned char *, extended_cif *), struct call_context *context, extended_cif *, size_t, void(*fn)(void))
void | ffi_closure_SYSV (ffi_closure *)
ffi_status | ffi_prep_cif_machdep (ffi_cif *cif)
void | ffi_call (ffi_cif *cif, void(*fn)(void), void *rvalue, void **avalue)
ffi_status | ffi_prep_closure_loc (ffi_closure *closure, ffi_cif *cif, void(*fun)(ffi_cif *, void *, void **, void *), void *user_data, void *codeloc)
void FFI_HIDDEN | ffi_closure_SYSV_inner (ffi_closure *closure, struct call_context *context, void *stack)

## Macro Definition Documentation

## ◆ AARCH64_FFI_WITH_V

#define AARCH64_FFI_WITH_V (1 << AARCH64_FFI_WITH_V_BIT)

Definition at line 39 of file ffi.c.

## ◆ AARCH64_STACK_ALIGN

#define AARCH64_STACK_ALIGN 16

Definition at line 33 of file ffi.c.

## ◆ FFI_INIT_TRAMPOLINE

#define FFI_INIT_TRAMPOLINE | ( |  | TRAMP,
|  |  | FUN,
|  |  | CTX,
|  |  | FLAGS
| ) |  |

Value:
({unsigned char *__tramp = (unsigned char*)(TRAMP); \
UINT64 __fun = (UINT64)(FUN); \
UINT64 __ctx = (UINT64)(CTX); \
UINT64 __flags = (UINT64)(FLAGS); \
memcpy (__tramp, trampoline, sizeof (trampoline)); \
memcpy (__tramp + 12, &__fun, sizeof (__fun)); \
memcpy (__tramp + 20, &__ctx, sizeof (__ctx)); \
memcpy (__tramp + 28, &__flags, sizeof (__flags)); \
ffi_clear_cache(__tramp, __tramp + FFI_TRAMPOLINE_SIZE); \
})
FFI_TRAMPOLINE_SIZE
#define FFI_TRAMPOLINE_SIZE
Definition: ffitarget.h:45
UINT64
unsigned __int64 UINT64
Definition: ffi_common.h:102
FLAGS
@ FLAGS
Definition: inflate.h:22

Definition at line 915 of file ffi.c.

## ◆ N_V_ARG_REG

#define N_V_ARG_REG 8

Definition at line 37 of file ffi.c.

## ◆ N_X_ARG_REG

#define N_X_ARG_REG 8

Definition at line 36 of file ffi.c.

## Function Documentation

## ◆ ffi_call()

void ffi_call | ( | ffi_cif * | cif,
|  | void(*)(void) | fn,
|  | void * | rvalue,
|  | void ** | avalue
| ) |  |

Definition at line 813 of file ffi.c.

References ALIGN, extended_cif::avalue, extended_cif::cif, FFI_ASSERT, ffi_call_SYSV(), FFI_SYSV, FFI_TYPE_LONGDOUBLE, memcpy, N_X_ARG_REG, and extended_cif::rvalue.

Referenced by ffi_java_raw_call(), ffi_raw_call(), and main().

## ◆ ffi_call_SYSV()

void ffi_call_SYSV | ( | unsigned(*)(struct call_context *context, unsigned char *, extended_cif *) | ,
|  | struct call_context * | context,
|  | extended_cif * | ,
|  | size_t | ,
|  | void(*)(void) | fn
| ) |  |

Referenced by ffi_call(), and ffi_raw_call().

## ◆ ffi_closure_SYSV()

void ffi_closure_SYSV | ( | ffi_closure * |  | ) |

Definition at line 420 of file ffi.c.

## ◆ ffi_closure_SYSV_inner()

void FFI_HIDDEN ffi_closure_SYSV_inner | ( | ffi_closure * | closure,
|  | struct call_context * | context,
|  | void * | stack
| ) |  |

Definition at line 964 of file ffi.c.

References ALIGN, alloca, FFI_ASSERT, FFI_TYPE_LONGDOUBLE, memcpy, N_V_ARG_REG, N_X_ARG_REG, and NULL.

Referenced by ffi_prep_closure_loc().

## ◆ ffi_prep_cif_machdep()

ffi_status ffi_prep_cif_machdep | ( | ffi_cif * | cif | ) |

Definition at line 758 of file ffi.c.

Referenced by ffi_prep_cif_core(), and ffi_prep_cif_machdep_var().

## ◆ ffi_prep_closure_loc()

ffi_status ffi_prep_closure_loc | ( | ffi_closure * | closure,
|  | ffi_cif * | cif,
|  | void(*)(ffi_cif *, void *, void **, void *) | fun,
|  | void * | user_data,
|  | void * | codeloc
| ) |  |

Definition at line 928 of file ffi.c.

References ffi_closure_SYSV(), FFI_INIT_TRAMPOLINE, and FFI_SYSV.

Referenced by main().