Commit 1450eb7a by Andreas Tobler

[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
parent 6b5a2662
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
2003-10-20 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE> 2003-10-20 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* src/mips/ffi.c: Use _ABIN32, _ABIO32 instead of external * src/mips/ffi.c: Use _ABIN32, _ABIO32 instead of external
......
libffi - Copyright (c) 1996-1999 Cygnus Solutions libffi - Copyright (c) 1996-2003 Red Hat, Inc.
Permission is hereby granted, free of charge, to any person obtaining Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the a copy of this software and associated documentation files (the
......
...@@ -4,24 +4,26 @@ AUTOMAKE_OPTIONS = cygnus ...@@ -4,24 +4,26 @@ AUTOMAKE_OPTIONS = cygnus
SUBDIRS = include testsuite SUBDIRS = include testsuite
EXTRA_DIST = LICENSE ChangeLog.v1 \
src/alpha/ffi.c src/alpha/osf.S src/alpha/ffitarget.h \
src/arm/ffi.c src/arm/sysv.S src/arm/ffitarget.h \
src/mips/ffi.c src/mips/n32.S src/mips/o32.S \
src/mips/ffitarget.h \
src/m68k/ffi.c src/m68k/sysv.S src/m68k/ffitarget.h \
src/powerpc/ffi.c src/powerpc/sysv.S \
src/powerpc/linux64.S src/powerpc/linux64_closure.S \
src/powerpc/ppc_closure.S src/powerpc/asm.h \
src/powerpc/aix.S src/powerpc/darwin.S \
src/powerpc/aix_closure.S src/powerpc/darwin_closure.S \
src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h \
src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h \
src/sh/ffi.c src/sh/sysv.S src/sh/ffitarget.h \
src/sh64/ffi.c src/sh64/sysv.S src/sh64/ffitarget.h \
src/sparc/v8.S src/sparc/v9.S src/sparc/ffitarget.h \
src/sparc/ffi.c \
src/x86/ffi.c src/x86/sysv.S src/x86/win32.S \
src/x86/ffi64.c src/x86/unix64.S src/x86/ffitarget.h
EXTRA_DIST = LICENSE ChangeLog.v1 src/mips/ffi.c src/mips/n32.S \
src/mips/n32.s src/mips/o32.S src/mips/o32.s \
src/sparc/ffi.c src/sparc/v8.S src/sparc/v9.S \
src/x86/ffi.c src/x86/sysv.S src/x86/win32.S \
src/x86/ffi64.c src/x86/unix64.S \
src/alpha/ffi.c src/alpha/osf.S \
src/m68k/ffi.c src/m68k/sysv.S \
src/powerpc/ffi.c src/powerpc/sysv.S \
src/powerpc/linux64.S src/powerpc/linux64_closure.S \
src/powerpc/ppc_closure.S src/powerpc/asm.h \
src/powerpc/ffi_darwin.c \
src/powerpc/darwin.S src/powerpc/aix.S \
src/powerpc/darwin_closure.S src/powerpc/aix_closure.S \
src/arm/ffi.c src/arm/sysv.S \
src/s390/ffi.c src/s390/sysv.S \
src/sh/ffi.c src/sh/sysv.S \
src/sh64/ffi.c src/sh64/sysv.S
VPATH = @srcdir@:@srcdir@/src:@srcdir@/src/@TARGETDIR@ VPATH = @srcdir@:@srcdir@/src:@srcdir@/src/@TARGETDIR@
...@@ -85,9 +87,8 @@ noinst_LTLIBRARIES = libffi_convenience.la ...@@ -85,9 +87,8 @@ noinst_LTLIBRARIES = libffi_convenience.la
TARGET_SRC_MIPS_GCC = src/mips/ffi.c src/mips/o32.S src/mips/n32.S TARGET_SRC_MIPS_IRIX = src/mips/ffi.c src/mips/o32.S src/mips/n32.S
TARGET_SRC_MIPS_LINUX = src/mips/ffi.c src/mips/o32.S TARGET_SRC_MIPS_LINUX = src/mips/ffi.c src/mips/o32.S
TARGET_SRC_MIPS_SGI = src/mips/ffi.c src/mips/o32.s src/mips/n32.s
TARGET_SRC_X86 = src/x86/ffi.c src/x86/sysv.S TARGET_SRC_X86 = src/x86/ffi.c src/x86/sysv.S
TARGET_SRC_X86_WIN32 = src/x86/ffi.c src/x86/win32.S TARGET_SRC_X86_WIN32 = src/x86/ffi.c src/x86/win32.S
TARGET_SRC_SPARC = src/sparc/ffi.c src/sparc/v8.S src/sparc/v9.S TARGET_SRC_SPARC = src/sparc/ffi.c src/sparc/v8.S src/sparc/v9.S
...@@ -107,18 +108,14 @@ TARGET_SRC_SH64 = src/sh64/sysv.S src/sh64/ffi.c ...@@ -107,18 +108,14 @@ TARGET_SRC_SH64 = src/sh64/sysv.S src/sh64/ffi.c
## Work around automake deficiency ## Work around automake deficiency
libffi_la_common_SOURCES = src/debug.c src/prep_cif.c src/types.c \ libffi_la_common_SOURCES = src/debug.c src/prep_cif.c src/types.c \
src/raw_api.c src/java_raw_api.c src/raw_api.c src/java_raw_api.c
if MIPS_GCC if MIPS_IRIX
libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_GCC) libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_IRIX)
libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_GCC) libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_IRIX)
endif endif
if MIPS_LINUX if MIPS_LINUX
libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_LINUX) libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_LINUX)
libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_LINUX) libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_LINUX)
endif endif
if MIPS_SGI
libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_SGI)
libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_SGI)
endif
if X86 if X86
libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_X86) libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_X86)
libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_X86) libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_X86)
...@@ -180,7 +177,7 @@ AM_CFLAGS = -Wall -g -fexceptions ...@@ -180,7 +177,7 @@ AM_CFLAGS = -Wall -g -fexceptions
libffi_la_LDFLAGS = -release $(VERSION) libffi_la_LDFLAGS = -release $(VERSION)
INCLUDES = -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src INCLUDES = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src
# Override these rules so that object files get put in the correct # Override these rules so that object files get put in the correct
# subdirectories. # subdirectories.
...@@ -229,7 +226,15 @@ maintainer-clean-multi: ...@@ -229,7 +226,15 @@ maintainer-clean-multi:
## ################################################################ ## ################################################################
CLEANFILES = $(libffi_convenience_la_OBJECTS) \ # Our hacked automake doesn't clean subdirectories properly.
$(libffi_la_OBJECTS) \ mostlyclean-am: mostlyclean-sub
$(libffi_convenience_la_OBJECTS:.lo=.o) \ mostlyclean-sub:
$(libffi_la_OBJECTS:.lo=.o) -rm -f src/*.o src/*.lo
-rm -f src/@TARGETDIR@/*.o src/@TARGETDIR@/*.lo
clean-am: clean-sub
clean-sub:
-rm -rf src/.libs src/_libs
-rm -rf src/@TARGETDIR@/.libs src/@TARGETDIR@/_libs
...@@ -52,7 +52,6 @@ AM_CONDITIONAL(TESTSUBDIR, test -d $srcdir/testsuite) ...@@ -52,7 +52,6 @@ AM_CONDITIONAL(TESTSUBDIR, test -d $srcdir/testsuite)
TARGETDIR="unknown" TARGETDIR="unknown"
case "$host" in case "$host" in
mips-sgi-irix5.* | mips-sgi-irix6.*) TARGET=MIPS; TARGETDIR=mips;;
i*86-*-linux*) TARGET=X86; TARGETDIR=x86;; i*86-*-linux*) TARGET=X86; TARGETDIR=x86;;
i*86-*-solaris*) TARGET=X86; TARGETDIR=x86;; i*86-*-solaris*) TARGET=X86; TARGETDIR=x86;;
i*86-*-beos*) TARGET=X86; TARGETDIR=x86;; i*86-*-beos*) TARGET=X86; TARGETDIR=x86;;
...@@ -69,6 +68,7 @@ alpha*-*-linux* | alpha*-*-osf* | alpha*-*-freebsd* | alpha*-*-netbsd*) TARGET=A ...@@ -69,6 +68,7 @@ alpha*-*-linux* | alpha*-*-osf* | alpha*-*-freebsd* | alpha*-*-netbsd*) TARGET=A
ia64*-*-*) TARGET=IA64; TARGETDIR=ia64;; ia64*-*-*) TARGET=IA64; TARGETDIR=ia64;;
m68k-*-linux*) TARGET=M68K; TARGETDIR=m68k;; m68k-*-linux*) TARGET=M68K; TARGETDIR=m68k;;
mips64*-*);; mips64*-*);;
mips-sgi-irix5.* | mips-sgi-irix6.*) TARGET=MIPS_IRIX; TARGETDIR=mips;;
mips*-*-linux*) TARGET=MIPS_LINUX; TARGETDIR=mips;; mips*-*-linux*) TARGET=MIPS_LINUX; TARGETDIR=mips;;
powerpc*-*-linux* | powerpc-*-sysv*) TARGET=POWERPC; TARGETDIR=powerpc;; powerpc*-*-linux* | powerpc-*-sysv*) TARGET=POWERPC; TARGETDIR=powerpc;;
powerpc-*-beos*) TARGET=POWERPC; TARGETDIR=powerpc;; powerpc-*-beos*) TARGET=POWERPC; TARGETDIR=powerpc;;
...@@ -90,8 +90,7 @@ if test $TARGETDIR = unknown; then ...@@ -90,8 +90,7 @@ if test $TARGETDIR = unknown; then
AC_ERROR("libffi has not been ported to $host.") AC_ERROR("libffi has not been ported to $host.")
fi fi
AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes) AM_CONDITIONAL(MIPS_IRIX, test x$TARGET = xMIPS_IRIX)
AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
AM_CONDITIONAL(MIPS_LINUX, test x$TARGET = xMIPS_LINUX) AM_CONDITIONAL(MIPS_LINUX, test x$TARGET = xMIPS_LINUX)
AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC) AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
AM_CONDITIONAL(X86, test x$TARGET = xX86) AM_CONDITIONAL(X86, test x$TARGET = xX86)
...@@ -108,24 +107,28 @@ AM_CONDITIONAL(X86_64, test x$TARGET = xX86_64) ...@@ -108,24 +107,28 @@ AM_CONDITIONAL(X86_64, test x$TARGET = xX86_64)
AM_CONDITIONAL(SH, test x$TARGET = xSH) AM_CONDITIONAL(SH, test x$TARGET = xSH)
AM_CONDITIONAL(SH64, test x$TARGET = xSH64) AM_CONDITIONAL(SH64, test x$TARGET = xSH64)
if test x$TARGET = xMIPS_LINUX; then case x$TARGET in
TARGET=MIPS xMIPS*) TARGET=MIPS ;;
fi *) ;;
esac
AC_HEADER_STDC AC_HEADER_STDC
AC_CHECK_FUNCS(memcpy) AC_CHECK_FUNCS(memcpy)
AC_FUNC_ALLOCA AC_FUNC_ALLOCA
dnl AC_CHECK_SIZEOF(char)
AC_COMPILE_CHECK_SIZEOF(short)
AC_COMPILE_CHECK_SIZEOF(int)
AC_COMPILE_CHECK_SIZEOF(long)
AC_COMPILE_CHECK_SIZEOF(long long)
AC_COMPILE_CHECK_SIZEOF(float)
AC_COMPILE_CHECK_SIZEOF(double) AC_COMPILE_CHECK_SIZEOF(double)
AC_COMPILE_CHECK_SIZEOF(long double) AC_COMPILE_CHECK_SIZEOF(long double)
AC_COMPILE_CHECK_SIZEOF(void *) # Also AC_SUBST this variable for ffi.h.
HAVE_LONG_DOUBLE=0
if test $ac_cv_sizeof_double != $ac_cv_sizeof_long_double; then
if test $ac_cv_sizeof_long_double != 0; then
HAVE_LONG_DOUBLE=1
AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the long double type and it is bigger than a double])
fi
fi
AC_SUBST(HAVE_LONG_DOUBLE)
AC_C_BIGENDIAN_CROSS AC_C_BIGENDIAN_CROSS
if test x$TARGET = xSPARC; then if test x$TARGET = xSPARC; then
...@@ -176,6 +179,11 @@ AC_CACHE_CHECK([whether .eh_frame section should be read-only], ...@@ -176,6 +179,11 @@ AC_CACHE_CHECK([whether .eh_frame section should be read-only],
if test "x$libffi_cv_ro_eh_frame" = xyes; then if test "x$libffi_cv_ro_eh_frame" = xyes; then
AC_DEFINE(HAVE_RO_EH_FRAME, 1, AC_DEFINE(HAVE_RO_EH_FRAME, 1,
[Define if .eh_frame sections should be read-only.]) [Define if .eh_frame sections should be read-only.])
AC_DEFINE(EH_FRAME_FLAGS, "a",
[Define to the flags needed for the .section .eh_frame directive.])
else
AC_DEFINE(EH_FRAME_FLAGS, "aw",
[Define to the flags needed for the .section .eh_frame directive.])
fi fi
AC_SUBST(TARGET) AC_SUBST(TARGET)
...@@ -186,25 +194,25 @@ AC_SUBST(SHELL) ...@@ -186,25 +194,25 @@ AC_SUBST(SHELL)
AC_ARG_ENABLE(debug, AC_ARG_ENABLE(debug,
[ --enable-debug debugging mode], [ --enable-debug debugging mode],
if test "$enable_debug" = "yes"; then if test "$enable_debug" = "yes"; then
AC_DEFINE(FFI_DEBUG) AC_DEFINE(FFI_DEBUG, 1, [Define this if you want extra debugging.])
fi) fi)
AC_ARG_ENABLE(structs, AC_ARG_ENABLE(structs,
[ --disable-structs omit code for struct support], [ --disable-structs omit code for struct support],
if test "$enable_structs" = "no"; then if test "$enable_structs" = "no"; then
AC_DEFINE(FFI_NO_STRUCTS) AC_DEFINE(FFI_NO_STRUCTS, 1, [Define this is you do not want support for aggregate types.])
fi) fi)
AC_ARG_ENABLE(raw-api, AC_ARG_ENABLE(raw-api,
[ --disable-raw-api make the raw api unavailable], [ --disable-raw-api make the raw api unavailable],
if test "$enable_raw_api" = "no"; then if test "$enable_raw_api" = "no"; then
AC_DEFINE(FFI_NO_RAW_API) AC_DEFINE(FFI_NO_RAW_API, 1, [Define this is you do not want support for the raw API.])
fi) fi)
AC_ARG_ENABLE(purify-safety, AC_ARG_ENABLE(purify-safety,
[ --enable-purify-safety purify-safe mode], [ --enable-purify-safety purify-safe mode],
if test "$enable_purify_safety" = "yes"; then if test "$enable_purify_safety" = "yes"; then
AC_DEFINE(USING_PURIFY) AC_DEFINE(USING_PURIFY, 1, [Define this if you are using Purify and want to suppress spurious messages.])
fi) fi)
if test -n "$with_cross_host" && if test -n "$with_cross_host" &&
...@@ -246,16 +254,11 @@ libffi_basedir=${libffi_basedir} ...@@ -246,16 +254,11 @@ libffi_basedir=${libffi_basedir}
CC="${CC}" CC="${CC}"
DEFS="$DEFS" DEFS="$DEFS"
ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}" ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"
test ! -d include && mkdir include
test ! -f include/fficonfig.h && cp fficonfig.h include/fficonfig.h
if cmp -s fficonfig.h include/fficonfig.h 2>/dev/null; then
echo fficonfig.h unchanged
else
echo Moving fficonfig.h to include/fficonfig.h
cp fficonfig.h include/fficonfig.h
fi
)
# Make target subdirectories if required. # Make target subdirectories if required.
test -d src || mkdir src test -d src || mkdir src
test -d src/${TARGETDIR} || mkdir src/${TARGETDIR} test -d src/${TARGETDIR} || mkdir src/${TARGETDIR}
test -d include || mkdir include
AC_LINK_FILES(src/$TARGETDIR/ffitarget.h, include/ffitarget.h)
)
...@@ -25,49 +25,25 @@ ...@@ -25,49 +25,25 @@
/* Define if you have the ANSI C header files. */ /* Define if you have the ANSI C header files. */
#undef STDC_HEADERS #undef STDC_HEADERS
/* Define this if you want extra debugging */
#undef FFI_DEBUG
/* Define this if you are using Purify and want to suppress
spurious messages. */
#undef USING_PURIFY
/* Define this is you do not want support for aggregate types. */
#undef FFI_NO_STRUCTS
/* Define this is you do not want support for the raw API. */
#undef FFI_NO_RAW_API
/* Define if you have the memcpy function. */ /* Define if you have the memcpy function. */
#undef HAVE_MEMCPY #undef HAVE_MEMCPY
/* The number of bytes in type short */
#undef SIZEOF_SHORT
/* The number of bytes in type int */
#undef SIZEOF_INT
/* The number of bytes in type long */
#undef SIZEOF_LONG
/* The number of bytes in type long long */
#undef SIZEOF_LONG_LONG
/* The number of bytes in type float */
#undef SIZEOF_FLOAT
/* The number of bytes in type double */ /* The number of bytes in type double */
#undef SIZEOF_DOUBLE #undef SIZEOF_DOUBLE
/* The number of bytes in type long double */ /* The number of bytes in type long double */
#undef SIZEOF_LONG_DOUBLE #undef SIZEOF_LONG_DOUBLE
/* The number of bytes in type void * */ /* Define if you have the long double type and it is bigger than a double */
#undef SIZEOF_VOID_P #undef HAVE_LONG_DOUBLE
/* whether byteorder is bigendian */ /* whether byteorder is bigendian */
#undef WORDS_BIGENDIAN #undef WORDS_BIGENDIAN
/* Define if the host machine stores words of multi-word integers in
big-endian order. */
#undef HOST_WORDS_BIG_ENDIAN
/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ /* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */
#undef BYTEORDER #undef BYTEORDER
...@@ -79,3 +55,22 @@ ...@@ -79,3 +55,22 @@
/* Define if .eh_frame sections should be read-only. */ /* Define if .eh_frame sections should be read-only. */
#undef HAVE_RO_EH_FRAME #undef HAVE_RO_EH_FRAME
/* Define to the flags needed for the .section .eh_frame directive. */
#undef EH_FRAME_FLAGS
/* Define to the flags needed for the .section .eh_frame directive. */
#undef EH_FRAME_FLAGS
/* Define this if you want extra debugging. */
#undef FFI_DEBUG
/* Define this is you do not want support for aggregate types. */
#undef FFI_NO_STRUCTS
/* Define this is you do not want support for the raw API. */
#undef FFI_NO_RAW_API
/* Define this if you are using Purify and want to suppress spurious messages. */
#undef USING_PURIFY
## Process this with automake to create Makefile.in ## Process this with automake to create Makefile.in
AUTOMAKE_OPTIONS = foreign AUTOMAKE_OPTIONS=foreign
EXTRA_DIST = ffi.h.in ffi_common.h ffi_mips.h DISTCLEANFILES=ffitarget.h
EXTRA_DIST=ffi.h.in ffi_common.h
hackdir=$(includedir) hackdir=$(includedir)
hack_DATA=fficonfig.h ffi.h ffi_mips.h hack_DATA=ffitarget.h ffi.h
\ No newline at end of file
...@@ -72,6 +72,7 @@ DLLTOOL = @DLLTOOL@ ...@@ -72,6 +72,7 @@ DLLTOOL = @DLLTOOL@
EXEEXT = @EXEEXT@ EXEEXT = @EXEEXT@
GCJ = @GCJ@ GCJ = @GCJ@
GCJFLAGS = @GCJFLAGS@ GCJFLAGS = @GCJFLAGS@
HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@
LIBTOOL = @LIBTOOL@ LIBTOOL = @LIBTOOL@
LN_S = @LN_S@ LN_S = @LN_S@
MAINT = @MAINT@ MAINT = @MAINT@
...@@ -91,11 +92,12 @@ toolexeclibdir = @toolexeclibdir@ ...@@ -91,11 +92,12 @@ toolexeclibdir = @toolexeclibdir@
AUTOMAKE_OPTIONS = foreign AUTOMAKE_OPTIONS = foreign
EXTRA_DIST = ffi.h.in ffi_common.h ffi_mips.h DISTCLEANFILES = ffitarget.h
EXTRA_DIST = ffi.h.in ffi_common.h
hackdir = $(includedir) hackdir = $(includedir)
hack_DATA = fficonfig.h ffi.h ffi_mips.h hack_DATA = ffitarget.h ffi.h
mkinstalldirs = $(SHELL) $(top_srcdir)/${libffi_basedir}../mkinstalldirs mkinstalldirs = $(SHELL) $(top_srcdir)/${libffi_basedir}../mkinstalldirs
CONFIG_HEADER = ../fficonfig.h CONFIG_HEADER = ../fficonfig.h
CONFIG_CLEAN_FILES = ffi.h CONFIG_CLEAN_FILES = ffi.h
...@@ -196,6 +198,7 @@ clean-generic: ...@@ -196,6 +198,7 @@ clean-generic:
distclean-generic: distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES) -rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]* -rm -f config.cache config.log stamp-h stamp-h[0-9]*
-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
maintainer-clean-generic: maintainer-clean-generic:
mostlyclean-am: mostlyclean-generic mostlyclean-am: mostlyclean-generic
......
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
ffi_common.h - Copyright (c) 1996 Cygnus Solutions ffi_common.h - Copyright (c) 1996 Red Hat, Inc.
$Id: ffi_common.h,v 1.1.1.1 1998/11/29 16:48:16 green Exp $
Common internal definitions and macros. Only necessary for building Common internal definitions and macros. Only necessary for building
libffi. libffi.
...@@ -14,6 +12,8 @@ ...@@ -14,6 +12,8 @@
extern "C" { extern "C" {
#endif #endif
#include <fficonfig.h>
/* Do not move this. Some versions of AIX are very picky about where /* Do not move this. Some versions of AIX are very picky about where
this is positioned. */ this is positioned. */
#ifdef __GNUC__ #ifdef __GNUC__
...@@ -41,36 +41,26 @@ char *alloca (); ...@@ -41,36 +41,26 @@ char *alloca ();
# endif # endif
#endif #endif
#ifndef FALSE #if defined(FFI_DEBUG)
#define FALSE 0 #include <stdio.h>
#endif
#ifndef TRUE
#define TRUE (!FALSE)
#endif
#ifndef __cplusplus
/* bool is a keyword in C++ */
/*@-cppnames@*/
typedef int bool;
/*@=cppnames@*/
#endif #endif
#ifdef FFI_DEBUG #ifdef FFI_DEBUG
/*@exits@*/ void ffi_assert(/*@temp@*/ char *expr, /*@temp@*/ char *file, int line);
/* Debugging functions */
/*@exits@*/ int ffi_assert(/*@temp@*/ char *file, int line);
void ffi_stop_here(void); void ffi_stop_here(void);
bool ffi_type_test(/*@temp@*/ /*@out@*/ ffi_type *a); void ffi_type_test(/*@temp@*/ /*@out@*/ ffi_type *a, /*@temp@*/ char *file, int line);
#define FFI_ASSERT(x) ((x) ? 0 : ffi_assert(__FILE__,__LINE__))
#define FFI_ASSERT(x) ((x) ? (void)0 : ffi_assert(#x, __FILE__,__LINE__))
#define FFI_ASSERT_AT(x, f, l) ((x) ? 0 : ffi_assert(#x, (f), (l)))
#define FFI_ASSERT_VALID_TYPE(x) ffi_type_test (x, __FILE__, __LINE__)
#else #else
#define FFI_ASSERT(x) #define FFI_ASSERT(x)
#define FFI_ASSERT_AT(x, f, l)
#define FFI_ASSERT_VALID_TYPE(x)
#endif #endif
#define ALIGN(v, a) (((((size_t) (v))-1) | ((a)-1))+1)
/* Perform machine dependent cif processing */ /* Perform machine dependent cif processing */
ffi_status ffi_prep_cif_machdep(ffi_cif *cif); ffi_status ffi_prep_cif_machdep(ffi_cif *cif);
...@@ -82,6 +72,19 @@ typedef struct ...@@ -82,6 +72,19 @@ typedef struct
/*@dependent@*/ void **avalue; /*@dependent@*/ void **avalue;
} extended_cif; } extended_cif;
/* Terse sized type definitions. */
typedef unsigned int UINT8 __attribute__((__mode__(__QI__)));
typedef signed int SINT8 __attribute__((__mode__(__QI__)));
typedef unsigned int UINT16 __attribute__((__mode__(__HI__)));
typedef signed int SINT16 __attribute__((__mode__(__HI__)));
typedef unsigned int UINT32 __attribute__((__mode__(__SI__)));
typedef signed int SINT32 __attribute__((__mode__(__SI__)));
typedef unsigned int UINT64 __attribute__((__mode__(__DI__)));
typedef signed int SINT64 __attribute__((__mode__(__DI__)));
typedef float FLOAT32;
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
ffi.c - Copyright (c) 1998, 2001 Cygnus Solutions ffi.c - Copyright (c) 1998, 2001 Red Hat, Inc.
Alpha Foreign Function Interface Alpha Foreign Function Interface
...@@ -37,8 +37,8 @@ ffi_prep_cif_machdep(ffi_cif *cif) ...@@ -37,8 +37,8 @@ ffi_prep_cif_machdep(ffi_cif *cif)
{ {
/* Adjust cif->bytes to represent a minimum 6 words for the temporary /* Adjust cif->bytes to represent a minimum 6 words for the temporary
register argument loading area. */ register argument loading area. */
if (cif->bytes < 6*SIZEOF_ARG) if (cif->bytes < 6*FFI_SIZEOF_ARG)
cif->bytes = 6*SIZEOF_ARG; cif->bytes = 6*FFI_SIZEOF_ARG;
/* Set the return type flag */ /* Set the return type flag */
switch (cif->rtype->type) switch (cif->rtype->type)
...@@ -73,7 +73,7 @@ ffi_call(ffi_cif *cif, void (*fn)(), void *rvalue, void **avalue) ...@@ -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 /* Allocate the space for the arguments, plus 4 words of temp
space for ffi_call_osf. */ 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) if (cif->flags == FFI_TYPE_STRUCT)
*(void **) argp++ = rvalue; *(void **) argp++ = rvalue;
...@@ -137,7 +137,7 @@ ffi_call(ffi_cif *cif, void (*fn)(), void *rvalue, void **avalue) ...@@ -137,7 +137,7 @@ ffi_call(ffi_cif *cif, void (*fn)(), void *rvalue, void **avalue)
FFI_ASSERT(0); 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++; i++, arg_types++, avalue++;
} }
...@@ -240,7 +240,7 @@ ffi_closure_osf_inner(ffi_closure *closure, void *rvalue, unsigned long *argp) ...@@ -240,7 +240,7 @@ ffi_closure_osf_inner(ffi_closure *closure, void *rvalue, unsigned long *argp)
FFI_ASSERT(0); 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++; i++;
} }
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
----------------------------------------------------------------------- */ ----------------------------------------------------------------------- */
#define LIBFFI_ASM #define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h> #include <ffi.h>
.arch ev6 .arch ev6
......
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
ffi.c - Copyright (c) 1998 Cygnus Solutions ffi.c - Copyright (c) 1998 Red Hat, Inc.
ARM Foreign Function Interface ARM Foreign Function Interface
......
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
sysv.S - Copyright (c) 1998 Cygnus Solutions sysv.S - Copyright (c) 1998 Red Hat, Inc.
ARM Foreign Function Interface ARM Foreign Function Interface
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
----------------------------------------------------------------------- */ ----------------------------------------------------------------------- */
#define LIBFFI_ASM #define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h> #include <ffi.h>
#ifdef HAVE_MACHINE_ASM_H #ifdef HAVE_MACHINE_ASM_H
#include <machine/asm.h> #include <machine/asm.h>
......
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
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 Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the a copy of this software and associated documentation files (the
...@@ -37,29 +37,23 @@ void ffi_stop_here(void) ...@@ -37,29 +37,23 @@ void ffi_stop_here(void)
/* This function should only be called via the FFI_ASSERT() macro */ /* 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(); ffi_stop_here();
abort(); abort();
/* This has to return something for the compiler not to complain */
/*@notreached@*/
return 0;
} }
/* Perform a sanity check on an ffi_type structure */ /* 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@*/ /*@-usedef@*/
FFI_ASSERT(a->type <= FFI_TYPE_LAST); FFI_ASSERT_AT(a->type <= FFI_TYPE_LAST, file, line);
FFI_ASSERT(a->type > FFI_TYPE_VOID ? a->size > 0 : 1); FFI_ASSERT_AT(a->type == FFI_TYPE_VOID || a->size > 0, file, line);
FFI_ASSERT(a->type > FFI_TYPE_VOID ? a->alignment > 0 : 1); FFI_ASSERT_AT(a->type == FFI_TYPE_VOID || a->alignment > 0, file, line);
FFI_ASSERT(a->type == FFI_TYPE_STRUCT ? a->elements != NULL : 1); FFI_ASSERT_AT(a->type != FFI_TYPE_STRUCT || a->elements != NULL, file, line);
/*@=usedef@*/ /*@=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);
} }
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
ffi.c - Copyright (c) 1998 Cygnus Solutions ffi.c - Copyright (c) 1998 Red Hat, Inc.
Copyright (c) 2000 Hewlett Packard Company Copyright (c) 2000 Hewlett Packard Company
IA64 Foreign Function Interface IA64 Foreign Function Interface
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <ffi_common.h> #include <ffi_common.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h>
#include "ia64_flags.h" #include "ia64_flags.h"
...@@ -210,7 +211,7 @@ ffi_prep_args(struct ia64_args *stack, extended_cif *ecif, int bytes) ...@@ -210,7 +211,7 @@ ffi_prep_args(struct ia64_args *stack, extended_cif *ecif, int bytes)
{ {
size_t sz = (*p_arg)->size; size_t sz = (*p_arg)->size;
unsigned short element_type; 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)) { if (is_homogeneous_fp_aggregate(*p_arg, 8, &element_type)) {
int i; int i;
int nelements = sz/float_type_size(element_type); int nelements = sz/float_type_size(element_type);
...@@ -596,7 +597,7 @@ ffi_prep_incoming_args_UNIX(struct ia64_args *args, void **rvalue, ...@@ -596,7 +597,7 @@ ffi_prep_incoming_args_UNIX(struct ia64_args *args, void **rvalue,
{ {
size_t sz = (*p_arg)->size; size_t sz = (*p_arg)->size;
unsigned short element_type; 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)) { if (is_homogeneous_fp_aggregate(*p_arg, 8, &element_type)) {
int nelements = sz/float_type_size(element_type); int nelements = sz/float_type_size(element_type);
if (nelements + fp_reg_num >= 8) { if (nelements + fp_reg_num >= 8) {
......
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
unix.S - Copyright (c) 1998 Cygnus Solutions unix.S - Copyright (c) 1998 Red Hat, Inc.
Copyright (c) 2000 Hewlett Packard Company Copyright (c) 2000 Hewlett Packard Company
IA64/unix Foreign Function Interface IA64/unix Foreign Function Interface
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
----------------------------------------------------------------------- */ ----------------------------------------------------------------------- */
#define LIBFFI_ASM #define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h> #include <ffi.h>
#include "ia64_flags.h" #include "ia64_flags.h"
......
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
java_raw_api.c - Copyright (c) 1999 Cygnus Solutions java_raw_api.c - Copyright (c) 1999 Red Hat, Inc.
Cloned from raw_api.c Cloned from raw_api.c
...@@ -54,13 +54,13 @@ ffi_java_raw_size (ffi_cif *cif) ...@@ -54,13 +54,13 @@ ffi_java_raw_size (ffi_cif *cif)
case FFI_TYPE_UINT64: case FFI_TYPE_UINT64:
case FFI_TYPE_SINT64: case FFI_TYPE_SINT64:
case FFI_TYPE_DOUBLE: case FFI_TYPE_DOUBLE:
result += 2 * SIZEOF_ARG; result += 2 * FFI_SIZEOF_ARG;
break; break;
case FFI_TYPE_STRUCT: case FFI_TYPE_STRUCT:
/* No structure parameters in Java. */ /* No structure parameters in Java. */
abort(); abort();
default: 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) ...@@ -90,7 +90,7 @@ ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args)
*args = (void*) ((char*)(raw++) + 2); *args = (void*) ((char*)(raw++) + 2);
break; break;
#if SIZEOF_ARG == 8 #if FFI_SIZEOF_ARG == 8
case FFI_TYPE_UINT64: case FFI_TYPE_UINT64:
case FFI_TYPE_SINT64: case FFI_TYPE_SINT64:
case FFI_TYPE_DOUBLE: case FFI_TYPE_DOUBLE:
...@@ -105,7 +105,7 @@ ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args) ...@@ -105,7 +105,7 @@ ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args)
default: default:
*args = raw; *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) ...@@ -116,7 +116,7 @@ ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args)
/* then assume little endian */ /* then assume little endian */
for (i = 0; i < cif->nargs; i++, tp++, args++) for (i = 0; i < cif->nargs; i++, tp++, args++)
{ {
#if SIZEOF_ARG == 8 #if FFI_SIZEOF_ARG == 8
switch((*tp)->type) { switch((*tp)->type) {
case FFI_TYPE_UINT64: case FFI_TYPE_UINT64:
case FFI_TYPE_SINT64: case FFI_TYPE_SINT64:
...@@ -127,10 +127,10 @@ ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args) ...@@ -127,10 +127,10 @@ ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args)
default: default:
*args = (void*) raw++; *args = (void*) raw++;
} }
#else /* SIZEOF_ARG != 8 */ #else /* FFI_SIZEOF_ARG != 8 */
*args = (void*) raw; *args = (void*) raw;
raw += ALIGN ((*tp)->size, sizeof (void*)) / sizeof (void*); raw += ALIGN ((*tp)->size, sizeof (void*)) / sizeof (void*);
#endif /* SIZEOF_ARG == 8 */ #endif /* FFI_SIZEOF_ARG == 8 */
} }
#else #else
...@@ -202,7 +202,7 @@ ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw) ...@@ -202,7 +202,7 @@ ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw)
(raw++)->flt = *(FLOAT32*) (*args); (raw++)->flt = *(FLOAT32*) (*args);
break; break;
#if SIZEOF_ARG == 8 #if FFI_SIZEOF_ARG == 8
case FFI_TYPE_UINT64: case FFI_TYPE_UINT64:
case FFI_TYPE_SINT64: case FFI_TYPE_SINT64:
case FFI_TYPE_DOUBLE: case FFI_TYPE_DOUBLE:
...@@ -216,11 +216,11 @@ ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw) ...@@ -216,11 +216,11 @@ ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw)
break; break;
default: default:
#if SIZEOF_ARG == 8 #if FFI_SIZEOF_ARG == 8
FFI_ASSERT(FALSE); /* Should have covered all cases */ FFI_ASSERT(FALSE); /* Should have covered all cases */
#else #else
memcpy ((void*) raw->data, (void*)*args, (*tp)->size); 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 #endif
} }
} }
...@@ -231,7 +231,7 @@ ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw) ...@@ -231,7 +231,7 @@ ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw)
static void static void
ffi_java_rvalue_to_raw (ffi_cif *cif, void *rvalue) 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) switch (cif->rtype->type)
{ {
case FFI_TYPE_UINT8: case FFI_TYPE_UINT8:
...@@ -256,7 +256,7 @@ ffi_java_rvalue_to_raw (ffi_cif *cif, void *rvalue) ...@@ -256,7 +256,7 @@ ffi_java_rvalue_to_raw (ffi_cif *cif, void *rvalue)
static void static void
ffi_java_raw_to_rvalue (ffi_cif *cif, void *rvalue) 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) switch (cif->rtype->type)
{ {
case FFI_TYPE_UINT8: case FFI_TYPE_UINT8:
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
----------------------------------------------------------------------- */ ----------------------------------------------------------------------- */
#define LIBFFI_ASM #define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h> #include <ffi.h>
.text .text
......
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
ffi.c - Copyright (c) 1996 Cygnus Solutions ffi.c - Copyright (c) 1996 Red Hat, Inc.
MIPS Foreign Function Interface MIPS Foreign Function Interface
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
OTHER DEALINGS IN THE SOFTWARE. OTHER DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------- */ ----------------------------------------------------------------------- */
#include <sgidefs.h>
#include <ffi.h> #include <ffi.h>
#include <ffi_common.h> #include <ffi_common.h>
...@@ -59,8 +58,8 @@ static void ffi_prep_args(char *stack, ...@@ -59,8 +58,8 @@ static void ffi_prep_args(char *stack,
/* If more than 8 double words are used, the remainder go /* If more than 8 double words are used, the remainder go
on the stack. We reorder stuff on the stack here to on the stack. We reorder stuff on the stack here to
support this easily. */ support this easily. */
if (bytes > 8 * SIZEOF_ARG) if (bytes > 8 * FFI_SIZEOF_ARG)
argp = &stack[bytes - (8 * SIZEOF_ARG)]; argp = &stack[bytes - (8 * FFI_SIZEOF_ARG)];
else else
argp = stack; argp = stack;
#else #else
...@@ -75,8 +74,8 @@ static void ffi_prep_args(char *stack, ...@@ -75,8 +74,8 @@ static void ffi_prep_args(char *stack,
if ( ecif->cif->rtype->type == FFI_TYPE_STRUCT ) if ( ecif->cif->rtype->type == FFI_TYPE_STRUCT )
#endif #endif
{ {
*(SLOT_TYPE_UNSIGNED *) argp = (SLOT_TYPE_UNSIGNED) ecif->rvalue; *(ffi_arg *) argp = (ffi_arg) ecif->rvalue;
argp += sizeof(SLOT_TYPE_UNSIGNED); argp += sizeof(ffi_arg);
FIX_ARGP; FIX_ARGP;
} }
...@@ -99,9 +98,9 @@ static void ffi_prep_args(char *stack, ...@@ -99,9 +98,9 @@ static void ffi_prep_args(char *stack,
#endif #endif
z = (*p_arg)->size; 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) switch ((*p_arg)->type)
{ {
......
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
n32.S - Copyright (c) 1996, 1998 Cygnus Solutions n32.S - Copyright (c) 1996, 1998 Red Hat, Inc.
MIPS Foreign Function Interface MIPS Foreign Function Interface
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
----------------------------------------------------------------------- */ ----------------------------------------------------------------------- */
#define LIBFFI_ASM #define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h> #include <ffi.h>
/* Only build this code if we are compiling for n32 */ /* Only build this code if we are compiling for n32 */
...@@ -36,7 +37,7 @@ ...@@ -36,7 +37,7 @@
#define raddr a4 #define raddr a4
#define fn a5 #define fn a5
#define SIZEOF_FRAME ( 8 * SIZEOF_ARG ) #define SIZEOF_FRAME ( 8 * FFI_SIZEOF_ARG )
.text .text
.align 2 .align 2
...@@ -46,37 +47,37 @@ ffi_call_N32: ...@@ -46,37 +47,37 @@ ffi_call_N32:
# Prologue # Prologue
SUBU $sp, SIZEOF_FRAME # Frame size SUBU $sp, SIZEOF_FRAME # Frame size
REG_S $fp, SIZEOF_FRAME - 2*SIZEOF_ARG($sp) # Save frame pointer REG_S $fp, SIZEOF_FRAME - 2*FFI_SIZEOF_ARG($sp) # Save frame pointer
REG_S ra, SIZEOF_FRAME - 1*SIZEOF_ARG($sp) # Save return address REG_S ra, SIZEOF_FRAME - 1*FFI_SIZEOF_ARG($sp) # Save return address
move $fp, $sp move $fp, $sp
move t9, callback # callback function pointer move t9, callback # callback function pointer
REG_S bytes, 2*SIZEOF_ARG($fp) # bytes REG_S bytes, 2*FFI_SIZEOF_ARG($fp) # bytes
REG_S flags, 3*SIZEOF_ARG($fp) # flags REG_S flags, 3*FFI_SIZEOF_ARG($fp) # flags
REG_S raddr, 4*SIZEOF_ARG($fp) # raddr REG_S raddr, 4*FFI_SIZEOF_ARG($fp) # raddr
REG_S fn, 5*SIZEOF_ARG($fp) # fn REG_S fn, 5*FFI_SIZEOF_ARG($fp) # fn
# Allocate at least 4 words in the argstack # Allocate at least 4 words in the argstack
move v0, bytes move v0, bytes
bge bytes, 4 * SIZEOF_ARG, bigger bge bytes, 4 * FFI_SIZEOF_ARG, bigger
LI v0, 4 * SIZEOF_ARG LI v0, 4 * FFI_SIZEOF_ARG
b sixteen b sixteen
bigger: bigger:
ADDU t4, v0, 2 * SIZEOF_ARG -1 # make sure it is aligned ADDU t4, v0, 2 * FFI_SIZEOF_ARG -1 # make sure it is aligned
and v0, t4, -2 * SIZEOF_ARG # to a proper boundry. and v0, t4, -2 * FFI_SIZEOF_ARG # to a proper boundry.
sixteen: sixteen:
SUBU $sp, $sp, v0 # move the stack pointer to reflect the SUBU $sp, $sp, v0 # move the stack pointer to reflect the
# arg space # arg space
ADDU a0, $sp, 0 # 4 * SIZEOF_ARG ADDU a0, $sp, 0 # 4 * FFI_SIZEOF_ARG
ADDU a3, $fp, 3 * SIZEOF_ARG ADDU a3, $fp, 3 * FFI_SIZEOF_ARG
# Call ffi_prep_args # Call ffi_prep_args
jal t9 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 # Copy the stack pointer to t9
move t9, $sp move t9, $sp
...@@ -85,10 +86,10 @@ sixteen: ...@@ -85,10 +86,10 @@ sixteen:
# of arguments. # of arguments.
# Load the number of bytes # 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? # Is it bigger than 8 * FFI_SIZEOF_ARG?
dadd t7, $0, 8 * SIZEOF_ARG dadd t7, $0, 8 * FFI_SIZEOF_ARG
dsub t8, t6, t7 dsub t8, t6, t7
bltz t8, loadregs bltz t8, loadregs
...@@ -96,125 +97,125 @@ sixteen: ...@@ -96,125 +97,125 @@ sixteen:
loadregs: 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 add t6, t4, 0 # and copy it into t6
and t4, ((1<<FFI_FLAG_BITS)-1) and t4, ((1<<FFI_FLAG_BITS)-1)
bnez t4, arg1_floatp bnez t4, arg1_floatp
REG_L a0, 0*SIZEOF_ARG(t9) REG_L a0, 0*FFI_SIZEOF_ARG(t9)
b arg1_next b arg1_next
arg1_floatp: arg1_floatp:
bne t4, FFI_TYPE_FLOAT, arg1_doublep 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 b arg1_next
arg1_doublep: arg1_doublep:
l.d $f12, 0*SIZEOF_ARG(t9) l.d $f12, 0*FFI_SIZEOF_ARG(t9)
arg1_next: arg1_next:
add t4, t6, 0 add t4, t6, 0
SRL t4, 1*FFI_FLAG_BITS SRL t4, 1*FFI_FLAG_BITS
and t4, ((1<<FFI_FLAG_BITS)-1) and t4, ((1<<FFI_FLAG_BITS)-1)
bnez t4, arg2_floatp bnez t4, arg2_floatp
REG_L a1, 1*SIZEOF_ARG(t9) REG_L a1, 1*FFI_SIZEOF_ARG(t9)
b arg2_next b arg2_next
arg2_floatp: arg2_floatp:
bne t4, FFI_TYPE_FLOAT, arg2_doublep 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 b arg2_next
arg2_doublep: arg2_doublep:
l.d $f13, 1*SIZEOF_ARG(t9) l.d $f13, 1*FFI_SIZEOF_ARG(t9)
arg2_next: arg2_next:
add t4, t6, 0 add t4, t6, 0
SRL t4, 2*FFI_FLAG_BITS SRL t4, 2*FFI_FLAG_BITS
and t4, ((1<<FFI_FLAG_BITS)-1) and t4, ((1<<FFI_FLAG_BITS)-1)
bnez t4, arg3_floatp bnez t4, arg3_floatp
REG_L a2, 2*SIZEOF_ARG(t9) REG_L a2, 2*FFI_SIZEOF_ARG(t9)
b arg3_next b arg3_next
arg3_floatp: arg3_floatp:
bne t4, FFI_TYPE_FLOAT, arg3_doublep 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 b arg3_next
arg3_doublep: arg3_doublep:
l.d $f14, 2*SIZEOF_ARG(t9) l.d $f14, 2*FFI_SIZEOF_ARG(t9)
arg3_next: arg3_next:
add t4, t6, 0 add t4, t6, 0
SRL t4, 3*FFI_FLAG_BITS SRL t4, 3*FFI_FLAG_BITS
and t4, ((1<<FFI_FLAG_BITS)-1) and t4, ((1<<FFI_FLAG_BITS)-1)
bnez t4, arg4_floatp bnez t4, arg4_floatp
REG_L a3, 3*SIZEOF_ARG(t9) REG_L a3, 3*FFI_SIZEOF_ARG(t9)
b arg4_next b arg4_next
arg4_floatp: arg4_floatp:
bne t4, FFI_TYPE_FLOAT, arg4_doublep 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 b arg4_next
arg4_doublep: arg4_doublep:
l.d $f15, 3*SIZEOF_ARG(t9) l.d $f15, 3*FFI_SIZEOF_ARG(t9)
arg4_next: arg4_next:
add t4, t6, 0 add t4, t6, 0
SRL t4, 4*FFI_FLAG_BITS SRL t4, 4*FFI_FLAG_BITS
and t4, ((1<<FFI_FLAG_BITS)-1) and t4, ((1<<FFI_FLAG_BITS)-1)
bnez t4, arg5_floatp bnez t4, arg5_floatp
REG_L a4, 4*SIZEOF_ARG(t9) REG_L a4, 4*FFI_SIZEOF_ARG(t9)
b arg5_next b arg5_next
arg5_floatp: arg5_floatp:
bne t4, FFI_TYPE_FLOAT, arg5_doublep 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 b arg5_next
arg5_doublep: arg5_doublep:
l.d $f16, 4*SIZEOF_ARG(t9) l.d $f16, 4*FFI_SIZEOF_ARG(t9)
arg5_next: arg5_next:
add t4, t6, 0 add t4, t6, 0
SRL t4, 5*FFI_FLAG_BITS SRL t4, 5*FFI_FLAG_BITS
and t4, ((1<<FFI_FLAG_BITS)-1) and t4, ((1<<FFI_FLAG_BITS)-1)
bnez t4, arg6_floatp bnez t4, arg6_floatp
REG_L a5, 5*SIZEOF_ARG(t9) REG_L a5, 5*FFI_SIZEOF_ARG(t9)
b arg6_next b arg6_next
arg6_floatp: arg6_floatp:
bne t4, FFI_TYPE_FLOAT, arg6_doublep 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 b arg6_next
arg6_doublep: arg6_doublep:
l.d $f17, 5*SIZEOF_ARG(t9) l.d $f17, 5*FFI_SIZEOF_ARG(t9)
arg6_next: arg6_next:
add t4, t6, 0 add t4, t6, 0
SRL t4, 6*FFI_FLAG_BITS SRL t4, 6*FFI_FLAG_BITS
and t4, ((1<<FFI_FLAG_BITS)-1) and t4, ((1<<FFI_FLAG_BITS)-1)
bnez t4, arg7_floatp bnez t4, arg7_floatp
REG_L a6, 6*SIZEOF_ARG(t9) REG_L a6, 6*FFI_SIZEOF_ARG(t9)
b arg7_next b arg7_next
arg7_floatp: arg7_floatp:
bne t4, FFI_TYPE_FLOAT, arg7_doublep 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 b arg7_next
arg7_doublep: arg7_doublep:
l.d $f18, 6*SIZEOF_ARG(t9) l.d $f18, 6*FFI_SIZEOF_ARG(t9)
arg7_next: arg7_next:
add t4, t6, 0 add t4, t6, 0
SRL t4, 7*FFI_FLAG_BITS SRL t4, 7*FFI_FLAG_BITS
and t4, ((1<<FFI_FLAG_BITS)-1) and t4, ((1<<FFI_FLAG_BITS)-1)
bnez t4, arg8_floatp bnez t4, arg8_floatp
REG_L a7, 7*SIZEOF_ARG(t9) REG_L a7, 7*FFI_SIZEOF_ARG(t9)
b arg8_next b arg8_next
arg8_floatp: arg8_floatp:
bne t4, FFI_TYPE_FLOAT, arg8_doublep 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 b arg8_next
arg8_doublep: arg8_doublep:
l.d $f19, 7*SIZEOF_ARG(t9) l.d $f19, 7*FFI_SIZEOF_ARG(t9)
arg8_next: arg8_next:
callit: callit:
# Load the function pointer # 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. # 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 beqz t5, noretval
# Shift the return type flag over # Shift the return type flag over
...@@ -222,42 +223,42 @@ callit: ...@@ -222,42 +223,42 @@ callit:
bne t6, FFI_TYPE_INT, retfloat bne t6, FFI_TYPE_INT, retfloat
jal t9 jal t9
REG_L t4, 4*SIZEOF_ARG($fp) REG_L t4, 4*FFI_SIZEOF_ARG($fp)
REG_S v0, 0(t4) REG_S v0, 0(t4)
b epilogue b epilogue
retfloat: retfloat:
bne t6, FFI_TYPE_FLOAT, retdouble bne t6, FFI_TYPE_FLOAT, retdouble
jal t9 jal t9
REG_L t4, 4*SIZEOF_ARG($fp) REG_L t4, 4*FFI_SIZEOF_ARG($fp)
s.s $f0, 0(t4) s.s $f0, 0(t4)
b epilogue b epilogue
retdouble: retdouble:
bne t6, FFI_TYPE_DOUBLE, retstruct_d bne t6, FFI_TYPE_DOUBLE, retstruct_d
jal t9 jal t9
REG_L t4, 4*SIZEOF_ARG($fp) REG_L t4, 4*FFI_SIZEOF_ARG($fp)
s.d $f0, 0(t4) s.d $f0, 0(t4)
b epilogue b epilogue
retstruct_d: retstruct_d:
bne t6, FFI_TYPE_STRUCT_D, retstruct_f bne t6, FFI_TYPE_STRUCT_D, retstruct_f
jal t9 jal t9
REG_L t4, 4*SIZEOF_ARG($fp) REG_L t4, 4*FFI_SIZEOF_ARG($fp)
s.d $f0, 0(t4) s.d $f0, 0(t4)
b epilogue b epilogue
retstruct_f: retstruct_f:
bne t6, FFI_TYPE_STRUCT_F, retstruct_d_d bne t6, FFI_TYPE_STRUCT_F, retstruct_d_d
jal t9 jal t9
REG_L t4, 4*SIZEOF_ARG($fp) REG_L t4, 4*FFI_SIZEOF_ARG($fp)
s.s $f0, 0(t4) s.s $f0, 0(t4)
b epilogue b epilogue
retstruct_d_d: retstruct_d_d:
bne t6, FFI_TYPE_STRUCT_DD, retstruct_f_f bne t6, FFI_TYPE_STRUCT_DD, retstruct_f_f
jal t9 jal t9
REG_L t4, 4*SIZEOF_ARG($fp) REG_L t4, 4*FFI_SIZEOF_ARG($fp)
s.d $f0, 0(t4) s.d $f0, 0(t4)
s.d $f2, 8(t4) s.d $f2, 8(t4)
b epilogue b epilogue
...@@ -265,7 +266,7 @@ retstruct_d_d: ...@@ -265,7 +266,7 @@ retstruct_d_d:
retstruct_f_f: retstruct_f_f:
bne t6, FFI_TYPE_STRUCT_FF, retstruct_d_f bne t6, FFI_TYPE_STRUCT_FF, retstruct_d_f
jal t9 jal t9
REG_L t4, 4*SIZEOF_ARG($fp) REG_L t4, 4*FFI_SIZEOF_ARG($fp)
s.s $f0, 0(t4) s.s $f0, 0(t4)
s.s $f2, 4(t4) s.s $f2, 4(t4)
b epilogue b epilogue
...@@ -273,7 +274,7 @@ retstruct_f_f: ...@@ -273,7 +274,7 @@ retstruct_f_f:
retstruct_d_f: retstruct_d_f:
bne t6, FFI_TYPE_STRUCT_DF, retstruct_f_d bne t6, FFI_TYPE_STRUCT_DF, retstruct_f_d
jal t9 jal t9
REG_L t4, 4*SIZEOF_ARG($fp) REG_L t4, 4*FFI_SIZEOF_ARG($fp)
s.d $f0, 0(t4) s.d $f0, 0(t4)
s.s $f2, 8(t4) s.s $f2, 8(t4)
b epilogue b epilogue
...@@ -281,7 +282,7 @@ retstruct_d_f: ...@@ -281,7 +282,7 @@ retstruct_d_f:
retstruct_f_d: retstruct_f_d:
bne t6, FFI_TYPE_STRUCT_FD, retstruct_small bne t6, FFI_TYPE_STRUCT_FD, retstruct_small
jal t9 jal t9
REG_L t4, 4*SIZEOF_ARG($fp) REG_L t4, 4*FFI_SIZEOF_ARG($fp)
s.s $f0, 0(t4) s.s $f0, 0(t4)
s.d $f2, 8(t4) s.d $f2, 8(t4)
b epilogue b epilogue
...@@ -289,14 +290,14 @@ retstruct_f_d: ...@@ -289,14 +290,14 @@ retstruct_f_d:
retstruct_small: retstruct_small:
bne t6, FFI_TYPE_STRUCT_SMALL, retstruct_small2 bne t6, FFI_TYPE_STRUCT_SMALL, retstruct_small2
jal t9 jal t9
REG_L t4, 4*SIZEOF_ARG($fp) REG_L t4, 4*FFI_SIZEOF_ARG($fp)
REG_S v0, 0(t4) REG_S v0, 0(t4)
b epilogue b epilogue
retstruct_small2: retstruct_small2:
bne t6, FFI_TYPE_STRUCT_SMALL2, retstruct bne t6, FFI_TYPE_STRUCT_SMALL2, retstruct
jal t9 jal t9
REG_L t4, 4*SIZEOF_ARG($fp) REG_L t4, 4*FFI_SIZEOF_ARG($fp)
REG_S v0, 0(t4) REG_S v0, 0(t4)
REG_S v1, 8(t4) REG_S v1, 8(t4)
b epilogue b epilogue
...@@ -308,8 +309,8 @@ noretval: ...@@ -308,8 +309,8 @@ noretval:
# Epilogue # Epilogue
epilogue: epilogue:
move $sp, $fp move $sp, $fp
REG_L $fp, SIZEOF_FRAME - 2*SIZEOF_ARG($sp) # Restore frame pointer REG_L $fp, SIZEOF_FRAME - 2*FFI_SIZEOF_ARG($sp) # Restore frame pointer
REG_L ra, SIZEOF_FRAME - 1*SIZEOF_ARG($sp) # Restore return address REG_L ra, SIZEOF_FRAME - 1*FFI_SIZEOF_ARG($sp) # Restore return address
ADDU $sp, SIZEOF_FRAME # Fix stack pointer ADDU $sp, SIZEOF_FRAME # Fix stack pointer
j ra j ra
......
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
o32.S - Copyright (c) 1996, 1998 Cygnus Solutions o32.S - Copyright (c) 1996, 1998 Red Hat, Inc.
MIPS Foreign Function Interface MIPS Foreign Function Interface
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
----------------------------------------------------------------------- */ ----------------------------------------------------------------------- */
#define LIBFFI_ASM #define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h> #include <ffi.h>
/* Only build this code if we are compiling for o32 */ /* Only build this code if we are compiling for o32 */
...@@ -34,7 +35,7 @@ ...@@ -34,7 +35,7 @@
#define bytes a2 #define bytes a2
#define flags a3 #define flags a3
#define SIZEOF_FRAME ( 4 * SIZEOF_ARG + 2 * SIZEOF_ARG ) #define SIZEOF_FRAME ( 4 * FFI_SIZEOF_ARG + 2 * FFI_SIZEOF_ARG )
.text .text
.align 2 .align 2
...@@ -44,114 +45,114 @@ ffi_call_O32: ...@@ -44,114 +45,114 @@ ffi_call_O32:
# Prologue # Prologue
SUBU $sp, SIZEOF_FRAME # Frame size SUBU $sp, SIZEOF_FRAME # Frame size
REG_S $fp, SIZEOF_FRAME - 2*SIZEOF_ARG($sp) # Save frame pointer REG_S $fp, SIZEOF_FRAME - 2*FFI_SIZEOF_ARG($sp) # Save frame pointer
REG_S ra, SIZEOF_FRAME - 1*SIZEOF_ARG($sp) # Save return address REG_S ra, SIZEOF_FRAME - 1*FFI_SIZEOF_ARG($sp) # Save return address
move $fp, $sp move $fp, $sp
move t9, callback # callback function pointer 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 # Allocate at least 4 words in the argstack
move v0, bytes move v0, bytes
bge bytes, 4 * SIZEOF_ARG, bigger bge bytes, 4 * FFI_SIZEOF_ARG, bigger
LI v0, 4 * SIZEOF_ARG LI v0, 4 * FFI_SIZEOF_ARG
b sixteen b sixteen
bigger: bigger:
ADDU t0, v0, 2 * SIZEOF_ARG -1 # make sure it is aligned ADDU t0, v0, 2 * FFI_SIZEOF_ARG -1 # make sure it is aligned
and v0, t0, -2 * SIZEOF_ARG # to an 8 byte boundry and v0, t0, -2 * FFI_SIZEOF_ARG # to an 8 byte boundry
sixteen: sixteen:
SUBU $sp, $sp, v0 # move the stack pointer to reflect the SUBU $sp, $sp, v0 # move the stack pointer to reflect the
# arg space # arg space
ADDU a0, $sp, 4 * SIZEOF_ARG ADDU a0, $sp, 4 * FFI_SIZEOF_ARG
ADDU a3, $fp, SIZEOF_FRAME + 3*SIZEOF_ARG ADDU a3, $fp, SIZEOF_FRAME + 3*FFI_SIZEOF_ARG
jal t9 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 add t2, t0, 0 # and copy it into t2
and t0, ((1<<4)-1) # mask out the return type and t0, ((1<<4)-1) # mask out the return type
SRL t2, 4 # shift our arg info 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 bnez t0, pass_d # make it quick for int
REG_L a0, 0*SIZEOF_ARG($sp) # just go ahead and load the REG_L a0, 0*FFI_SIZEOF_ARG($sp) # just go ahead and load the
REG_L a1, 1*SIZEOF_ARG($sp) # four regs. REG_L a1, 1*FFI_SIZEOF_ARG($sp) # four regs.
REG_L a2, 2*SIZEOF_ARG($sp) REG_L a2, 2*FFI_SIZEOF_ARG($sp)
REG_L a3, 3*SIZEOF_ARG($sp) REG_L a3, 3*FFI_SIZEOF_ARG($sp)
b call_it b call_it
pass_d: pass_d:
bne t0, FFI_ARGS_D, pass_f bne t0, FFI_ARGS_D, pass_f
l.d $f12, 0*SIZEOF_ARG($sp) # load $fp regs from args l.d $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args
REG_L a2, 2*SIZEOF_ARG($sp) # passing a double REG_L a2, 2*FFI_SIZEOF_ARG($sp) # passing a double
REG_L a3, 3*SIZEOF_ARG($sp) REG_L a3, 3*FFI_SIZEOF_ARG($sp)
b call_it b call_it
pass_f: pass_f:
bne t0, FFI_ARGS_F, pass_d_d bne t0, FFI_ARGS_F, pass_d_d
l.s $f12, 0*SIZEOF_ARG($sp) # load $fp regs from args l.s $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args
REG_L a1, 1*SIZEOF_ARG($sp) # passing a float REG_L a1, 1*FFI_SIZEOF_ARG($sp) # passing a float
REG_L a2, 2*SIZEOF_ARG($sp) REG_L a2, 2*FFI_SIZEOF_ARG($sp)
REG_L a3, 3*SIZEOF_ARG($sp) REG_L a3, 3*FFI_SIZEOF_ARG($sp)
b call_it b call_it
pass_d_d: pass_d_d:
bne t0, FFI_ARGS_DD, pass_f_f bne t0, FFI_ARGS_DD, pass_f_f
l.d $f12, 0*SIZEOF_ARG($sp) # load $fp regs from args l.d $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args
l.d $f14, 2*SIZEOF_ARG($sp) # passing two doubles l.d $f14, 2*FFI_SIZEOF_ARG($sp) # passing two doubles
b call_it b call_it
pass_f_f: pass_f_f:
bne t0, FFI_ARGS_FF, pass_d_f bne t0, FFI_ARGS_FF, pass_d_f
l.s $f12, 0*SIZEOF_ARG($sp) # load $fp regs from args l.s $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args
l.s $f14, 1*SIZEOF_ARG($sp) # passing two floats l.s $f14, 1*FFI_SIZEOF_ARG($sp) # passing two floats
REG_L a2, 2*SIZEOF_ARG($sp) REG_L a2, 2*FFI_SIZEOF_ARG($sp)
REG_L a3, 3*SIZEOF_ARG($sp) REG_L a3, 3*FFI_SIZEOF_ARG($sp)
b call_it b call_it
pass_d_f: pass_d_f:
bne t0, FFI_ARGS_DF, pass_f_d bne t0, FFI_ARGS_DF, pass_f_d
l.d $f12, 0*SIZEOF_ARG($sp) # load $fp regs from args l.d $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args
l.s $f14, 2*SIZEOF_ARG($sp) # passing double and float l.s $f14, 2*FFI_SIZEOF_ARG($sp) # passing double and float
REG_L a3, 3*SIZEOF_ARG($sp) REG_L a3, 3*FFI_SIZEOF_ARG($sp)
b call_it b call_it
pass_f_d: pass_f_d:
# assume that the only other combination must be float then double # assume that the only other combination must be float then double
# bne t0, FFI_ARGS_F_D, call_it # bne t0, FFI_ARGS_F_D, call_it
l.s $f12, 0*SIZEOF_ARG($sp) # load $fp regs from args l.s $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args
l.d $f14, 2*SIZEOF_ARG($sp) # passing double and float l.d $f14, 2*FFI_SIZEOF_ARG($sp) # passing double and float
call_it: call_it:
# Load the function pointer # 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. # 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 beqz t1, noretval
bne t2, FFI_TYPE_INT, retfloat bne t2, FFI_TYPE_INT, retfloat
jal t9 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) REG_S v0, 0(t0)
b epilogue b epilogue
retfloat: retfloat:
bne t2, FFI_TYPE_FLOAT, retdouble bne t2, FFI_TYPE_FLOAT, retdouble
jal t9 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) s.s $f0, 0(t0)
b epilogue b epilogue
retdouble: retdouble:
bne t2, FFI_TYPE_DOUBLE, noretval bne t2, FFI_TYPE_DOUBLE, noretval
jal t9 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) s.d $f0, 0(t0)
b epilogue b epilogue
...@@ -161,8 +162,8 @@ noretval: ...@@ -161,8 +162,8 @@ noretval:
# Epilogue # Epilogue
epilogue: epilogue:
move $sp, $fp move $sp, $fp
REG_L $fp, SIZEOF_FRAME - 2*SIZEOF_ARG($sp) # Restore frame pointer REG_L $fp, SIZEOF_FRAME - 2*FFI_SIZEOF_ARG($sp) # Restore frame pointer
REG_L ra, SIZEOF_FRAME - 1*SIZEOF_ARG($sp) # Restore return address REG_L ra, SIZEOF_FRAME - 1*FFI_SIZEOF_ARG($sp) # Restore return address
ADDU $sp, SIZEOF_FRAME # Fix stack pointer ADDU $sp, SIZEOF_FRAME # Fix stack pointer
j ra j ra
......
...@@ -80,6 +80,7 @@ ...@@ -80,6 +80,7 @@
.set f21,21 .set f21,21
#define LIBFFI_ASM #define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h> #include <ffi.h>
#define JUMPTARGET(name) name #define JUMPTARGET(name) name
#define L(x) x #define L(x) x
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
----------------------------------------------------------------------- */ ----------------------------------------------------------------------- */
#define LIBFFI_ASM #define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h> #include <ffi.h>
#define JUMPTARGET(name) name #define JUMPTARGET(name) name
#define L(x) x #define L(x) x
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE. OTHER DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------- */ ----------------------------------------------------------------------- */
#include <ffi.h> #include <ffi.h>
#include <ffi_common.h> #include <ffi_common.h>
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
----------------------------------------------------------------------- */ ----------------------------------------------------------------------- */
#define LIBFFI_ASM #define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h> #include <ffi.h>
#ifdef __powerpc64__ #ifdef __powerpc64__
......
#define LIBFFI_ASM #define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h> #include <ffi.h>
.file "linux64_closure.S" .file "linux64_closure.S"
......
#define LIBFFI_ASM #define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h> #include <ffi.h>
#include <powerpc/asm.h> #include <powerpc/asm.h>
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
----------------------------------------------------------------------- */ ----------------------------------------------------------------------- */
#define LIBFFI_ASM #define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h> #include <ffi.h>
#include <powerpc/asm.h> #include <powerpc/asm.h>
......
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
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 Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the a copy of this software and associated documentation files (the
...@@ -26,9 +26,9 @@ ...@@ -26,9 +26,9 @@
#include <stdlib.h> #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 /* Perform machine independent initialization of aggregate type
specifications. */ specifications. */
...@@ -53,7 +53,7 @@ static ffi_status initialize_aggregate(/*@out@*/ ffi_type *arg) ...@@ -53,7 +53,7 @@ static ffi_status initialize_aggregate(/*@out@*/ ffi_type *arg)
return FFI_BAD_TYPEDEF; return FFI_BAD_TYPEDEF;
/* Perform a sanity check on the argument type */ /* 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 = ALIGN(arg->size, (*ptr)->alignment);
arg->size += (*ptr)->size; arg->size += (*ptr)->size;
...@@ -94,7 +94,7 @@ ffi_status ffi_prep_cif(/*@out@*/ /*@partial@*/ ffi_cif *cif, ...@@ -94,7 +94,7 @@ ffi_status ffi_prep_cif(/*@out@*/ /*@partial@*/ ffi_cif *cif,
ffi_type **ptr; ffi_type **ptr;
FFI_ASSERT(cif != NULL); 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->abi = abi;
cif->arg_types = atypes; cif->arg_types = atypes;
...@@ -110,7 +110,7 @@ ffi_status ffi_prep_cif(/*@out@*/ /*@partial@*/ ffi_cif *cif, ...@@ -110,7 +110,7 @@ ffi_status ffi_prep_cif(/*@out@*/ /*@partial@*/ ffi_cif *cif,
/*@=usedef@*/ /*@=usedef@*/
/* Perform a sanity check on the return type */ /* 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. */ /* x86-64 and s390 stack space allocation is handled in prep_machdep. */
#if !defined M68K && !defined __x86_64__ && !defined S390 #if !defined M68K && !defined __x86_64__ && !defined S390
...@@ -126,7 +126,7 @@ ffi_status ffi_prep_cif(/*@out@*/ /*@partial@*/ ffi_cif *cif, ...@@ -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++) for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++)
{ {
/* Perform a sanity check on the argument type */ /* 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 */ /* Initialize any uninitialized aggregate type definitions */
if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK)) if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK))
......
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
raw_api.c - Copyright (c) 1999 Cygnus Solutions raw_api.c - Copyright (c) 1999 Red Hat, Inc.
Author: Kresten Krab Thorup <krab@gnu.org> Author: Kresten Krab Thorup <krab@gnu.org>
...@@ -44,10 +44,10 @@ ffi_raw_size (ffi_cif *cif) ...@@ -44,10 +44,10 @@ ffi_raw_size (ffi_cif *cif)
{ {
#if !FFI_NO_STRUCTS #if !FFI_NO_STRUCTS
if ((*at)->type == FFI_TYPE_STRUCT) if ((*at)->type == FFI_TYPE_STRUCT)
result += ALIGN (sizeof (void*), SIZEOF_ARG); result += ALIGN (sizeof (void*), FFI_SIZEOF_ARG);
else else
#endif #endif
result += ALIGN ((*at)->size, SIZEOF_ARG); result += ALIGN ((*at)->size, FFI_SIZEOF_ARG);
} }
return result; return result;
...@@ -68,18 +68,18 @@ ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args) ...@@ -68,18 +68,18 @@ ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args)
{ {
case FFI_TYPE_UINT8: case FFI_TYPE_UINT8:
case FFI_TYPE_SINT8: case FFI_TYPE_SINT8:
*args = (void*) ((char*)(raw++) + SIZEOF_ARG - 1); *args = (void*) ((char*)(raw++) + FFI_SIZEOF_ARG - 1);
break; break;
case FFI_TYPE_UINT16: case FFI_TYPE_UINT16:
case FFI_TYPE_SINT16: case FFI_TYPE_SINT16:
*args = (void*) ((char*)(raw++) + SIZEOF_ARG - 2); *args = (void*) ((char*)(raw++) + FFI_SIZEOF_ARG - 2);
break; break;
#if SIZEOF_ARG >= 4 #if FFI_SIZEOF_ARG >= 4
case FFI_TYPE_UINT32: case FFI_TYPE_UINT32:
case FFI_TYPE_SINT32: case FFI_TYPE_SINT32:
*args = (void*) ((char*)(raw++) + SIZEOF_ARG - 4); *args = (void*) ((char*)(raw++) + FFI_SIZEOF_ARG - 4);
break; break;
#endif #endif
...@@ -95,7 +95,7 @@ ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args) ...@@ -95,7 +95,7 @@ ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args)
default: default:
*args = raw; *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) ...@@ -152,7 +152,7 @@ ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw)
(raw++)->sint = *(SINT16*) (*args); (raw++)->sint = *(SINT16*) (*args);
break; break;
#if SIZEOF_ARG >= 4 #if FFI_SIZEOF_ARG >= 4
case FFI_TYPE_UINT32: case FFI_TYPE_UINT32:
(raw++)->uint = *(UINT32*) (*args); (raw++)->uint = *(UINT32*) (*args);
break; break;
...@@ -174,7 +174,7 @@ ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw) ...@@ -174,7 +174,7 @@ ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw)
default: default:
memcpy ((void*) raw->data, (void*)*args, (*tp)->size); 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;
} }
} }
} }
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
----------------------------------------------------------------------- */ ----------------------------------------------------------------------- */
#define LIBFFI_ASM #define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h> #include <ffi.h>
#ifndef __s390x__ #ifndef __s390x__
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
----------------------------------------------------------------------- */ ----------------------------------------------------------------------- */
#define LIBFFI_ASM #define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h> #include <ffi.h>
#ifdef HAVE_MACHINE_ASM_H #ifdef HAVE_MACHINE_ASM_H
#include <machine/asm.h> #include <machine/asm.h>
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
----------------------------------------------------------------------- */ ----------------------------------------------------------------------- */
#define LIBFFI_ASM #define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h> #include <ffi.h>
#ifdef HAVE_MACHINE_ASM_H #ifdef HAVE_MACHINE_ASM_H
#include <machine/asm.h> #include <machine/asm.h>
......
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
ffi.c - Copyright (c) 1996, 2003 Cygnus Solutions ffi.c - Copyright (c) 1996, 2003 Red Hat, Inc.
Sparc Foreign Function Interface Sparc Foreign Function Interface
...@@ -491,7 +491,7 @@ ffi_closure_sparc_inner(ffi_closure *closure, ...@@ -491,7 +491,7 @@ ffi_closure_sparc_inner(ffi_closure *closure,
while (i < avn) while (i < avn)
{ {
/* Assume big-endian. FIXME */ /* 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 #ifdef SPARC64
if (i < 16 && (arg_types[i]->type == FFI_TYPE_FLOAT if (i < 16 && (arg_types[i]->type == FFI_TYPE_FLOAT
......
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
v8.S - Copyright (c) 1996, 1997, 2003 Cygnus Solutions v8.S - Copyright (c) 1996, 1997, 2003 Red Hat, Inc.
Sparc Foreign Function Interface Sparc Foreign Function Interface
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
----------------------------------------------------------------------- */ ----------------------------------------------------------------------- */
#define LIBFFI_ASM #define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h> #include <ffi.h>
#define STACKFRAME 96 /* Minimum stack framesize for SPARC */ #define STACKFRAME 96 /* Minimum stack framesize for SPARC */
......
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
v9.S - Copyright (c) 2000, 2003 Cygnus Solutions v9.S - Copyright (c) 2000, 2003 Red Hat, Inc.
Sparc 64bit Foreign Function Interface Sparc 64bit Foreign Function Interface
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
----------------------------------------------------------------------- */ ----------------------------------------------------------------------- */
#define LIBFFI_ASM #define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h> #include <ffi.h>
#ifdef SPARC64 #ifdef SPARC64
......
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
types.c - Copyright (c) 1996, 1998 Cygnus Solutions types.c - Copyright (c) 1996, 1998 Red Hat, Inc.
Predefined ffi_types needed by libffi. Predefined ffi_types needed by libffi.
......
...@@ -689,7 +689,7 @@ ffi_closure_UNIX64_inner(ffi_closure *closure, va_list l, void *rp) ...@@ -689,7 +689,7 @@ ffi_closure_UNIX64_inner(ffi_closure *closure, va_list l, void *rp)
FFI_ASSERT(0); 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++; i++;
} }
......
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
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 X86 Foreign Function Interface
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#ifndef __x86_64__ #ifndef __x86_64__
#define LIBFFI_ASM #define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h> #include <ffi.h>
.text .text
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#ifdef __x86_64__ #ifdef __x86_64__
#define LIBFFI_ASM #define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h> #include <ffi.h>
.section .rodata .section .rodata
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
----------------------------------------------------------------------- */ ----------------------------------------------------------------------- */
#define LIBFFI_ASM #define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h> #include <ffi.h>
.text .text
......
...@@ -71,6 +71,7 @@ DLLTOOL = @DLLTOOL@ ...@@ -71,6 +71,7 @@ DLLTOOL = @DLLTOOL@
EXEEXT = @EXEEXT@ EXEEXT = @EXEEXT@
GCJ = @GCJ@ GCJ = @GCJ@
GCJFLAGS = @GCJFLAGS@ GCJFLAGS = @GCJFLAGS@
HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@
LIBTOOL = @LIBTOOL@ LIBTOOL = @LIBTOOL@
LN_S = @LN_S@ LN_S = @LN_S@
MAINT = @MAINT@ MAINT = @MAINT@
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment