diff options
author | Andreas Tobler <andreast@gcc.gnu.org> | 2003-10-21 21:01:58 +0200 |
---|---|---|
committer | Andreas Tobler <andreast@gcc.gnu.org> | 2003-10-21 21:01:58 +0200 |
commit | 1450eb7a07b5967bb4370d458385b945835f6df0 (patch) | |
tree | 9d7d39e0a966f4e98e779b43dc0089cf9c08478a /libffi/src | |
parent | 6b5a2662c72cc5281b19edb3848a463d6bf98e69 (diff) | |
download | gcc-1450eb7a07b5967bb4370d458385b945835f6df0.tar.gz |
[multiple changes]
2003-10-21 Andreas Tobler <a.tobler@schweiz.ch>
* configure.in: AC_LINK_FILES(ffitarget.h).
* configure: Regenerate.
* Makefile.in: Likewise.
* include/Makefile.in: Likewise.
* testsuite/Makefile.in: Likewise.
* fficonfig.h.in: Likewise.
2003-10-21 Paolo Bonzini <bonzini@gnu.org>
Richard Henderson <rth@redhat.com>
Avoid that ffi.h includes fficonfig.h.
* Makefile.am (EXTRA_DIST): Include ffitarget.h files
(TARGET_SRC_MIPS_GCC): Renamed to TARGET_SRC_MIPS_IRIX.
(TARGET_SRC_MIPS_SGI): Removed.
(MIPS_GCC): Renamed to TARGET_SRC_MIPS_IRIX.
(MIPS_SGI): Removed.
(CLEANFILES): Removed.
(mostlyclean-am, clean-am, mostlyclean-sub, clean-sub): New
targets.
* acconfig.h: Removed.
* configure.in: Compute sizeofs only for double and long double.
Use them to define and subst HAVE_LONG_DOUBLE. Include comments
into AC_DEFINE instead of using acconfig.h. Create
include/ffitarget.h instead of include/fficonfig.h. Rename
MIPS_GCC to MIPS_IRIX, drop MIPS_SGI since we are in gcc's tree.
AC_DEFINE EH_FRAME_FLAGS.
* include/Makefile.am (DISTCLEANFILES): New automake macro.
(hack_DATA): Add ffitarget.h.
* include/ffi.h.in: Remove all system specific definitions.
Declare raw API even if it is not installed, why bother?
Use limits.h instead of SIZEOF_* to define ffi_type_*. Do
not define EH_FRAME_FLAGS, it is in fficonfig.h now. Include
ffitarget.h instead of fficonfig.h. Remove ALIGN macro.
(UINT_ARG, INT_ARG): Removed, use ffi_arg and ffi_sarg instead.
* include/ffi_common.h (bool): Do not define.
(ffi_assert): Accept failed assertion.
(ffi_type_test): Return void and accept file/line.
(FFI_ASSERT): Pass stringized failed assertion.
(FFI_ASSERT_AT): New macro.
(FFI_ASSERT_VALID_TYPE): New macro.
(UINT8, SINT8, UINT16, SINT16, UINT32, SINT32,
UINT64, SINT64): Define here with gcc's __attribute__ macro
instead of in ffi.h
(FLOAT32, ALIGN): Define here instead of in ffi.h
* include/ffi-mips.h: Removed. Its content moved to
src/mips/ffitarget.h after separating assembly and C sections.
* src/alpha/ffi.c, src/alpha/ffi.c, src/java_raw_api.c
src/prep_cif.c, src/raw_api.c, src/ia64/ffi.c,
src/mips/ffi.c, src/mips/n32.S, src/mips/o32.S,
src/mips/ffitarget.h, src/sparc/ffi.c, src/x86/ffi64.c:
SIZEOF_ARG -> FFI_SIZEOF_ARG.
* src/ia64/ffi.c: Include stdbool.h (provided by GCC 2.95+).
* src/debug.c (ffi_assert): Accept stringized failed assertion.
(ffi_type_test): Rewritten.
* src/prep-cif.c (initialize_aggregate, ffi_prep_cif): Call
FFI_ASSERT_VALID_TYPE.
* src/alpha/ffitarget.h, src/arm/ffitarget.h,
src/ia64/ffitarget.h, src/m68k/ffitarget.h,
src/mips/ffitarget.h, src/powerpc/ffitarget.h,
src/s390/ffitarget.h, src/sh/ffitarget.h,
src/sh64/ffitarget.h, src/sparc/ffitarget.h,
src/x86/ffitarget.h: New files.
* src/alpha/osf.S, src/arm/sysv.S, src/ia64/unix.S,
src/m68k/sysv.S, src/mips/n32.S, src/mips/o32.S,
src/powerpc/aix.S, src/powerpc/darwin.S,
src/powerpc/ffi_darwin.c, src/powerpc/linux64.S,
src/powerpc/linux64_closure.S, src/powerpc/ppc_closure.S,
src/powerpc/sysv.S, src/s390/sysv.S, src/sh/sysv.S,
src/sh64/sysv.S, src/sparc/v8.S, src/sparc/v9.S,
src/x86/sysv.S, src/x86/unix64.S, src/x86/win32.S:
include fficonfig.h
From-SVN: r72766
Diffstat (limited to 'libffi/src')
32 files changed, 188 insertions, 173 deletions
diff --git a/libffi/src/alpha/ffi.c b/libffi/src/alpha/ffi.c index 2ed36732790..00d33790109 100644 --- a/libffi/src/alpha/ffi.c +++ b/libffi/src/alpha/ffi.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 1998, 2001 Cygnus Solutions + ffi.c - Copyright (c) 1998, 2001 Red Hat, Inc. Alpha Foreign Function Interface @@ -37,8 +37,8 @@ ffi_prep_cif_machdep(ffi_cif *cif) { /* Adjust cif->bytes to represent a minimum 6 words for the temporary register argument loading area. */ - if (cif->bytes < 6*SIZEOF_ARG) - cif->bytes = 6*SIZEOF_ARG; + if (cif->bytes < 6*FFI_SIZEOF_ARG) + cif->bytes = 6*FFI_SIZEOF_ARG; /* Set the return type flag */ switch (cif->rtype->type) @@ -73,7 +73,7 @@ ffi_call(ffi_cif *cif, void (*fn)(), void *rvalue, void **avalue) /* Allocate the space for the arguments, plus 4 words of temp space for ffi_call_osf. */ - argp = stack = alloca(cif->bytes + 4*SIZEOF_ARG); + argp = stack = alloca(cif->bytes + 4*FFI_SIZEOF_ARG); if (cif->flags == FFI_TYPE_STRUCT) *(void **) argp++ = rvalue; @@ -137,7 +137,7 @@ ffi_call(ffi_cif *cif, void (*fn)(), void *rvalue, void **avalue) FFI_ASSERT(0); } - argp += ALIGN((*arg_types)->size, SIZEOF_ARG) / SIZEOF_ARG; + argp += ALIGN((*arg_types)->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; i++, arg_types++, avalue++; } @@ -240,7 +240,7 @@ ffi_closure_osf_inner(ffi_closure *closure, void *rvalue, unsigned long *argp) FFI_ASSERT(0); } - argn += ALIGN(arg_types[i]->size, SIZEOF_ARG) / SIZEOF_ARG; + argn += ALIGN(arg_types[i]->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; i++; } diff --git a/libffi/src/alpha/osf.S b/libffi/src/alpha/osf.S index 1f6b4059c64..cfa7a964bc1 100644 --- a/libffi/src/alpha/osf.S +++ b/libffi/src/alpha/osf.S @@ -26,6 +26,7 @@ ----------------------------------------------------------------------- */ #define LIBFFI_ASM +#include <fficonfig.h> #include <ffi.h> .arch ev6 diff --git a/libffi/src/arm/ffi.c b/libffi/src/arm/ffi.c index dcd9891dcc2..37e3838246a 100644 --- a/libffi/src/arm/ffi.c +++ b/libffi/src/arm/ffi.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 1998 Cygnus Solutions + ffi.c - Copyright (c) 1998 Red Hat, Inc. ARM Foreign Function Interface diff --git a/libffi/src/arm/sysv.S b/libffi/src/arm/sysv.S index c600c83d9f5..0e4186114a9 100644 --- a/libffi/src/arm/sysv.S +++ b/libffi/src/arm/sysv.S @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - sysv.S - Copyright (c) 1998 Cygnus Solutions + sysv.S - Copyright (c) 1998 Red Hat, Inc. ARM Foreign Function Interface @@ -24,6 +24,7 @@ ----------------------------------------------------------------------- */ #define LIBFFI_ASM +#include <fficonfig.h> #include <ffi.h> #ifdef HAVE_MACHINE_ASM_H #include <machine/asm.h> diff --git a/libffi/src/debug.c b/libffi/src/debug.c index 099b3977825..98f1f9f0b4e 100644 --- a/libffi/src/debug.c +++ b/libffi/src/debug.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - debug.c - Copyright (c) 1996 Cygnus Solutions + debug.c - Copyright (c) 1996 Red Hat, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -37,29 +37,23 @@ void ffi_stop_here(void) /* This function should only be called via the FFI_ASSERT() macro */ -int ffi_assert(char *file, int line) +void ffi_assert(char *expr, char *file, int line) { - fprintf(stderr, "ASSERTION FAILURE: %s line %d\n", file, line); + fprintf(stderr, "ASSERTION FAILURE: %s at %s:%d\n", expr, file, line); ffi_stop_here(); abort(); - - /* This has to return something for the compiler not to complain */ - /*@notreached@*/ - return 0; } /* Perform a sanity check on an ffi_type structure */ -bool ffi_type_test(ffi_type *a) +void ffi_type_test(ffi_type *a, char *file, int line) { + FFI_ASSERT_AT(a != NULL, file, line); + /*@-usedef@*/ - FFI_ASSERT(a->type <= FFI_TYPE_LAST); - FFI_ASSERT(a->type > FFI_TYPE_VOID ? a->size > 0 : 1); - FFI_ASSERT(a->type > FFI_TYPE_VOID ? a->alignment > 0 : 1); - FFI_ASSERT(a->type == FFI_TYPE_STRUCT ? a->elements != NULL : 1); + FFI_ASSERT_AT(a->type <= FFI_TYPE_LAST, file, line); + FFI_ASSERT_AT(a->type == FFI_TYPE_VOID || a->size > 0, file, line); + FFI_ASSERT_AT(a->type == FFI_TYPE_VOID || a->alignment > 0, file, line); + FFI_ASSERT_AT(a->type != FFI_TYPE_STRUCT || a->elements != NULL, file, line); /*@=usedef@*/ - - /* This is a silly thing to return, but it keeps the compiler from - issuing warnings about "a" not being used in non-debug builds. */ - return (a != NULL); } diff --git a/libffi/src/ia64/ffi.c b/libffi/src/ia64/ffi.c index 4338d34c4b0..2908081a12b 100644 --- a/libffi/src/ia64/ffi.c +++ b/libffi/src/ia64/ffi.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 1998 Cygnus Solutions + ffi.c - Copyright (c) 1998 Red Hat, Inc. Copyright (c) 2000 Hewlett Packard Company IA64 Foreign Function Interface @@ -28,6 +28,7 @@ #include <ffi_common.h> #include <stdlib.h> +#include <stdbool.h> #include "ia64_flags.h" @@ -210,7 +211,7 @@ ffi_prep_args(struct ia64_args *stack, extended_cif *ecif, int bytes) { size_t sz = (*p_arg)->size; unsigned short element_type; - z = ((*p_arg)->size + SIZEOF_ARG - 1)/SIZEOF_ARG; + z = ((*p_arg)->size + FFI_SIZEOF_ARG - 1)/FFI_SIZEOF_ARG; if (is_homogeneous_fp_aggregate(*p_arg, 8, &element_type)) { int i; int nelements = sz/float_type_size(element_type); @@ -596,7 +597,7 @@ ffi_prep_incoming_args_UNIX(struct ia64_args *args, void **rvalue, { size_t sz = (*p_arg)->size; unsigned short element_type; - z = ((*p_arg)->size + SIZEOF_ARG - 1)/SIZEOF_ARG; + z = ((*p_arg)->size + FFI_SIZEOF_ARG - 1)/FFI_SIZEOF_ARG; if (is_homogeneous_fp_aggregate(*p_arg, 8, &element_type)) { int nelements = sz/float_type_size(element_type); if (nelements + fp_reg_num >= 8) { diff --git a/libffi/src/ia64/unix.S b/libffi/src/ia64/unix.S index e599268c721..c0c5058b76e 100644 --- a/libffi/src/ia64/unix.S +++ b/libffi/src/ia64/unix.S @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - unix.S - Copyright (c) 1998 Cygnus Solutions + unix.S - Copyright (c) 1998 Red Hat, Inc. Copyright (c) 2000 Hewlett Packard Company IA64/unix Foreign Function Interface @@ -29,6 +29,7 @@ ----------------------------------------------------------------------- */ #define LIBFFI_ASM +#include <fficonfig.h> #include <ffi.h> #include "ia64_flags.h" diff --git a/libffi/src/java_raw_api.c b/libffi/src/java_raw_api.c index c3b3b8226d8..e4664112b11 100644 --- a/libffi/src/java_raw_api.c +++ b/libffi/src/java_raw_api.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - java_raw_api.c - Copyright (c) 1999 Cygnus Solutions + java_raw_api.c - Copyright (c) 1999 Red Hat, Inc. Cloned from raw_api.c @@ -54,13 +54,13 @@ ffi_java_raw_size (ffi_cif *cif) case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: case FFI_TYPE_DOUBLE: - result += 2 * SIZEOF_ARG; + result += 2 * FFI_SIZEOF_ARG; break; case FFI_TYPE_STRUCT: /* No structure parameters in Java. */ abort(); default: - result += SIZEOF_ARG; + result += FFI_SIZEOF_ARG; } } @@ -90,7 +90,7 @@ ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args) *args = (void*) ((char*)(raw++) + 2); break; -#if SIZEOF_ARG == 8 +#if FFI_SIZEOF_ARG == 8 case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: case FFI_TYPE_DOUBLE: @@ -105,7 +105,7 @@ ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args) default: *args = raw; - raw += ALIGN ((*tp)->size, SIZEOF_ARG) / SIZEOF_ARG; + raw += ALIGN ((*tp)->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; } } @@ -116,7 +116,7 @@ ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args) /* then assume little endian */ for (i = 0; i < cif->nargs; i++, tp++, args++) { -#if SIZEOF_ARG == 8 +#if FFI_SIZEOF_ARG == 8 switch((*tp)->type) { case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: @@ -127,10 +127,10 @@ ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args) default: *args = (void*) raw++; } -#else /* SIZEOF_ARG != 8 */ +#else /* FFI_SIZEOF_ARG != 8 */ *args = (void*) raw; raw += ALIGN ((*tp)->size, sizeof (void*)) / sizeof (void*); -#endif /* SIZEOF_ARG == 8 */ +#endif /* FFI_SIZEOF_ARG == 8 */ } #else @@ -202,7 +202,7 @@ ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw) (raw++)->flt = *(FLOAT32*) (*args); break; -#if SIZEOF_ARG == 8 +#if FFI_SIZEOF_ARG == 8 case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: case FFI_TYPE_DOUBLE: @@ -216,11 +216,11 @@ ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw) break; default: -#if SIZEOF_ARG == 8 +#if FFI_SIZEOF_ARG == 8 FFI_ASSERT(FALSE); /* Should have covered all cases */ #else memcpy ((void*) raw->data, (void*)*args, (*tp)->size); - raw += ALIGN ((*tp)->size, SIZEOF_ARG) / SIZEOF_ARG; + raw += ALIGN ((*tp)->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; #endif } } @@ -231,7 +231,7 @@ ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw) static void ffi_java_rvalue_to_raw (ffi_cif *cif, void *rvalue) { -#if WORDS_BIGENDIAN && SIZEOF_ARG == 8 +#if WORDS_BIGENDIAN && FFI_SIZEOF_ARG == 8 switch (cif->rtype->type) { case FFI_TYPE_UINT8: @@ -256,7 +256,7 @@ ffi_java_rvalue_to_raw (ffi_cif *cif, void *rvalue) static void ffi_java_raw_to_rvalue (ffi_cif *cif, void *rvalue) { -#if WORDS_BIGENDIAN && SIZEOF_ARG == 8 +#if WORDS_BIGENDIAN && FFI_SIZEOF_ARG == 8 switch (cif->rtype->type) { case FFI_TYPE_UINT8: diff --git a/libffi/src/m68k/sysv.S b/libffi/src/m68k/sysv.S index a925d99e3ce..d019a377e5b 100644 --- a/libffi/src/m68k/sysv.S +++ b/libffi/src/m68k/sysv.S @@ -5,6 +5,7 @@ ----------------------------------------------------------------------- */ #define LIBFFI_ASM +#include <fficonfig.h> #include <ffi.h> .text diff --git a/libffi/src/mips/ffi.c b/libffi/src/mips/ffi.c index 01ad20e4c0d..cc2078bc7e2 100644 --- a/libffi/src/mips/ffi.c +++ b/libffi/src/mips/ffi.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 1996 Cygnus Solutions + ffi.c - Copyright (c) 1996 Red Hat, Inc. MIPS Foreign Function Interface @@ -23,7 +23,6 @@ OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ -#include <sgidefs.h> #include <ffi.h> #include <ffi_common.h> @@ -59,8 +58,8 @@ static void ffi_prep_args(char *stack, /* If more than 8 double words are used, the remainder go on the stack. We reorder stuff on the stack here to support this easily. */ - if (bytes > 8 * SIZEOF_ARG) - argp = &stack[bytes - (8 * SIZEOF_ARG)]; + if (bytes > 8 * FFI_SIZEOF_ARG) + argp = &stack[bytes - (8 * FFI_SIZEOF_ARG)]; else argp = stack; #else @@ -75,8 +74,8 @@ static void ffi_prep_args(char *stack, if ( ecif->cif->rtype->type == FFI_TYPE_STRUCT ) #endif { - *(SLOT_TYPE_UNSIGNED *) argp = (SLOT_TYPE_UNSIGNED) ecif->rvalue; - argp += sizeof(SLOT_TYPE_UNSIGNED); + *(ffi_arg *) argp = (ffi_arg) ecif->rvalue; + argp += sizeof(ffi_arg); FIX_ARGP; } @@ -99,9 +98,9 @@ static void ffi_prep_args(char *stack, #endif z = (*p_arg)->size; - if (z < sizeof(SLOT_TYPE_UNSIGNED)) + if (z < sizeof(ffi_arg)) { - z = sizeof(SLOT_TYPE_UNSIGNED); + z = sizeof(ffi_arg); switch ((*p_arg)->type) { diff --git a/libffi/src/mips/n32.S b/libffi/src/mips/n32.S index 04b5e40b41f..767fa52bd5c 100644 --- a/libffi/src/mips/n32.S +++ b/libffi/src/mips/n32.S @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - n32.S - Copyright (c) 1996, 1998 Cygnus Solutions + n32.S - Copyright (c) 1996, 1998 Red Hat, Inc. MIPS Foreign Function Interface @@ -24,6 +24,7 @@ ----------------------------------------------------------------------- */ #define LIBFFI_ASM +#include <fficonfig.h> #include <ffi.h> /* Only build this code if we are compiling for n32 */ @@ -36,7 +37,7 @@ #define raddr a4 #define fn a5 -#define SIZEOF_FRAME ( 8 * SIZEOF_ARG ) +#define SIZEOF_FRAME ( 8 * FFI_SIZEOF_ARG ) .text .align 2 @@ -46,37 +47,37 @@ ffi_call_N32: # Prologue SUBU $sp, SIZEOF_FRAME # Frame size - REG_S $fp, SIZEOF_FRAME - 2*SIZEOF_ARG($sp) # Save frame pointer - REG_S ra, SIZEOF_FRAME - 1*SIZEOF_ARG($sp) # Save return address + REG_S $fp, SIZEOF_FRAME - 2*FFI_SIZEOF_ARG($sp) # Save frame pointer + REG_S ra, SIZEOF_FRAME - 1*FFI_SIZEOF_ARG($sp) # Save return address move $fp, $sp move t9, callback # callback function pointer - REG_S bytes, 2*SIZEOF_ARG($fp) # bytes - REG_S flags, 3*SIZEOF_ARG($fp) # flags - REG_S raddr, 4*SIZEOF_ARG($fp) # raddr - REG_S fn, 5*SIZEOF_ARG($fp) # fn + REG_S bytes, 2*FFI_SIZEOF_ARG($fp) # bytes + REG_S flags, 3*FFI_SIZEOF_ARG($fp) # flags + REG_S raddr, 4*FFI_SIZEOF_ARG($fp) # raddr + REG_S fn, 5*FFI_SIZEOF_ARG($fp) # fn # Allocate at least 4 words in the argstack move v0, bytes - bge bytes, 4 * SIZEOF_ARG, bigger - LI v0, 4 * SIZEOF_ARG + bge bytes, 4 * FFI_SIZEOF_ARG, bigger + LI v0, 4 * FFI_SIZEOF_ARG b sixteen bigger: - ADDU t4, v0, 2 * SIZEOF_ARG -1 # make sure it is aligned - and v0, t4, -2 * SIZEOF_ARG # to a proper boundry. + ADDU t4, v0, 2 * FFI_SIZEOF_ARG -1 # make sure it is aligned + and v0, t4, -2 * FFI_SIZEOF_ARG # to a proper boundry. sixteen: SUBU $sp, $sp, v0 # move the stack pointer to reflect the # arg space - ADDU a0, $sp, 0 # 4 * SIZEOF_ARG - ADDU a3, $fp, 3 * SIZEOF_ARG + ADDU a0, $sp, 0 # 4 * FFI_SIZEOF_ARG + ADDU a3, $fp, 3 * FFI_SIZEOF_ARG # Call ffi_prep_args jal t9 - # ADDU $sp, $sp, 4 * SIZEOF_ARG # adjust $sp to new args + # ADDU $sp, $sp, 4 * FFI_SIZEOF_ARG # adjust $sp to new args # Copy the stack pointer to t9 move t9, $sp @@ -85,10 +86,10 @@ sixteen: # of arguments. # Load the number of bytes - REG_L t6, 2*SIZEOF_ARG($fp) + REG_L t6, 2*FFI_SIZEOF_ARG($fp) - # Is it bigger than 8 * SIZEOF_ARG? - dadd t7, $0, 8 * SIZEOF_ARG + # Is it bigger than 8 * FFI_SIZEOF_ARG? + dadd t7, $0, 8 * FFI_SIZEOF_ARG dsub t8, t6, t7 bltz t8, loadregs @@ -96,125 +97,125 @@ sixteen: loadregs: - REG_L t4, 3*SIZEOF_ARG($fp) # load the flags word + REG_L t4, 3*FFI_SIZEOF_ARG($fp) # load the flags word add t6, t4, 0 # and copy it into t6 and t4, ((1<<FFI_FLAG_BITS)-1) bnez t4, arg1_floatp - REG_L a0, 0*SIZEOF_ARG(t9) + REG_L a0, 0*FFI_SIZEOF_ARG(t9) b arg1_next arg1_floatp: bne t4, FFI_TYPE_FLOAT, arg1_doublep - l.s $f12, 0*SIZEOF_ARG(t9) + l.s $f12, 0*FFI_SIZEOF_ARG(t9) b arg1_next arg1_doublep: - l.d $f12, 0*SIZEOF_ARG(t9) + l.d $f12, 0*FFI_SIZEOF_ARG(t9) arg1_next: add t4, t6, 0 SRL t4, 1*FFI_FLAG_BITS and t4, ((1<<FFI_FLAG_BITS)-1) bnez t4, arg2_floatp - REG_L a1, 1*SIZEOF_ARG(t9) + REG_L a1, 1*FFI_SIZEOF_ARG(t9) b arg2_next arg2_floatp: bne t4, FFI_TYPE_FLOAT, arg2_doublep - l.s $f13, 1*SIZEOF_ARG(t9) + l.s $f13, 1*FFI_SIZEOF_ARG(t9) b arg2_next arg2_doublep: - l.d $f13, 1*SIZEOF_ARG(t9) + l.d $f13, 1*FFI_SIZEOF_ARG(t9) arg2_next: add t4, t6, 0 SRL t4, 2*FFI_FLAG_BITS and t4, ((1<<FFI_FLAG_BITS)-1) bnez t4, arg3_floatp - REG_L a2, 2*SIZEOF_ARG(t9) + REG_L a2, 2*FFI_SIZEOF_ARG(t9) b arg3_next arg3_floatp: bne t4, FFI_TYPE_FLOAT, arg3_doublep - l.s $f14, 2*SIZEOF_ARG(t9) + l.s $f14, 2*FFI_SIZEOF_ARG(t9) b arg3_next arg3_doublep: - l.d $f14, 2*SIZEOF_ARG(t9) + l.d $f14, 2*FFI_SIZEOF_ARG(t9) arg3_next: add t4, t6, 0 SRL t4, 3*FFI_FLAG_BITS and t4, ((1<<FFI_FLAG_BITS)-1) bnez t4, arg4_floatp - REG_L a3, 3*SIZEOF_ARG(t9) + REG_L a3, 3*FFI_SIZEOF_ARG(t9) b arg4_next arg4_floatp: bne t4, FFI_TYPE_FLOAT, arg4_doublep - l.s $f15, 3*SIZEOF_ARG(t9) + l.s $f15, 3*FFI_SIZEOF_ARG(t9) b arg4_next arg4_doublep: - l.d $f15, 3*SIZEOF_ARG(t9) + l.d $f15, 3*FFI_SIZEOF_ARG(t9) arg4_next: add t4, t6, 0 SRL t4, 4*FFI_FLAG_BITS and t4, ((1<<FFI_FLAG_BITS)-1) bnez t4, arg5_floatp - REG_L a4, 4*SIZEOF_ARG(t9) + REG_L a4, 4*FFI_SIZEOF_ARG(t9) b arg5_next arg5_floatp: bne t4, FFI_TYPE_FLOAT, arg5_doublep - l.s $f16, 4*SIZEOF_ARG(t9) + l.s $f16, 4*FFI_SIZEOF_ARG(t9) b arg5_next arg5_doublep: - l.d $f16, 4*SIZEOF_ARG(t9) + l.d $f16, 4*FFI_SIZEOF_ARG(t9) arg5_next: add t4, t6, 0 SRL t4, 5*FFI_FLAG_BITS and t4, ((1<<FFI_FLAG_BITS)-1) bnez t4, arg6_floatp - REG_L a5, 5*SIZEOF_ARG(t9) + REG_L a5, 5*FFI_SIZEOF_ARG(t9) b arg6_next arg6_floatp: bne t4, FFI_TYPE_FLOAT, arg6_doublep - l.s $f17, 5*SIZEOF_ARG(t9) + l.s $f17, 5*FFI_SIZEOF_ARG(t9) b arg6_next arg6_doublep: - l.d $f17, 5*SIZEOF_ARG(t9) + l.d $f17, 5*FFI_SIZEOF_ARG(t9) arg6_next: add t4, t6, 0 SRL t4, 6*FFI_FLAG_BITS and t4, ((1<<FFI_FLAG_BITS)-1) bnez t4, arg7_floatp - REG_L a6, 6*SIZEOF_ARG(t9) + REG_L a6, 6*FFI_SIZEOF_ARG(t9) b arg7_next arg7_floatp: bne t4, FFI_TYPE_FLOAT, arg7_doublep - l.s $f18, 6*SIZEOF_ARG(t9) + l.s $f18, 6*FFI_SIZEOF_ARG(t9) b arg7_next arg7_doublep: - l.d $f18, 6*SIZEOF_ARG(t9) + l.d $f18, 6*FFI_SIZEOF_ARG(t9) arg7_next: add t4, t6, 0 SRL t4, 7*FFI_FLAG_BITS and t4, ((1<<FFI_FLAG_BITS)-1) bnez t4, arg8_floatp - REG_L a7, 7*SIZEOF_ARG(t9) + REG_L a7, 7*FFI_SIZEOF_ARG(t9) b arg8_next arg8_floatp: bne t4, FFI_TYPE_FLOAT, arg8_doublep - l.s $f19, 7*SIZEOF_ARG(t9) + l.s $f19, 7*FFI_SIZEOF_ARG(t9) b arg8_next arg8_doublep: - l.d $f19, 7*SIZEOF_ARG(t9) + l.d $f19, 7*FFI_SIZEOF_ARG(t9) arg8_next: callit: # Load the function pointer - REG_L t9, 5*SIZEOF_ARG($fp) + REG_L t9, 5*FFI_SIZEOF_ARG($fp) # If the return value pointer is NULL, assume no return value. - REG_L t5, 4*SIZEOF_ARG($fp) + REG_L t5, 4*FFI_SIZEOF_ARG($fp) beqz t5, noretval # Shift the return type flag over @@ -222,42 +223,42 @@ callit: bne t6, FFI_TYPE_INT, retfloat jal t9 - REG_L t4, 4*SIZEOF_ARG($fp) + REG_L t4, 4*FFI_SIZEOF_ARG($fp) REG_S v0, 0(t4) b epilogue retfloat: bne t6, FFI_TYPE_FLOAT, retdouble jal t9 - REG_L t4, 4*SIZEOF_ARG($fp) + REG_L t4, 4*FFI_SIZEOF_ARG($fp) s.s $f0, 0(t4) b epilogue retdouble: bne t6, FFI_TYPE_DOUBLE, retstruct_d jal t9 - REG_L t4, 4*SIZEOF_ARG($fp) + REG_L t4, 4*FFI_SIZEOF_ARG($fp) s.d $f0, 0(t4) b epilogue retstruct_d: bne t6, FFI_TYPE_STRUCT_D, retstruct_f jal t9 - REG_L t4, 4*SIZEOF_ARG($fp) + REG_L t4, 4*FFI_SIZEOF_ARG($fp) s.d $f0, 0(t4) b epilogue retstruct_f: bne t6, FFI_TYPE_STRUCT_F, retstruct_d_d jal t9 - REG_L t4, 4*SIZEOF_ARG($fp) + REG_L t4, 4*FFI_SIZEOF_ARG($fp) s.s $f0, 0(t4) b epilogue retstruct_d_d: bne t6, FFI_TYPE_STRUCT_DD, retstruct_f_f jal t9 - REG_L t4, 4*SIZEOF_ARG($fp) + REG_L t4, 4*FFI_SIZEOF_ARG($fp) s.d $f0, 0(t4) s.d $f2, 8(t4) b epilogue @@ -265,7 +266,7 @@ retstruct_d_d: retstruct_f_f: bne t6, FFI_TYPE_STRUCT_FF, retstruct_d_f jal t9 - REG_L t4, 4*SIZEOF_ARG($fp) + REG_L t4, 4*FFI_SIZEOF_ARG($fp) s.s $f0, 0(t4) s.s $f2, 4(t4) b epilogue @@ -273,7 +274,7 @@ retstruct_f_f: retstruct_d_f: bne t6, FFI_TYPE_STRUCT_DF, retstruct_f_d jal t9 - REG_L t4, 4*SIZEOF_ARG($fp) + REG_L t4, 4*FFI_SIZEOF_ARG($fp) s.d $f0, 0(t4) s.s $f2, 8(t4) b epilogue @@ -281,7 +282,7 @@ retstruct_d_f: retstruct_f_d: bne t6, FFI_TYPE_STRUCT_FD, retstruct_small jal t9 - REG_L t4, 4*SIZEOF_ARG($fp) + REG_L t4, 4*FFI_SIZEOF_ARG($fp) s.s $f0, 0(t4) s.d $f2, 8(t4) b epilogue @@ -289,14 +290,14 @@ retstruct_f_d: retstruct_small: bne t6, FFI_TYPE_STRUCT_SMALL, retstruct_small2 jal t9 - REG_L t4, 4*SIZEOF_ARG($fp) + REG_L t4, 4*FFI_SIZEOF_ARG($fp) REG_S v0, 0(t4) b epilogue retstruct_small2: bne t6, FFI_TYPE_STRUCT_SMALL2, retstruct jal t9 - REG_L t4, 4*SIZEOF_ARG($fp) + REG_L t4, 4*FFI_SIZEOF_ARG($fp) REG_S v0, 0(t4) REG_S v1, 8(t4) b epilogue @@ -308,8 +309,8 @@ noretval: # Epilogue epilogue: move $sp, $fp - REG_L $fp, SIZEOF_FRAME - 2*SIZEOF_ARG($sp) # Restore frame pointer - REG_L ra, SIZEOF_FRAME - 1*SIZEOF_ARG($sp) # Restore return address + REG_L $fp, SIZEOF_FRAME - 2*FFI_SIZEOF_ARG($sp) # Restore frame pointer + REG_L ra, SIZEOF_FRAME - 1*FFI_SIZEOF_ARG($sp) # Restore return address ADDU $sp, SIZEOF_FRAME # Fix stack pointer j ra diff --git a/libffi/src/mips/o32.S b/libffi/src/mips/o32.S index 4dfb2ba2104..295095f1ed8 100644 --- a/libffi/src/mips/o32.S +++ b/libffi/src/mips/o32.S @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - o32.S - Copyright (c) 1996, 1998 Cygnus Solutions + o32.S - Copyright (c) 1996, 1998 Red Hat, Inc. MIPS Foreign Function Interface @@ -24,6 +24,7 @@ ----------------------------------------------------------------------- */ #define LIBFFI_ASM +#include <fficonfig.h> #include <ffi.h> /* Only build this code if we are compiling for o32 */ @@ -34,7 +35,7 @@ #define bytes a2 #define flags a3 -#define SIZEOF_FRAME ( 4 * SIZEOF_ARG + 2 * SIZEOF_ARG ) +#define SIZEOF_FRAME ( 4 * FFI_SIZEOF_ARG + 2 * FFI_SIZEOF_ARG ) .text .align 2 @@ -44,114 +45,114 @@ ffi_call_O32: # Prologue SUBU $sp, SIZEOF_FRAME # Frame size - REG_S $fp, SIZEOF_FRAME - 2*SIZEOF_ARG($sp) # Save frame pointer - REG_S ra, SIZEOF_FRAME - 1*SIZEOF_ARG($sp) # Save return address + REG_S $fp, SIZEOF_FRAME - 2*FFI_SIZEOF_ARG($sp) # Save frame pointer + REG_S ra, SIZEOF_FRAME - 1*FFI_SIZEOF_ARG($sp) # Save return address move $fp, $sp move t9, callback # callback function pointer - REG_S flags, SIZEOF_FRAME + 3*SIZEOF_ARG($fp) # flags + REG_S flags, SIZEOF_FRAME + 3*FFI_SIZEOF_ARG($fp) # flags # Allocate at least 4 words in the argstack move v0, bytes - bge bytes, 4 * SIZEOF_ARG, bigger - LI v0, 4 * SIZEOF_ARG + bge bytes, 4 * FFI_SIZEOF_ARG, bigger + LI v0, 4 * FFI_SIZEOF_ARG b sixteen bigger: - ADDU t0, v0, 2 * SIZEOF_ARG -1 # make sure it is aligned - and v0, t0, -2 * SIZEOF_ARG # to an 8 byte boundry + ADDU t0, v0, 2 * FFI_SIZEOF_ARG -1 # make sure it is aligned + and v0, t0, -2 * FFI_SIZEOF_ARG # to an 8 byte boundry sixteen: SUBU $sp, $sp, v0 # move the stack pointer to reflect the # arg space - ADDU a0, $sp, 4 * SIZEOF_ARG - ADDU a3, $fp, SIZEOF_FRAME + 3*SIZEOF_ARG + ADDU a0, $sp, 4 * FFI_SIZEOF_ARG + ADDU a3, $fp, SIZEOF_FRAME + 3*FFI_SIZEOF_ARG jal t9 - REG_L t0, SIZEOF_FRAME + 3*SIZEOF_ARG($fp) # load the flags word + REG_L t0, SIZEOF_FRAME + 3*FFI_SIZEOF_ARG($fp) # load the flags word add t2, t0, 0 # and copy it into t2 and t0, ((1<<4)-1) # mask out the return type SRL t2, 4 # shift our arg info - ADDU $sp, $sp, 4 * SIZEOF_ARG # adjust $sp to new args + ADDU $sp, $sp, 4 * FFI_SIZEOF_ARG # adjust $sp to new args bnez t0, pass_d # make it quick for int - REG_L a0, 0*SIZEOF_ARG($sp) # just go ahead and load the - REG_L a1, 1*SIZEOF_ARG($sp) # four regs. - REG_L a2, 2*SIZEOF_ARG($sp) - REG_L a3, 3*SIZEOF_ARG($sp) + REG_L a0, 0*FFI_SIZEOF_ARG($sp) # just go ahead and load the + REG_L a1, 1*FFI_SIZEOF_ARG($sp) # four regs. + REG_L a2, 2*FFI_SIZEOF_ARG($sp) + REG_L a3, 3*FFI_SIZEOF_ARG($sp) b call_it pass_d: bne t0, FFI_ARGS_D, pass_f - l.d $f12, 0*SIZEOF_ARG($sp) # load $fp regs from args - REG_L a2, 2*SIZEOF_ARG($sp) # passing a double - REG_L a3, 3*SIZEOF_ARG($sp) + l.d $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args + REG_L a2, 2*FFI_SIZEOF_ARG($sp) # passing a double + REG_L a3, 3*FFI_SIZEOF_ARG($sp) b call_it pass_f: bne t0, FFI_ARGS_F, pass_d_d - l.s $f12, 0*SIZEOF_ARG($sp) # load $fp regs from args - REG_L a1, 1*SIZEOF_ARG($sp) # passing a float - REG_L a2, 2*SIZEOF_ARG($sp) - REG_L a3, 3*SIZEOF_ARG($sp) + l.s $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args + REG_L a1, 1*FFI_SIZEOF_ARG($sp) # passing a float + REG_L a2, 2*FFI_SIZEOF_ARG($sp) + REG_L a3, 3*FFI_SIZEOF_ARG($sp) b call_it pass_d_d: bne t0, FFI_ARGS_DD, pass_f_f - l.d $f12, 0*SIZEOF_ARG($sp) # load $fp regs from args - l.d $f14, 2*SIZEOF_ARG($sp) # passing two doubles + l.d $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args + l.d $f14, 2*FFI_SIZEOF_ARG($sp) # passing two doubles b call_it pass_f_f: bne t0, FFI_ARGS_FF, pass_d_f - l.s $f12, 0*SIZEOF_ARG($sp) # load $fp regs from args - l.s $f14, 1*SIZEOF_ARG($sp) # passing two floats - REG_L a2, 2*SIZEOF_ARG($sp) - REG_L a3, 3*SIZEOF_ARG($sp) + l.s $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args + l.s $f14, 1*FFI_SIZEOF_ARG($sp) # passing two floats + REG_L a2, 2*FFI_SIZEOF_ARG($sp) + REG_L a3, 3*FFI_SIZEOF_ARG($sp) b call_it pass_d_f: bne t0, FFI_ARGS_DF, pass_f_d - l.d $f12, 0*SIZEOF_ARG($sp) # load $fp regs from args - l.s $f14, 2*SIZEOF_ARG($sp) # passing double and float - REG_L a3, 3*SIZEOF_ARG($sp) + l.d $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args + l.s $f14, 2*FFI_SIZEOF_ARG($sp) # passing double and float + REG_L a3, 3*FFI_SIZEOF_ARG($sp) b call_it pass_f_d: # assume that the only other combination must be float then double # bne t0, FFI_ARGS_F_D, call_it - l.s $f12, 0*SIZEOF_ARG($sp) # load $fp regs from args - l.d $f14, 2*SIZEOF_ARG($sp) # passing double and float + l.s $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args + l.d $f14, 2*FFI_SIZEOF_ARG($sp) # passing double and float call_it: # Load the function pointer - REG_L t9, SIZEOF_FRAME + 5*SIZEOF_ARG($fp) + REG_L t9, SIZEOF_FRAME + 5*FFI_SIZEOF_ARG($fp) # If the return value pointer is NULL, assume no return value. - REG_L t1, SIZEOF_FRAME + 4*SIZEOF_ARG($fp) + REG_L t1, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp) beqz t1, noretval bne t2, FFI_TYPE_INT, retfloat jal t9 - REG_L t0, SIZEOF_FRAME + 4*SIZEOF_ARG($fp) + REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp) REG_S v0, 0(t0) b epilogue retfloat: bne t2, FFI_TYPE_FLOAT, retdouble jal t9 - REG_L t0, SIZEOF_FRAME + 4*SIZEOF_ARG($fp) + REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp) s.s $f0, 0(t0) b epilogue retdouble: bne t2, FFI_TYPE_DOUBLE, noretval jal t9 - REG_L t0, SIZEOF_FRAME + 4*SIZEOF_ARG($fp) + REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp) s.d $f0, 0(t0) b epilogue @@ -161,8 +162,8 @@ noretval: # Epilogue epilogue: move $sp, $fp - REG_L $fp, SIZEOF_FRAME - 2*SIZEOF_ARG($sp) # Restore frame pointer - REG_L ra, SIZEOF_FRAME - 1*SIZEOF_ARG($sp) # Restore return address + REG_L $fp, SIZEOF_FRAME - 2*FFI_SIZEOF_ARG($sp) # Restore frame pointer + REG_L ra, SIZEOF_FRAME - 1*FFI_SIZEOF_ARG($sp) # Restore return address ADDU $sp, SIZEOF_FRAME # Fix stack pointer j ra diff --git a/libffi/src/powerpc/aix.S b/libffi/src/powerpc/aix.S index 1346fb200c0..590717f6f55 100644 --- a/libffi/src/powerpc/aix.S +++ b/libffi/src/powerpc/aix.S @@ -80,6 +80,7 @@ .set f21,21 #define LIBFFI_ASM +#include <fficonfig.h> #include <ffi.h> #define JUMPTARGET(name) name #define L(x) x diff --git a/libffi/src/powerpc/darwin.S b/libffi/src/powerpc/darwin.S index 712252666fd..70c48e531d9 100644 --- a/libffi/src/powerpc/darwin.S +++ b/libffi/src/powerpc/darwin.S @@ -24,6 +24,7 @@ ----------------------------------------------------------------------- */ #define LIBFFI_ASM +#include <fficonfig.h> #include <ffi.h> #define JUMPTARGET(name) name #define L(x) x diff --git a/libffi/src/powerpc/ffi_darwin.c b/libffi/src/powerpc/ffi_darwin.c index aafe1aa704e..39b3cbb8c4a 100644 --- a/libffi/src/powerpc/ffi_darwin.c +++ b/libffi/src/powerpc/ffi_darwin.c @@ -25,6 +25,7 @@ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ + #include <ffi.h> #include <ffi_common.h> diff --git a/libffi/src/powerpc/linux64.S b/libffi/src/powerpc/linux64.S index 22079807720..f12d4ec0004 100644 --- a/libffi/src/powerpc/linux64.S +++ b/libffi/src/powerpc/linux64.S @@ -24,6 +24,7 @@ ----------------------------------------------------------------------- */ #define LIBFFI_ASM +#include <fficonfig.h> #include <ffi.h> #ifdef __powerpc64__ diff --git a/libffi/src/powerpc/linux64_closure.S b/libffi/src/powerpc/linux64_closure.S index 2d44d67c20f..db78ea6e822 100644 --- a/libffi/src/powerpc/linux64_closure.S +++ b/libffi/src/powerpc/linux64_closure.S @@ -1,4 +1,5 @@ #define LIBFFI_ASM +#include <fficonfig.h> #include <ffi.h> .file "linux64_closure.S" diff --git a/libffi/src/powerpc/ppc_closure.S b/libffi/src/powerpc/ppc_closure.S index 72c59e812e3..dce9daba6b1 100644 --- a/libffi/src/powerpc/ppc_closure.S +++ b/libffi/src/powerpc/ppc_closure.S @@ -1,4 +1,5 @@ #define LIBFFI_ASM +#include <fficonfig.h> #include <ffi.h> #include <powerpc/asm.h> diff --git a/libffi/src/powerpc/sysv.S b/libffi/src/powerpc/sysv.S index c045c779dfc..a7aaa3f8c8a 100644 --- a/libffi/src/powerpc/sysv.S +++ b/libffi/src/powerpc/sysv.S @@ -26,6 +26,7 @@ ----------------------------------------------------------------------- */ #define LIBFFI_ASM +#include <fficonfig.h> #include <ffi.h> #include <powerpc/asm.h> diff --git a/libffi/src/prep_cif.c b/libffi/src/prep_cif.c index d60d98ee9f5..f43ccfc4558 100644 --- a/libffi/src/prep_cif.c +++ b/libffi/src/prep_cif.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - prep_cif.c - Copyright (c) 1996, 1998 Cygnus Solutions + prep_cif.c - Copyright (c) 1996, 1998 Red Hat, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -26,9 +26,9 @@ #include <stdlib.h> -/* Round up to SIZEOF_ARG. */ +/* Round up to FFI_SIZEOF_ARG. */ -#define STACK_ARG_SIZE(x) ALIGN(x, SIZEOF_ARG) +#define STACK_ARG_SIZE(x) ALIGN(x, FFI_SIZEOF_ARG) /* Perform machine independent initialization of aggregate type specifications. */ @@ -53,7 +53,7 @@ static ffi_status initialize_aggregate(/*@out@*/ ffi_type *arg) return FFI_BAD_TYPEDEF; /* Perform a sanity check on the argument type */ - FFI_ASSERT(ffi_type_test((*ptr))); + FFI_ASSERT_VALID_TYPE(*ptr); arg->size = ALIGN(arg->size, (*ptr)->alignment); arg->size += (*ptr)->size; @@ -94,7 +94,7 @@ ffi_status ffi_prep_cif(/*@out@*/ /*@partial@*/ ffi_cif *cif, ffi_type **ptr; FFI_ASSERT(cif != NULL); - FFI_ASSERT((abi > FFI_FIRST_ABI) && (abi < FFI_LAST_ABI)); + FFI_ASSERT((abi > FFI_FIRST_ABI) && (abi <= FFI_DEFAULT_ABI)); cif->abi = abi; cif->arg_types = atypes; @@ -110,7 +110,7 @@ ffi_status ffi_prep_cif(/*@out@*/ /*@partial@*/ ffi_cif *cif, /*@=usedef@*/ /* Perform a sanity check on the return type */ - FFI_ASSERT(ffi_type_test(cif->rtype)); + FFI_ASSERT_VALID_TYPE(cif->rtype); /* x86-64 and s390 stack space allocation is handled in prep_machdep. */ #if !defined M68K && !defined __x86_64__ && !defined S390 @@ -126,7 +126,7 @@ ffi_status ffi_prep_cif(/*@out@*/ /*@partial@*/ ffi_cif *cif, for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) { /* Perform a sanity check on the argument type */ - FFI_ASSERT(ffi_type_test(*ptr)); + FFI_ASSERT_VALID_TYPE(*ptr); /* Initialize any uninitialized aggregate type definitions */ if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK)) diff --git a/libffi/src/raw_api.c b/libffi/src/raw_api.c index 45cb0043c4d..f4f4d80b152 100644 --- a/libffi/src/raw_api.c +++ b/libffi/src/raw_api.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - raw_api.c - Copyright (c) 1999 Cygnus Solutions + raw_api.c - Copyright (c) 1999 Red Hat, Inc. Author: Kresten Krab Thorup <krab@gnu.org> @@ -44,10 +44,10 @@ ffi_raw_size (ffi_cif *cif) { #if !FFI_NO_STRUCTS if ((*at)->type == FFI_TYPE_STRUCT) - result += ALIGN (sizeof (void*), SIZEOF_ARG); + result += ALIGN (sizeof (void*), FFI_SIZEOF_ARG); else #endif - result += ALIGN ((*at)->size, SIZEOF_ARG); + result += ALIGN ((*at)->size, FFI_SIZEOF_ARG); } return result; @@ -68,18 +68,18 @@ ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args) { case FFI_TYPE_UINT8: case FFI_TYPE_SINT8: - *args = (void*) ((char*)(raw++) + SIZEOF_ARG - 1); + *args = (void*) ((char*)(raw++) + FFI_SIZEOF_ARG - 1); break; case FFI_TYPE_UINT16: case FFI_TYPE_SINT16: - *args = (void*) ((char*)(raw++) + SIZEOF_ARG - 2); + *args = (void*) ((char*)(raw++) + FFI_SIZEOF_ARG - 2); break; -#if SIZEOF_ARG >= 4 +#if FFI_SIZEOF_ARG >= 4 case FFI_TYPE_UINT32: case FFI_TYPE_SINT32: - *args = (void*) ((char*)(raw++) + SIZEOF_ARG - 4); + *args = (void*) ((char*)(raw++) + FFI_SIZEOF_ARG - 4); break; #endif @@ -95,7 +95,7 @@ ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args) default: *args = raw; - raw += ALIGN ((*tp)->size, SIZEOF_ARG) / SIZEOF_ARG; + raw += ALIGN ((*tp)->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; } } @@ -152,7 +152,7 @@ ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw) (raw++)->sint = *(SINT16*) (*args); break; -#if SIZEOF_ARG >= 4 +#if FFI_SIZEOF_ARG >= 4 case FFI_TYPE_UINT32: (raw++)->uint = *(UINT32*) (*args); break; @@ -174,7 +174,7 @@ ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw) default: memcpy ((void*) raw->data, (void*)*args, (*tp)->size); - raw += ALIGN ((*tp)->size, SIZEOF_ARG) / SIZEOF_ARG; + raw += ALIGN ((*tp)->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; } } } diff --git a/libffi/src/s390/sysv.S b/libffi/src/s390/sysv.S index ac14fa751af..e9cbed977a9 100644 --- a/libffi/src/s390/sysv.S +++ b/libffi/src/s390/sysv.S @@ -24,6 +24,7 @@ ----------------------------------------------------------------------- */ #define LIBFFI_ASM +#include <fficonfig.h> #include <ffi.h> #ifndef __s390x__ diff --git a/libffi/src/sh/sysv.S b/libffi/src/sh/sysv.S index ab98a8af433..a7121c5425b 100644 --- a/libffi/src/sh/sysv.S +++ b/libffi/src/sh/sysv.S @@ -24,6 +24,7 @@ ----------------------------------------------------------------------- */ #define LIBFFI_ASM +#include <fficonfig.h> #include <ffi.h> #ifdef HAVE_MACHINE_ASM_H #include <machine/asm.h> diff --git a/libffi/src/sh64/sysv.S b/libffi/src/sh64/sysv.S index e478ced57fe..949f69f9884 100644 --- a/libffi/src/sh64/sysv.S +++ b/libffi/src/sh64/sysv.S @@ -24,6 +24,7 @@ ----------------------------------------------------------------------- */ #define LIBFFI_ASM +#include <fficonfig.h> #include <ffi.h> #ifdef HAVE_MACHINE_ASM_H #include <machine/asm.h> diff --git a/libffi/src/sparc/ffi.c b/libffi/src/sparc/ffi.c index 3c71771f745..a08e65ac571 100644 --- a/libffi/src/sparc/ffi.c +++ b/libffi/src/sparc/ffi.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 1996, 2003 Cygnus Solutions + ffi.c - Copyright (c) 1996, 2003 Red Hat, Inc. Sparc Foreign Function Interface @@ -491,7 +491,7 @@ ffi_closure_sparc_inner(ffi_closure *closure, while (i < avn) { /* Assume big-endian. FIXME */ - argn += ALIGN(arg_types[i]->size, SIZEOF_ARG) / SIZEOF_ARG; + argn += ALIGN(arg_types[i]->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; #ifdef SPARC64 if (i < 16 && (arg_types[i]->type == FFI_TYPE_FLOAT diff --git a/libffi/src/sparc/v8.S b/libffi/src/sparc/v8.S index e9db51b0456..880aae1f69e 100644 --- a/libffi/src/sparc/v8.S +++ b/libffi/src/sparc/v8.S @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - v8.S - Copyright (c) 1996, 1997, 2003 Cygnus Solutions + v8.S - Copyright (c) 1996, 1997, 2003 Red Hat, Inc. Sparc Foreign Function Interface @@ -24,6 +24,7 @@ ----------------------------------------------------------------------- */ #define LIBFFI_ASM +#include <fficonfig.h> #include <ffi.h> #define STACKFRAME 96 /* Minimum stack framesize for SPARC */ diff --git a/libffi/src/sparc/v9.S b/libffi/src/sparc/v9.S index 20ce0f4b57f..03b487bb54d 100644 --- a/libffi/src/sparc/v9.S +++ b/libffi/src/sparc/v9.S @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - v9.S - Copyright (c) 2000, 2003 Cygnus Solutions + v9.S - Copyright (c) 2000, 2003 Red Hat, Inc. Sparc 64bit Foreign Function Interface @@ -24,6 +24,7 @@ ----------------------------------------------------------------------- */ #define LIBFFI_ASM +#include <fficonfig.h> #include <ffi.h> #ifdef SPARC64 diff --git a/libffi/src/types.c b/libffi/src/types.c index eec282d4b69..df32190d115 100644 --- a/libffi/src/types.c +++ b/libffi/src/types.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - types.c - Copyright (c) 1996, 1998 Cygnus Solutions + types.c - Copyright (c) 1996, 1998 Red Hat, Inc. Predefined ffi_types needed by libffi. diff --git a/libffi/src/x86/ffi64.c b/libffi/src/x86/ffi64.c index 9427a37c8b5..905ed6f1b87 100644 --- a/libffi/src/x86/ffi64.c +++ b/libffi/src/x86/ffi64.c @@ -689,7 +689,7 @@ ffi_closure_UNIX64_inner(ffi_closure *closure, va_list l, void *rp) FFI_ASSERT(0); } - argn += ALIGN(arg_types[i]->size, SIZEOF_ARG) / SIZEOF_ARG; + argn += ALIGN(arg_types[i]->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; i++; } diff --git a/libffi/src/x86/sysv.S b/libffi/src/x86/sysv.S index 8ce2d87ba38..53a4c2b7e98 100644 --- a/libffi/src/x86/sysv.S +++ b/libffi/src/x86/sysv.S @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - sysv.S - Copyright (c) 1996, 1998, 2001, 2002, 2003 Cygnus Solutions + sysv.S - Copyright (c) 1996, 1998, 2001, 2002, 2003 Red Hat, Inc. X86 Foreign Function Interface @@ -26,6 +26,7 @@ #ifndef __x86_64__ #define LIBFFI_ASM +#include <fficonfig.h> #include <ffi.h> .text diff --git a/libffi/src/x86/unix64.S b/libffi/src/x86/unix64.S index e39d60415b6..310fed71843 100644 --- a/libffi/src/x86/unix64.S +++ b/libffi/src/x86/unix64.S @@ -25,6 +25,7 @@ #ifdef __x86_64__ #define LIBFFI_ASM +#include <fficonfig.h> #include <ffi.h> .section .rodata diff --git a/libffi/src/x86/win32.S b/libffi/src/x86/win32.S index 796af18754b..40743af5893 100644 --- a/libffi/src/x86/win32.S +++ b/libffi/src/x86/win32.S @@ -27,6 +27,7 @@ ----------------------------------------------------------------------- */ #define LIBFFI_ASM +#include <fficonfig.h> #include <ffi.h> .text |