Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

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

Go to the source code of this file.

## Macros
#define | ROUND_UP(v, a) (((size_t)(v) + (a) - 1) & ~((a) - 1))
#define | MIN_STACK_SIZE 64
#define | FIRST_ARG_SLOT 9
#define | DEBUG_LEVEL 0
#define | fldw(addr, fpreg) __asm__ volatile ("fldw 0(%0), %%" #fpreg "L" : : "r"(addr) : #fpreg)
#define | fstw(fpreg, addr) __asm__ volatile ("fstw %%" #fpreg "L, 0(%0)" : : "r"(addr))
#define | fldd(addr, fpreg) __asm__ volatile ("fldd 0(%0), %%" #fpreg : : "r"(addr) : #fpreg)
#define | fstd(fpreg, addr) __asm__ volatile ("fstd %%" #fpreg "L, 0(%0)" : : "r"(addr))
#define | debug(lvl, x...) do { if (lvl <= DEBUG_LEVEL) { printf(x); } } while (0)

## Functions
void | ffi_prep_args_pa32 (UINT32 *stack, extended_cif *ecif, unsigned bytes)
ffi_status | ffi_prep_cif_machdep (ffi_cif *cif)
void | ffi_call_pa32 (void(*)(UINT32 *, extended_cif *, unsigned), extended_cif *, unsigned, unsigned, unsigned *, void(*fn)(void))
void | ffi_call (ffi_cif *cif, void(*fn)(void), void *rvalue, void **avalue)

## Macro Definition Documentation

## ◆ debug

#define debug | ( |  | lvl,
|  |  | x...
| ) |  | do { if (lvl <= DEBUG_LEVEL) { printf(x); } } while (0)

Definition at line 52 of file ffi.c.

## ◆ DEBUG_LEVEL

#define DEBUG_LEVEL 0

Definition at line 41 of file ffi.c.

## ◆ FIRST_ARG_SLOT

#define FIRST_ARG_SLOT 9

Definition at line 40 of file ffi.c.

## ◆ fldd

#define fldd | ( |  | addr,
|  |  | fpreg
| ) |  | __asm__ volatile ("fldd 0(%0), %%" #fpreg : : "r"(addr) : #fpreg)

Definition at line 47 of file ffi.c.

## ◆ fldw

#define fldw | ( |  | addr,
|  |  | fpreg
| ) |  | __asm__ volatile ("fldw 0(%0), %%" #fpreg "L" : : "r"(addr) : #fpreg)

Definition at line 43 of file ffi.c.

## ◆ fstd

#define fstd | ( |  | fpreg,
|  |  | addr
| ) |  | __asm__ volatile ("fstd %%" #fpreg "L, 0(%0)" : : "r"(addr))

Definition at line 49 of file ffi.c.

## ◆ fstw

#define fstw | ( |  | fpreg,
|  |  | addr
| ) |  | __asm__ volatile ("fstw %%" #fpreg "L, 0(%0)" : : "r"(addr))

Definition at line 45 of file ffi.c.

## ◆ MIN_STACK_SIZE

#define MIN_STACK_SIZE 64

Definition at line 39 of file ffi.c.

## ◆ ROUND_UP

#define ROUND_UP | ( |  | v,
|  |  | a
| ) |  | (((size_t)(v) + (a) - 1) & ~((a) - 1))

Definition at line 37 of file ffi.c.

## Function Documentation

## ◆ ffi_call()

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

Definition at line 376 of file ffi.c.

References alloca, extended_cif::avalue, extended_cif::cif, debug, FFI_ASSERT, ffi_call_pa32(), ffi_prep_args_pa32(), FFI_TYPE_LONGDOUBLE, NULL, and extended_cif::rvalue.

## ◆ ffi_call_pa32()

void ffi_call_pa32 | ( | void(*)(UINT32 *, extended_cif *, unsigned) | ,
|  | extended_cif * | ,
|  | unsigned | ,
|  | unsigned | ,
|  | unsigned * | ,
|  | void(*)(void) | fn
| ) |  |

Referenced by ffi_call().

## ◆ ffi_prep_args_pa32()

void ffi_prep_args_pa32 | ( | UINT32 * | stack,
|  | extended_cif * | ecif,
|  | unsigned | bytes
| ) |  |

Definition at line 142 of file ffi.c.

References extended_cif::avalue, extended_cif::cif, debug, FFI_ASSERT, FFI_TYPE_LONGDOUBLE, FIRST_ARG_SLOT, fldd, fldw, i, len, memcpy(), and n.

Referenced by ffi_call().

## ◆ ffi_prep_cif_machdep()

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

Definition at line 319 of file ffi.c.

References FFI_TYPE_LONGDOUBLE, and unsigned.