[multiple changes]
2004-03-19 Matthias Klose <doko@debian.org> * Makefile.am: Update * Makefile.in: Regenerate. * src/pa/ffi.h.in: Remove. * src/pa/ffitarget.h: New file. 2004-02-10 Randolph Chung <tausq@debian.org> * Makefile.am: Add PA support. * Makefile.in: Regenerate. * include/Makefile.in: Regenerate. * configure.ac: Add PA target. * configure: Regenerate. * src/pa/ffi.c: New file. * src/pa/ffi.h.in: Add PA support. * src/pa/linux.S: New file. * prep_cif.c: Add PA support. From-SVN: r79702
This commit is contained in:
parent
d511a27346
commit
d65a810fe4
@ -1,3 +1,22 @@
|
||||
2004-03-19 Matthias Klose <doko@debian.org>
|
||||
|
||||
* Makefile.am: Update
|
||||
* Makefile.in: Regenerate.
|
||||
* src/pa/ffi.h.in: Remove.
|
||||
* src/pa/ffitarget.h: New file.
|
||||
|
||||
2004-02-10 Randolph Chung <tausq@debian.org>
|
||||
|
||||
* Makefile.am: Add PA support.
|
||||
* Makefile.in: Regenerate.
|
||||
* include/Makefile.in: Regenerate.
|
||||
* configure.ac: Add PA target.
|
||||
* configure: Regenerate.
|
||||
* src/pa/ffi.c: New file.
|
||||
* src/pa/ffi.h.in: Add PA support.
|
||||
* src/pa/linux.S: New file.
|
||||
* prep_cif.c: Add PA support.
|
||||
|
||||
2004-03-16 Hosaka Yuji <hos@tamanegi.org>
|
||||
|
||||
* src/types.c: Fix alignment size of X86_WIN32 case int64 and
|
||||
|
@ -22,7 +22,8 @@ EXTRA_DIST = LICENSE ChangeLog.v1 \
|
||||
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
|
||||
src/x86/ffi64.c src/x86/unix64.S src/x86/ffitarget.h \
|
||||
src/pa/ffi.c src/pa/linux.S
|
||||
|
||||
## ################################################################
|
||||
|
||||
@ -135,6 +136,9 @@ endif
|
||||
if SH64
|
||||
nodist_libffi_la_SOURCES += src/sh64/sysv.S src/sh64/ffi.c
|
||||
endif
|
||||
if PA
|
||||
nodist_libffi_la_SOURCES += src/pa/linux.S src/pa/ffi.c
|
||||
endif
|
||||
|
||||
libffi_convenience_la_SOURCES = $(libffi_la_SOURCES)
|
||||
nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES)
|
||||
|
@ -54,6 +54,7 @@ target_triplet = @target@
|
||||
@X86_64_TRUE@am__append_14 = src/x86/ffi64.c src/x86/unix64.S src/x86/ffi.c src/x86/sysv.S
|
||||
@SH_TRUE@am__append_15 = src/sh/sysv.S src/sh/ffi.c
|
||||
@SH64_TRUE@am__append_16 = src/sh64/sysv.S src/sh64/ffi.c
|
||||
@PA_TRUE@am__append_17 = src/pa/linux.S src/pa/ffi.c
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALLOCA = @ALLOCA@
|
||||
ALPHA_FALSE = @ALPHA_FALSE@
|
||||
@ -113,6 +114,8 @@ PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PA_FALSE = @PA_FALSE@
|
||||
PA_TRUE = @PA_TRUE@
|
||||
POWERPC_AIX_FALSE = @POWERPC_AIX_FALSE@
|
||||
POWERPC_AIX_TRUE = @POWERPC_AIX_TRUE@
|
||||
POWERPC_DARWIN_FALSE = @POWERPC_DARWIN_FALSE@
|
||||
@ -209,7 +212,8 @@ EXTRA_DIST = LICENSE ChangeLog.v1 \
|
||||
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
|
||||
src/x86/ffi64.c src/x86/unix64.S src/x86/ffitarget.h \
|
||||
src/pa/ffi.c src/pa/linux.S
|
||||
|
||||
|
||||
# Work around what appears to be a GNU make bug handling MAKEFLAGS
|
||||
@ -269,7 +273,7 @@ libffi_la_SOURCES = src/debug.c src/prep_cif.c src/types.c \
|
||||
src/raw_api.c src/java_raw_api.c
|
||||
|
||||
|
||||
nodist_libffi_la_SOURCES = $(am__append_1) $(am__append_2) $(am__append_3) $(am__append_4) $(am__append_5) $(am__append_6) $(am__append_7) $(am__append_8) $(am__append_9) $(am__append_10) $(am__append_11) $(am__append_12) $(am__append_13) $(am__append_14) $(am__append_15) $(am__append_16)
|
||||
nodist_libffi_la_SOURCES = $(am__append_1) $(am__append_2) $(am__append_3) $(am__append_4) $(am__append_5) $(am__append_6) $(am__append_7) $(am__append_8) $(am__append_9) $(am__append_10) $(am__append_11) $(am__append_12) $(am__append_13) $(am__append_14) $(am__append_15) $(am__append_16) $(am__append_17)
|
||||
|
||||
libffi_convenience_la_SOURCES = $(libffi_la_SOURCES)
|
||||
nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES)
|
||||
@ -316,25 +320,26 @@ am_libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo src/types.lo \
|
||||
@X86_64_TRUE@ src/x86/ffi.lo src/x86/sysv.lo
|
||||
@SH_TRUE@am__objects_15 = src/sh/sysv.lo src/sh/ffi.lo
|
||||
@SH64_TRUE@am__objects_16 = src/sh64/sysv.lo src/sh64/ffi.lo
|
||||
@PA_TRUE@am__objects_17 = src/pa/linux.lo src/pa/ffi.lo
|
||||
nodist_libffi_la_OBJECTS = $(am__objects_1) $(am__objects_2) \
|
||||
$(am__objects_3) $(am__objects_4) $(am__objects_5) \
|
||||
$(am__objects_6) $(am__objects_7) $(am__objects_8) \
|
||||
$(am__objects_9) $(am__objects_10) $(am__objects_11) \
|
||||
$(am__objects_12) $(am__objects_13) $(am__objects_14) \
|
||||
$(am__objects_15) $(am__objects_16)
|
||||
$(am__objects_15) $(am__objects_16) $(am__objects_17)
|
||||
libffi_la_OBJECTS = $(am_libffi_la_OBJECTS) $(nodist_libffi_la_OBJECTS)
|
||||
libffi_convenience_la_LDFLAGS =
|
||||
libffi_convenience_la_LIBADD =
|
||||
am__objects_17 = src/debug.lo src/prep_cif.lo src/types.lo \
|
||||
am__objects_18 = src/debug.lo src/prep_cif.lo src/types.lo \
|
||||
src/raw_api.lo src/java_raw_api.lo
|
||||
am_libffi_convenience_la_OBJECTS = $(am__objects_17)
|
||||
am__objects_18 = $(am__objects_1) $(am__objects_2) $(am__objects_3) \
|
||||
am_libffi_convenience_la_OBJECTS = $(am__objects_18)
|
||||
am__objects_19 = $(am__objects_1) $(am__objects_2) $(am__objects_3) \
|
||||
$(am__objects_4) $(am__objects_5) $(am__objects_6) \
|
||||
$(am__objects_7) $(am__objects_8) $(am__objects_9) \
|
||||
$(am__objects_10) $(am__objects_11) $(am__objects_12) \
|
||||
$(am__objects_13) $(am__objects_14) $(am__objects_15) \
|
||||
$(am__objects_16)
|
||||
nodist_libffi_convenience_la_OBJECTS = $(am__objects_18)
|
||||
$(am__objects_16) $(am__objects_17)
|
||||
nodist_libffi_convenience_la_OBJECTS = $(am__objects_19)
|
||||
libffi_convenience_la_OBJECTS = $(am_libffi_convenience_la_OBJECTS) \
|
||||
$(nodist_libffi_convenience_la_OBJECTS)
|
||||
|
||||
@ -360,11 +365,11 @@ RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
|
||||
check-recursive installcheck-recursive
|
||||
DIST_COMMON = README $(srcdir)/Makefile.in $(srcdir)/configure \
|
||||
../ABOUT-NLS ../COPYING ../COPYING.LIB ../ChangeLog ../README \
|
||||
../compile ../config.guess ../config.rpath ../config.sub \
|
||||
../configure ../configure.in ../install-sh ../ltcf-c.sh \
|
||||
../ltcf-cxx.sh ../ltcf-gcj.sh ../ltconfig ../ltmain.sh \
|
||||
../missing ../mkinstalldirs ../ylwrap ChangeLog Makefile.am \
|
||||
acinclude.m4 aclocal.m4 configure configure.ac fficonfig.h.in
|
||||
../config.guess ../config.rpath ../config.sub ../configure \
|
||||
../configure.in ../install-sh ../ltcf-c.sh ../ltcf-cxx.sh \
|
||||
../ltcf-gcj.sh ../ltconfig ../ltmain.sh ../missing \
|
||||
../mkinstalldirs ../ylwrap ChangeLog Makefile.am acinclude.m4 \
|
||||
aclocal.m4 configure configure.ac fficonfig.h.in
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
SOURCES = $(libffi_la_SOURCES) $(nodist_libffi_la_SOURCES) $(libffi_convenience_la_SOURCES) $(nodist_libffi_convenience_la_SOURCES)
|
||||
|
||||
@ -519,6 +524,11 @@ src/sh64/$(am__dirstamp):
|
||||
@: > src/sh64/$(am__dirstamp)
|
||||
src/sh64/sysv.lo: src/sh64/$(am__dirstamp)
|
||||
src/sh64/ffi.lo: src/sh64/$(am__dirstamp)
|
||||
src/pa/$(am__dirstamp):
|
||||
@$(mkinstalldirs) src/pa
|
||||
@: > src/pa/$(am__dirstamp)
|
||||
src/pa/linux.lo: src/pa/$(am__dirstamp)
|
||||
src/pa/ffi.lo: src/pa/$(am__dirstamp)
|
||||
libffi.la: $(libffi_la_OBJECTS) $(libffi_la_DEPENDENCIES)
|
||||
$(LINK) -rpath $(toolexeclibdir) $(libffi_la_LDFLAGS) $(libffi_la_OBJECTS) $(libffi_la_LIBADD) $(LIBS)
|
||||
libffi_convenience.la: $(libffi_convenience_la_OBJECTS) $(libffi_convenience_la_DEPENDENCIES)
|
||||
@ -552,6 +562,10 @@ mostlyclean-compile:
|
||||
-rm -f src/mips/n32.lo
|
||||
-rm -f src/mips/o32.$(OBJEXT)
|
||||
-rm -f src/mips/o32.lo
|
||||
-rm -f src/pa/ffi.$(OBJEXT)
|
||||
-rm -f src/pa/ffi.lo
|
||||
-rm -f src/pa/linux.$(OBJEXT)
|
||||
-rm -f src/pa/linux.lo
|
||||
-rm -f src/powerpc/aix.$(OBJEXT)
|
||||
-rm -f src/powerpc/aix.lo
|
||||
-rm -f src/powerpc/aix_closure.$(OBJEXT)
|
||||
@ -817,6 +831,15 @@ src/sh64/sysv.obj: src/sh64/sysv.S
|
||||
src/sh64/sysv.lo: src/sh64/sysv.S
|
||||
$(LIBTOOL) --mode=compile $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS) -c -o src/sh64/sysv.lo `test -f 'src/sh64/sysv.S' || echo '$(srcdir)/'`src/sh64/sysv.S
|
||||
|
||||
src/pa/linux.o: src/pa/linux.S
|
||||
$(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS) -c -o src/pa/linux.o `test -f 'src/pa/linux.S' || echo '$(srcdir)/'`src/pa/linux.S
|
||||
|
||||
src/pa/linux.obj: src/pa/linux.S
|
||||
$(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS) -c -o src/pa/linux.obj `if test -f 'src/pa/linux.S'; then $(CYGPATH_W) 'src/pa/linux.S'; else $(CYGPATH_W) '$(srcdir)/src/pa/linux.S'; fi`
|
||||
|
||||
src/pa/linux.lo: src/pa/linux.S
|
||||
$(LIBTOOL) --mode=compile $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS) -c -o src/pa/linux.lo `test -f 'src/pa/linux.S' || echo '$(srcdir)/'`src/pa/linux.S
|
||||
|
||||
.c.o:
|
||||
$(COMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
|
||||
|
||||
@ -988,6 +1011,15 @@ src/sh64/ffi.obj: src/sh64/ffi.c
|
||||
src/sh64/ffi.lo: src/sh64/ffi.c
|
||||
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/sh64/ffi.lo `test -f 'src/sh64/ffi.c' || echo '$(srcdir)/'`src/sh64/ffi.c
|
||||
|
||||
src/pa/ffi.o: src/pa/ffi.c
|
||||
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/pa/ffi.o `test -f 'src/pa/ffi.c' || echo '$(srcdir)/'`src/pa/ffi.c
|
||||
|
||||
src/pa/ffi.obj: src/pa/ffi.c
|
||||
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/pa/ffi.obj `if test -f 'src/pa/ffi.c'; then $(CYGPATH_W) 'src/pa/ffi.c'; else $(CYGPATH_W) '$(srcdir)/src/pa/ffi.c'; fi`
|
||||
|
||||
src/pa/ffi.lo: src/pa/ffi.c
|
||||
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/pa/ffi.lo `test -f 'src/pa/ffi.c' || echo '$(srcdir)/'`src/pa/ffi.c
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
@ -999,6 +1031,7 @@ clean-libtool:
|
||||
-rm -rf src/ia64/.libs src/ia64/_libs
|
||||
-rm -rf src/m68k/.libs src/m68k/_libs
|
||||
-rm -rf src/mips/.libs src/mips/_libs
|
||||
-rm -rf src/pa/.libs src/pa/_libs
|
||||
-rm -rf src/powerpc/.libs src/powerpc/_libs
|
||||
-rm -rf src/s390/.libs src/s390/_libs
|
||||
-rm -rf src/sh/.libs src/sh/_libs
|
||||
@ -1164,7 +1197,7 @@ distcleancheck_listfiles = find . -type f -print
|
||||
distdir: $(DISTFILES)
|
||||
$(am__remove_distdir)
|
||||
mkdir $(distdir)
|
||||
$(mkinstalldirs) $(distdir)/.. $(distdir)/include $(distdir)/src/alpha $(distdir)/src/arm $(distdir)/src/m68k $(distdir)/src/mips $(distdir)/src/powerpc $(distdir)/src/s390 $(distdir)/src/sh $(distdir)/src/sh64 $(distdir)/src/sparc $(distdir)/src/x86
|
||||
$(mkinstalldirs) $(distdir)/.. $(distdir)/include $(distdir)/src/alpha $(distdir)/src/arm $(distdir)/src/m68k $(distdir)/src/mips $(distdir)/src/pa $(distdir)/src/powerpc $(distdir)/src/s390 $(distdir)/src/sh $(distdir)/src/sh64 $(distdir)/src/sparc $(distdir)/src/x86
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
@ -1307,6 +1340,7 @@ distclean-generic:
|
||||
-rm -f src/sh/$(am__dirstamp)
|
||||
-rm -f src/m68k/$(am__dirstamp)
|
||||
-rm -f src/sparc/$(am__dirstamp)
|
||||
-rm -f src/pa/$(am__dirstamp)
|
||||
-rm -f src/$(am__dirstamp)
|
||||
-rm -f src/ia64/$(am__dirstamp)
|
||||
-rm -f src/alpha/$(am__dirstamp)
|
||||
|
94
libffi/configure
vendored
94
libffi/configure
vendored
@ -273,7 +273,7 @@ PACKAGE_VERSION='2.1'
|
||||
PACKAGE_STRING='libffi 2.1'
|
||||
PACKAGE_BUGREPORT='http://gcc.gnu.org/bugs.html'
|
||||
|
||||
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS multi_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE am__leading_dot CC ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CFLAGS CCAS CCASFLAGS LN_S RANLIB ac_ct_RANLIB LIBTOOL MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT TESTSUBDIR_TRUE TESTSUBDIR_FALSE AM_RUNTESTFLAGS MIPS_IRIX_TRUE MIPS_IRIX_FALSE MIPS_LINUX_TRUE MIPS_LINUX_FALSE SPARC_TRUE SPARC_FALSE X86_TRUE X86_FALSE X86_WIN32_TRUE X86_WIN32_FALSE ALPHA_TRUE ALPHA_FALSE IA64_TRUE IA64_FALSE M68K_TRUE M68K_FALSE POWERPC_TRUE POWERPC_FALSE POWERPC_AIX_TRUE POWERPC_AIX_FALSE POWERPC_DARWIN_TRUE POWERPC_DARWIN_FALSE ARM_TRUE ARM_FALSE S390_TRUE S390_FALSE X86_64_TRUE X86_64_FALSE SH_TRUE SH_FALSE SH64_TRUE SH64_FALSE CPP CPPFLAGS EGREP ALLOCA HAVE_LONG_DOUBLE TARGET TARGETDIR toolexecdir toolexeclibdir tool_include_dir gcc_version LIBOBJS LTLIBOBJS'
|
||||
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS multi_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE am__leading_dot CC ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CFLAGS CCAS CCASFLAGS LN_S RANLIB ac_ct_RANLIB LIBTOOL MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT TESTSUBDIR_TRUE TESTSUBDIR_FALSE AM_RUNTESTFLAGS MIPS_IRIX_TRUE MIPS_IRIX_FALSE MIPS_LINUX_TRUE MIPS_LINUX_FALSE SPARC_TRUE SPARC_FALSE X86_TRUE X86_FALSE X86_WIN32_TRUE X86_WIN32_FALSE ALPHA_TRUE ALPHA_FALSE IA64_TRUE IA64_FALSE M68K_TRUE M68K_FALSE POWERPC_TRUE POWERPC_FALSE POWERPC_AIX_TRUE POWERPC_AIX_FALSE POWERPC_DARWIN_TRUE POWERPC_DARWIN_FALSE ARM_TRUE ARM_FALSE S390_TRUE S390_FALSE X86_64_TRUE X86_64_FALSE SH_TRUE SH_FALSE SH64_TRUE SH64_FALSE PA_TRUE PA_FALSE CPP CPPFLAGS EGREP ALLOCA HAVE_LONG_DOUBLE TARGET TARGETDIR toolexecdir toolexeclibdir tool_include_dir gcc_version LIBOBJS LTLIBOBJS'
|
||||
ac_subst_files=''
|
||||
|
||||
# Initialize some variables set by options.
|
||||
@ -925,7 +925,7 @@ esac
|
||||
else
|
||||
echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
|
||||
fi
|
||||
cd $ac_popdir
|
||||
cd "$ac_popdir"
|
||||
done
|
||||
fi
|
||||
|
||||
@ -2409,8 +2409,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
@ -2468,8 +2467,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
@ -2585,8 +2583,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
@ -2640,8 +2637,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
@ -2686,8 +2682,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
@ -2731,8 +2726,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
@ -3794,7 +3788,7 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
|
||||
case $host in
|
||||
*-*-irix6*)
|
||||
# Find out which ABI we are using.
|
||||
echo '#line 3797 "configure"' > conftest.$ac_ext
|
||||
echo '#line 3791 "configure"' > conftest.$ac_ext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
(eval $ac_compile) 2>&5
|
||||
ac_status=$?
|
||||
@ -3936,8 +3930,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
@ -4193,8 +4186,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
@ -4309,6 +4301,7 @@ s390x-*-linux-*) TARGET=S390; TARGETDIR=s390;;
|
||||
x86_64-*-linux*) TARGET=X86_64; TARGETDIR=x86;;
|
||||
sh-*-linux* | sh[34]*-*-linux*) TARGET=SH; TARGETDIR=sh;;
|
||||
sh64-*-linux* | sh5*-*-linux*) TARGET=SH64; TARGETDIR=sh64;;
|
||||
hppa-*-linux* | parisc-*-linux*) TARGET=PA; TARGETDIR=pa;;
|
||||
esac
|
||||
|
||||
|
||||
@ -4480,6 +4473,16 @@ else
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if test x$TARGET = xPA; then
|
||||
PA_TRUE=
|
||||
PA_FALSE='#'
|
||||
else
|
||||
PA_TRUE='#'
|
||||
PA_FALSE=
|
||||
fi
|
||||
|
||||
|
||||
case x$TARGET in
|
||||
xMIPS*) TARGET=MIPS ;;
|
||||
*) ;;
|
||||
@ -4768,8 +4771,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
@ -4970,8 +4972,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
@ -5034,8 +5035,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
@ -5116,8 +5116,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
@ -5258,8 +5257,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
@ -5396,8 +5394,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
@ -5467,8 +5464,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
@ -5555,8 +5551,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
@ -5597,8 +5592,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
@ -5766,8 +5760,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
@ -5833,8 +5826,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
@ -6233,6 +6225,13 @@ echo "$as_me: error: conditional \"SH64\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
if test -z "${PA_TRUE}" && test -z "${PA_FALSE}"; then
|
||||
{ { echo "$as_me:$LINENO: error: conditional \"PA\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." >&5
|
||||
echo "$as_me: error: conditional \"PA\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
|
||||
: ${CONFIG_STATUS=./config.status}
|
||||
ac_clean_files_save=$ac_clean_files
|
||||
@ -6878,6 +6877,8 @@ s,@SH_TRUE@,$SH_TRUE,;t t
|
||||
s,@SH_FALSE@,$SH_FALSE,;t t
|
||||
s,@SH64_TRUE@,$SH64_TRUE,;t t
|
||||
s,@SH64_FALSE@,$SH64_FALSE,;t t
|
||||
s,@PA_TRUE@,$PA_TRUE,;t t
|
||||
s,@PA_FALSE@,$PA_FALSE,;t t
|
||||
s,@CPP@,$CPP,;t t
|
||||
s,@CPPFLAGS@,$CPPFLAGS,;t t
|
||||
s,@EGREP@,$EGREP,;t t
|
||||
@ -7057,11 +7058,6 @@ esac
|
||||
*) ac_INSTALL=$ac_top_builddir$INSTALL ;;
|
||||
esac
|
||||
|
||||
if test x"$ac_file" != x-; then
|
||||
{ echo "$as_me:$LINENO: creating $ac_file" >&5
|
||||
echo "$as_me: creating $ac_file" >&6;}
|
||||
rm -f "$ac_file"
|
||||
fi
|
||||
# Let's still pretend it is `configure' which instantiates (i.e., don't
|
||||
# use $as_me), people would be surprised to read:
|
||||
# /* config.h. Generated by config.status. */
|
||||
@ -7100,6 +7096,12 @@ echo "$as_me: error: cannot find input file: $f" >&2;}
|
||||
fi;;
|
||||
esac
|
||||
done` || { (exit 1); exit 1; }
|
||||
|
||||
if test x"$ac_file" != x-; then
|
||||
{ echo "$as_me:$LINENO: creating $ac_file" >&5
|
||||
echo "$as_me: creating $ac_file" >&6;}
|
||||
rm -f "$ac_file"
|
||||
fi
|
||||
_ACEOF
|
||||
cat >>$CONFIG_STATUS <<_ACEOF
|
||||
sed "$ac_vpsub
|
||||
|
@ -74,6 +74,7 @@ s390x-*-linux-*) TARGET=S390; TARGETDIR=s390;;
|
||||
x86_64-*-linux*) TARGET=X86_64; TARGETDIR=x86;;
|
||||
sh-*-linux* | sh[[34]]*-*-linux*) TARGET=SH; TARGETDIR=sh;;
|
||||
sh64-*-linux* | sh5*-*-linux*) TARGET=SH64; TARGETDIR=sh64;;
|
||||
hppa-*-linux* | parisc-*-linux*) TARGET=PA; TARGETDIR=pa;;
|
||||
esac
|
||||
|
||||
AC_SUBST(AM_RUNTESTFLAGS)
|
||||
@ -98,6 +99,7 @@ AM_CONDITIONAL(S390, test x$TARGET = xS390)
|
||||
AM_CONDITIONAL(X86_64, test x$TARGET = xX86_64)
|
||||
AM_CONDITIONAL(SH, test x$TARGET = xSH)
|
||||
AM_CONDITIONAL(SH64, test x$TARGET = xSH64)
|
||||
AM_CONDITIONAL(PA, test x$TARGET = xPA)
|
||||
|
||||
case x$TARGET in
|
||||
xMIPS*) TARGET=MIPS ;;
|
||||
|
@ -97,6 +97,8 @@ PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PA_FALSE = @PA_FALSE@
|
||||
PA_TRUE = @PA_TRUE@
|
||||
POWERPC_AIX_FALSE = @POWERPC_AIX_FALSE@
|
||||
POWERPC_AIX_TRUE = @POWERPC_AIX_TRUE@
|
||||
POWERPC_DARWIN_FALSE = @POWERPC_DARWIN_FALSE@
|
||||
|
603
libffi/src/pa/ffi.c
Normal file
603
libffi/src/pa/ffi.c
Normal file
@ -0,0 +1,603 @@
|
||||
/* -----------------------------------------------------------------------
|
||||
ffi.c - (c) 2003-2004 Randolph Chung <tausq@debian.org>
|
||||
|
||||
HPPA Foreign Function Interface
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
``Software''), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
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>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define ROUND_UP(v, a) (((size_t)(v) + (a) - 1) & ~((a) - 1))
|
||||
#define ROUND_DOWN(v, a) (((size_t)(v) - (a) + 1) & ~((a) - 1))
|
||||
#define MIN_STACK_SIZE 64
|
||||
#define FIRST_ARG_SLOT 9
|
||||
#define DEBUG_LEVEL 0
|
||||
|
||||
#define fldw(addr, fpreg) asm volatile ("fldw 0(%0), %%" #fpreg "L" : : "r"(addr) : #fpreg)
|
||||
#define fstw(fpreg, addr) asm volatile ("fstw %%" #fpreg "L, 0(%0)" : : "r"(addr))
|
||||
#define fldd(addr, fpreg) asm volatile ("fldd 0(%0), %%" #fpreg : : "r"(addr) : #fpreg)
|
||||
#define fstd(fpreg, addr) asm volatile ("fstd %%" #fpreg "L, 0(%0)" : : "r"(addr))
|
||||
|
||||
#define debug(lvl, x...) do { if (lvl <= DEBUG_LEVEL) { printf(x); } } while (0)
|
||||
|
||||
static inline int ffi_struct_type(ffi_type *t)
|
||||
{
|
||||
size_t sz = t->size;
|
||||
|
||||
/* Small structure results are passed in registers,
|
||||
larger ones are passed by pointer. */
|
||||
|
||||
if (sz <= 1)
|
||||
return FFI_TYPE_UINT8;
|
||||
else if (sz == 2)
|
||||
return FFI_TYPE_UINT16;
|
||||
else if (sz == 3)
|
||||
return FFI_TYPE_SMALL_STRUCT1;
|
||||
else if (sz == 4)
|
||||
return FFI_TYPE_UINT32;
|
||||
else if (sz <= 6)
|
||||
return FFI_TYPE_SMALL_STRUCT2;
|
||||
else if (sz <= 8)
|
||||
return FFI_TYPE_UINT64;
|
||||
else
|
||||
return FFI_TYPE_STRUCT; /* else, we pass it by pointer. */
|
||||
}
|
||||
|
||||
/* PA has a downward growing stack, which looks like this:
|
||||
|
||||
Offset
|
||||
[ Variable args ]
|
||||
SP = (4*(n+9)) arg word N
|
||||
...
|
||||
SP-52 arg word 4
|
||||
[ Fixed args ]
|
||||
SP-48 arg word 3
|
||||
SP-44 arg word 2
|
||||
SP-40 arg word 1
|
||||
SP-36 arg word 0
|
||||
[ Frame marker ]
|
||||
...
|
||||
SP-20 RP
|
||||
SP-4 previous SP
|
||||
|
||||
First 4 non-FP 32-bit args are passed in gr26, gr25, gr24 and gr23
|
||||
First 2 non-FP 64-bit args are passed in register pairs, starting
|
||||
on an even numbered register (i.e. r26/r25 and r24+r23)
|
||||
First 4 FP 32-bit arguments are passed in fr4L, fr5L, fr6L and fr7L
|
||||
First 2 FP 64-bit arguments are passed in fr5 and fr7
|
||||
The rest are passed on the stack starting at SP-52, but 64-bit
|
||||
arguments need to be aligned to an 8-byte boundary
|
||||
|
||||
This means we can have holes either in the register allocation,
|
||||
or in the stack. */
|
||||
|
||||
/* ffi_prep_args is called by the assembly routine once stack space
|
||||
has been allocated for the function's arguments
|
||||
|
||||
The following code will put everything into the stack frame
|
||||
(which was allocated by the asm routine), and on return
|
||||
the asm routine will load the arguments that should be
|
||||
passed by register into the appropriate registers
|
||||
|
||||
NOTE: We load floating point args in this function... that means we
|
||||
assume gcc will not mess with fp regs in here. */
|
||||
|
||||
/*@-exportheader@*/
|
||||
void ffi_prep_args_LINUX(UINT32 *stack, extended_cif *ecif, unsigned bytes)
|
||||
/*@=exportheader@*/
|
||||
{
|
||||
register unsigned int i;
|
||||
register ffi_type **p_arg;
|
||||
register void **p_argv;
|
||||
unsigned int slot = FIRST_ARG_SLOT - 1;
|
||||
char *dest_cpy;
|
||||
|
||||
debug(1, "%s: stack = %p, ecif = %p, bytes = %u\n", __FUNCTION__, stack, ecif, bytes);
|
||||
|
||||
p_arg = ecif->cif->arg_types;
|
||||
p_argv = ecif->avalue;
|
||||
|
||||
for (i = 0; i < ecif->cif->nargs; i++)
|
||||
{
|
||||
int type = (*p_arg)->type;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case FFI_TYPE_SINT8:
|
||||
slot++;
|
||||
*(SINT32 *)(stack - slot) = *(SINT8 *)(*p_argv);
|
||||
break;
|
||||
|
||||
case FFI_TYPE_UINT8:
|
||||
slot++;
|
||||
*(UINT32 *)(stack - slot) = *(UINT8 *)(*p_argv);
|
||||
break;
|
||||
|
||||
case FFI_TYPE_SINT16:
|
||||
slot++;
|
||||
*(SINT32 *)(stack - slot) = *(SINT16 *)(*p_argv);
|
||||
break;
|
||||
|
||||
case FFI_TYPE_UINT16:
|
||||
slot++;
|
||||
*(UINT32 *)(stack - slot) = *(UINT16 *)(*p_argv);
|
||||
break;
|
||||
|
||||
case FFI_TYPE_UINT32:
|
||||
case FFI_TYPE_SINT32:
|
||||
case FFI_TYPE_POINTER:
|
||||
slot++;
|
||||
debug(3, "Storing UINT32 %u in slot %u\n", *(UINT32 *)(*p_argv), slot);
|
||||
*(UINT32 *)(stack - slot) = *(UINT32 *)(*p_argv);
|
||||
break;
|
||||
|
||||
case FFI_TYPE_UINT64:
|
||||
case FFI_TYPE_SINT64:
|
||||
slot += 2;
|
||||
if (slot & 1)
|
||||
slot++;
|
||||
|
||||
*(UINT32 *)(stack - slot) = (*(UINT64 *)(*p_argv)) >> 32;
|
||||
*(UINT32 *)(stack - slot + 1) = (*(UINT64 *)(*p_argv)) & 0xffffffffUL;
|
||||
break;
|
||||
|
||||
case FFI_TYPE_FLOAT:
|
||||
/* First 4 args go in fr4L - fr7L */
|
||||
slot++;
|
||||
switch (slot - FIRST_ARG_SLOT)
|
||||
{
|
||||
case 0: fldw(*p_argv, fr4); break;
|
||||
case 1: fldw(*p_argv, fr5); break;
|
||||
case 2: fldw(*p_argv, fr6); break;
|
||||
case 3: fldw(*p_argv, fr7); break;
|
||||
default:
|
||||
/* Other ones are just passed on the stack. */
|
||||
debug(3, "Storing UINT32(float) in slot %u\n", slot);
|
||||
*(UINT32 *)(stack - slot) = *(UINT32 *)(*p_argv);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case FFI_TYPE_DOUBLE:
|
||||
slot += 2;
|
||||
if (slot & 1)
|
||||
slot++;
|
||||
switch (slot - FIRST_ARG_SLOT + 1)
|
||||
{
|
||||
/* First 2 args go in fr5, fr7 */
|
||||
case 2: fldd(*p_argv, fr5); break;
|
||||
case 4: fldd(*p_argv, fr7); break;
|
||||
default:
|
||||
debug(3, "Storing UINT64(double) at slot %u\n", slot);
|
||||
*(UINT64 *)(stack - slot) = *(UINT64 *)(*p_argv);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case FFI_TYPE_STRUCT:
|
||||
|
||||
/* Structs smaller or equal than 4 bytes are passed in one
|
||||
register. Structs smaller or equal 8 bytes are passed in two
|
||||
registers. Larger structures are passed by pointer. */
|
||||
|
||||
if((*p_arg)->size <= 4)
|
||||
{
|
||||
slot++;
|
||||
dest_cpy = (char *)(stack - slot);
|
||||
dest_cpy += 4 - (*p_arg)->size;
|
||||
memcpy((char *)dest_cpy, (char *)*p_argv, (*p_arg)->size);
|
||||
}
|
||||
else if ((*p_arg)->size <= 8)
|
||||
{
|
||||
slot += 2;
|
||||
if (slot & 1)
|
||||
slot++;
|
||||
dest_cpy = (char *)(stack - slot);
|
||||
dest_cpy += 8 - (*p_arg)->size;
|
||||
memcpy((char *)dest_cpy, (char *)*p_argv, (*p_arg)->size);
|
||||
}
|
||||
else
|
||||
{
|
||||
slot++;
|
||||
*(UINT32 *)(stack - slot) = (UINT32)(*p_argv);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
FFI_ASSERT(0);
|
||||
}
|
||||
|
||||
p_arg++;
|
||||
p_argv++;
|
||||
}
|
||||
|
||||
/* Make sure we didn't mess up and scribble on the stack. */
|
||||
{
|
||||
int n;
|
||||
|
||||
debug(5, "Stack setup:\n");
|
||||
for (n = 0; n < (bytes + 3) / 4; n++)
|
||||
{
|
||||
if ((n%4) == 0) { debug(5, "\n%08x: ", (unsigned int)(stack - n)); }
|
||||
debug(5, "%08x ", *(stack - n));
|
||||
}
|
||||
debug(5, "\n");
|
||||
}
|
||||
|
||||
FFI_ASSERT(slot * 4 <= bytes);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void ffi_size_stack_LINUX(ffi_cif *cif)
|
||||
{
|
||||
ffi_type **ptr;
|
||||
int i;
|
||||
int z = 0; /* # stack slots */
|
||||
|
||||
for (ptr = cif->arg_types, i = 0; i < cif->nargs; ptr++, i++)
|
||||
{
|
||||
int type = (*ptr)->type;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case FFI_TYPE_DOUBLE:
|
||||
case FFI_TYPE_UINT64:
|
||||
case FFI_TYPE_SINT64:
|
||||
z += 2 + (z & 1); /* must start on even regs, so we may waste one */
|
||||
break;
|
||||
|
||||
case FFI_TYPE_STRUCT:
|
||||
z += 1; /* pass by ptr, callee will copy */
|
||||
break;
|
||||
|
||||
default: /* <= 32-bit values */
|
||||
z++;
|
||||
}
|
||||
}
|
||||
|
||||
/* We can fit up to 6 args in the default 64-byte stack frame,
|
||||
if we need more, we need more stack. */
|
||||
if (z <= 6)
|
||||
cif->bytes = MIN_STACK_SIZE; /* min stack size */
|
||||
else
|
||||
cif->bytes = 64 + ROUND_UP((z - 6) * sizeof(UINT32), MIN_STACK_SIZE);
|
||||
|
||||
debug(3, "Calculated stack size is %u bytes\n", cif->bytes);
|
||||
}
|
||||
|
||||
/* Perform machine dependent cif processing. */
|
||||
ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
|
||||
{
|
||||
/* Set the return type flag */
|
||||
switch (cif->rtype->type)
|
||||
{
|
||||
case FFI_TYPE_VOID:
|
||||
case FFI_TYPE_FLOAT:
|
||||
case FFI_TYPE_DOUBLE:
|
||||
cif->flags = (unsigned) cif->rtype->type;
|
||||
break;
|
||||
|
||||
case FFI_TYPE_STRUCT:
|
||||
/* For the return type we have to check the size of the structures.
|
||||
If the size is smaller or equal 4 bytes, the result is given back
|
||||
in one register. If the size is smaller or equal 8 bytes than we
|
||||
return the result in two registers. But if the size is bigger than
|
||||
8 bytes, we work with pointers. */
|
||||
cif->flags = ffi_struct_type(cif->rtype);
|
||||
break;
|
||||
|
||||
case FFI_TYPE_UINT64:
|
||||
case FFI_TYPE_SINT64:
|
||||
cif->flags = FFI_TYPE_UINT64;
|
||||
break;
|
||||
|
||||
default:
|
||||
cif->flags = FFI_TYPE_INT;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Lucky us, because of the unique PA ABI we get to do our
|
||||
own stack sizing. */
|
||||
switch (cif->abi)
|
||||
{
|
||||
case FFI_LINUX:
|
||||
ffi_size_stack_LINUX(cif);
|
||||
break;
|
||||
|
||||
default:
|
||||
FFI_ASSERT(0);
|
||||
break;
|
||||
}
|
||||
|
||||
return FFI_OK;
|
||||
}
|
||||
|
||||
/*@-declundef@*/
|
||||
/*@-exportheader@*/
|
||||
extern void ffi_call_LINUX(void (*)(UINT32 *, extended_cif *, unsigned),
|
||||
/*@out@*/ extended_cif *,
|
||||
unsigned, unsigned,
|
||||
/*@out@*/ unsigned *,
|
||||
void (*fn)());
|
||||
/*@=declundef@*/
|
||||
/*@=exportheader@*/
|
||||
|
||||
void ffi_call(/*@dependent@*/ ffi_cif *cif,
|
||||
void (*fn)(),
|
||||
/*@out@*/ void *rvalue,
|
||||
/*@dependent@*/ void **avalue)
|
||||
{
|
||||
extended_cif ecif;
|
||||
|
||||
ecif.cif = cif;
|
||||
ecif.avalue = avalue;
|
||||
|
||||
/* If the return value is a struct and we don't have a return
|
||||
value address then we need to make one. */
|
||||
|
||||
if ((rvalue == NULL) &&
|
||||
(cif->rtype->type == FFI_TYPE_STRUCT))
|
||||
{
|
||||
/*@-sysunrecog@*/
|
||||
ecif.rvalue = alloca(cif->rtype->size);
|
||||
/*@=sysunrecog@*/
|
||||
}
|
||||
else
|
||||
ecif.rvalue = rvalue;
|
||||
|
||||
|
||||
switch (cif->abi)
|
||||
{
|
||||
case FFI_LINUX:
|
||||
/*@-usedef@*/
|
||||
debug(2, "Calling ffi_call_LINUX: ecif=%p, bytes=%u, flags=%u, rvalue=%p, fn=%p\n", &ecif, cif->bytes, cif->flags, ecif.rvalue, (void *)fn);
|
||||
ffi_call_LINUX(ffi_prep_args_LINUX, &ecif, cif->bytes,
|
||||
cif->flags, ecif.rvalue, fn);
|
||||
/*@=usedef@*/
|
||||
break;
|
||||
|
||||
default:
|
||||
FFI_ASSERT(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#if FFI_CLOSURES
|
||||
/* This is more-or-less an inverse of ffi_call -- we have arguments on
|
||||
the stack, and we need to fill them into a cif structure and invoke
|
||||
the user function. This really ought to be in asm to make sure
|
||||
the compiler doesn't do things we don't expect. */
|
||||
UINT32 ffi_closure_inner_LINUX(ffi_closure *closure, UINT32 *stack)
|
||||
{
|
||||
ffi_cif *cif;
|
||||
void **avalue;
|
||||
void *rvalue;
|
||||
UINT32 ret[2]; /* function can return up to 64-bits in registers */
|
||||
ffi_type **p_arg;
|
||||
char *tmp;
|
||||
int i, avn, slot = FIRST_ARG_SLOT - 1;
|
||||
register UINT32 r28 asm("r28");
|
||||
|
||||
cif = closure->cif;
|
||||
|
||||
/* If returning via structure, callee will write to our pointer. */
|
||||
if (cif->flags == FFI_TYPE_STRUCT)
|
||||
rvalue = (void *)r28;
|
||||
else
|
||||
rvalue = &ret[0];
|
||||
|
||||
avalue = (void **)alloca(cif->nargs * FFI_SIZEOF_ARG);
|
||||
avn = cif->nargs;
|
||||
p_arg = cif->arg_types;
|
||||
|
||||
for (i = 0; i < avn; i++)
|
||||
{
|
||||
int type = (*p_arg)->type;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case FFI_TYPE_SINT8:
|
||||
case FFI_TYPE_UINT8:
|
||||
case FFI_TYPE_SINT16:
|
||||
case FFI_TYPE_UINT16:
|
||||
case FFI_TYPE_SINT32:
|
||||
case FFI_TYPE_UINT32:
|
||||
case FFI_TYPE_POINTER:
|
||||
slot++;
|
||||
avalue[i] = (char *)(stack - slot) + sizeof(UINT32) - (*p_arg)->size;
|
||||
break;
|
||||
|
||||
case FFI_TYPE_SINT64:
|
||||
case FFI_TYPE_UINT64:
|
||||
slot += 2;
|
||||
if (slot & 1)
|
||||
slot++;
|
||||
avalue[i] = (void *)(stack - slot);
|
||||
break;
|
||||
|
||||
case FFI_TYPE_FLOAT:
|
||||
slot++;
|
||||
switch (slot - FIRST_ARG_SLOT)
|
||||
{
|
||||
case 0: fstw(fr4, (void *)(stack - slot)); break;
|
||||
case 1: fstw(fr5, (void *)(stack - slot)); break;
|
||||
case 2: fstw(fr6, (void *)(stack - slot)); break;
|
||||
case 3: fstw(fr7, (void *)(stack - slot)); break;
|
||||
}
|
||||
avalue[i] = (void *)(stack - slot);
|
||||
break;
|
||||
|
||||
case FFI_TYPE_DOUBLE:
|
||||
slot += 2;
|
||||
if (slot & 1)
|
||||
slot++;
|
||||
switch (slot - FIRST_ARG_SLOT + 1)
|
||||
{
|
||||
case 2: fstd(fr5, (void *)(stack - slot)); break;
|
||||
case 4: fstd(fr7, (void *)(stack - slot)); break;
|
||||
}
|
||||
avalue[i] = (void *)(stack - slot);
|
||||
break;
|
||||
|
||||
case FFI_TYPE_STRUCT:
|
||||
/* Structs smaller or equal than 4 bytes are passed in one
|
||||
register. Structs smaller or equal 8 bytes are passed in two
|
||||
registers. Larger structures are passed by pointer. */
|
||||
if((*p_arg)->size <= 4) {
|
||||
slot++;
|
||||
avalue[i] = (void *)(stack - slot) + sizeof(UINT32) -
|
||||
(*p_arg)->size;
|
||||
} else if ((*p_arg)->size <= 8) {
|
||||
slot += 2;
|
||||
if (slot & 1)
|
||||
slot++;
|
||||
avalue[i] = (void *)(stack - slot) + sizeof(UINT64) -
|
||||
(*p_arg)->size;
|
||||
} else {
|
||||
slot++;
|
||||
avalue[i] = (void *) *(stack - slot);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
FFI_ASSERT(0);
|
||||
}
|
||||
|
||||
p_arg++;
|
||||
}
|
||||
|
||||
/* Invoke the closure. */
|
||||
(closure->fun) (cif, rvalue, avalue, closure->user_data);
|
||||
|
||||
debug(3, "after calling function, ret[0] = %d, ret[1] = %d\n", ret[0], ret[1]);
|
||||
|
||||
/* Store the result */
|
||||
switch (cif->flags)
|
||||
{
|
||||
case FFI_TYPE_UINT8:
|
||||
*(stack - FIRST_ARG_SLOT) = *(UINT8 *)&ret[0];
|
||||
break;
|
||||
case FFI_TYPE_SINT8:
|
||||
*(stack - FIRST_ARG_SLOT) = *(SINT8 *)&ret[0];
|
||||
break;
|
||||
case FFI_TYPE_UINT16:
|
||||
*(stack - FIRST_ARG_SLOT) = *(UINT16 *)&ret[0];
|
||||
break;
|
||||
case FFI_TYPE_SINT16:
|
||||
*(stack - FIRST_ARG_SLOT) = *(SINT16 *)&ret[0];
|
||||
break;
|
||||
case FFI_TYPE_INT:
|
||||
case FFI_TYPE_UINT32:
|
||||
*(stack - FIRST_ARG_SLOT) = *(UINT32 *)&ret[0];
|
||||
break;
|
||||
case FFI_TYPE_SINT32:
|
||||
*(stack - FIRST_ARG_SLOT) = *(SINT32 *)&ret[0];
|
||||
break;
|
||||
case FFI_TYPE_SINT64:
|
||||
case FFI_TYPE_UINT64:
|
||||
*(stack - FIRST_ARG_SLOT) = *(UINT32 *)&ret[0];
|
||||
*(stack - FIRST_ARG_SLOT - 1) = *(UINT32 *)&ret[1];
|
||||
break;
|
||||
|
||||
case FFI_TYPE_DOUBLE:
|
||||
fldd(rvalue, fr4);
|
||||
break;
|
||||
|
||||
case FFI_TYPE_FLOAT:
|
||||
fldw(rvalue, fr4);
|
||||
break;
|
||||
|
||||
case FFI_TYPE_STRUCT:
|
||||
/* Don't need a return value, done by caller. */
|
||||
break;
|
||||
|
||||
case FFI_TYPE_SMALL_STRUCT1:
|
||||
tmp = (void*)(stack - FIRST_ARG_SLOT);
|
||||
tmp += 4 - cif->rtype->size;
|
||||
memcpy((void*)tmp, &ret[0], cif->rtype->size);
|
||||
break;
|
||||
|
||||
case FFI_TYPE_SMALL_STRUCT2:
|
||||
*(stack - FIRST_ARG_SLOT) = ret[0];
|
||||
*(stack - FIRST_ARG_SLOT - 1) = ret[1];
|
||||
break;
|
||||
|
||||
case FFI_TYPE_POINTER:
|
||||
case FFI_TYPE_VOID:
|
||||
break;
|
||||
|
||||
default:
|
||||
debug(0, "assert with cif->flags: %d\n",cif->flags);
|
||||
FFI_ASSERT(0);
|
||||
break;
|
||||
}
|
||||
return FFI_OK;
|
||||
}
|
||||
|
||||
/* Fill in a closure to refer to the specified fun and user_data.
|
||||
cif specifies the argument and result types for fun.
|
||||
The cif must already be prep'ed. */
|
||||
|
||||
void ffi_closure_LINUX(void);
|
||||
|
||||
ffi_status
|
||||
ffi_prep_closure (ffi_closure* closure,
|
||||
ffi_cif* cif,
|
||||
void (*fun)(ffi_cif*,void*,void**,void*),
|
||||
void *user_data)
|
||||
{
|
||||
UINT32 *tramp = (UINT32 *)(closure->tramp);
|
||||
|
||||
FFI_ASSERT (cif->abi == FFI_LINUX);
|
||||
|
||||
/* Make a small trampoline that will branch to our
|
||||
handler function. Use PC-relative addressing. */
|
||||
|
||||
tramp[0] = 0xeaa00000; /* b,l .+8, %r21 ; %r21 <- pc+8 */
|
||||
tramp[1] = 0xd6a01c1e; /* depi 0,31,2, %r21 ; mask priv bits */
|
||||
tramp[2] = 0x4aa10028; /* ldw 20(%r21), %r1 ; load plabel */
|
||||
tramp[3] = 0x36b53ff1; /* ldo -8(%r21), %r21 ; get closure addr */
|
||||
tramp[4] = 0x0c201096; /* ldw 0(%r1), %r22 ; address of handler */
|
||||
tramp[5] = 0xeac0c000; /* bv %r0(%r22) ; branch to handler */
|
||||
tramp[6] = 0x0c281093; /* ldw 4(%r1), %r19 ; GP of handler */
|
||||
tramp[7] = ((UINT32)(ffi_closure_LINUX) & ~2);
|
||||
|
||||
/* Flush d/icache -- have to flush up 2 two lines because of
|
||||
alignment. */
|
||||
asm volatile (
|
||||
"fdc 0(%0)\n"
|
||||
"fdc %1(%0)\n"
|
||||
"fic 0(%%sr4, %0)\n"
|
||||
"fic %1(%%sr4, %0)\n"
|
||||
"sync\n"
|
||||
: : "r"((unsigned long)tramp & ~31), "r"(32 /* stride */));
|
||||
|
||||
closure->cif = cif;
|
||||
closure->user_data = user_data;
|
||||
closure->fun = fun;
|
||||
|
||||
return FFI_OK;
|
||||
}
|
||||
#endif
|
57
libffi/src/pa/ffitarget.h
Normal file
57
libffi/src/pa/ffitarget.h
Normal file
@ -0,0 +1,57 @@
|
||||
/* -----------------------------------------------------------------*-C-*-
|
||||
ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc.
|
||||
Target configuration macros for hppa.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
``Software''), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
----------------------------------------------------------------------- */
|
||||
|
||||
#ifndef LIBFFI_TARGET_H
|
||||
#define LIBFFI_TARGET_H
|
||||
|
||||
/* ---- System specific configurations ----------------------------------- */
|
||||
|
||||
#ifndef LIBFFI_ASM
|
||||
typedef unsigned long ffi_arg;
|
||||
typedef signed long ffi_sarg;
|
||||
|
||||
typedef enum ffi_abi {
|
||||
FFI_FIRST_ABI = 0,
|
||||
|
||||
#ifdef PA
|
||||
FFI_LINUX,
|
||||
FFI_DEFAULT_ABI = FFI_LINUX,
|
||||
#endif
|
||||
|
||||
FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
|
||||
} ffi_abi;
|
||||
#endif
|
||||
|
||||
/* ---- Definitions for closures ----------------------------------------- */
|
||||
|
||||
#define FFI_CLOSURES 1
|
||||
#define FFI_NATIVE_RAW_API 0
|
||||
|
||||
#define FFI_TRAMPOLINE_SIZE 32
|
||||
|
||||
#define FFI_TYPE_SMALL_STRUCT1 -1
|
||||
#define FFI_TYPE_SMALL_STRUCT2 -2
|
||||
#endif
|
||||
|
281
libffi/src/pa/linux.S
Normal file
281
libffi/src/pa/linux.S
Normal file
@ -0,0 +1,281 @@
|
||||
/* -----------------------------------------------------------------------
|
||||
linux.S - (c) 2003-2004 Randolph Chung <tausq@debian.org>
|
||||
|
||||
HPPA Foreign Function Interface
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
``Software''), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
----------------------------------------------------------------------- */
|
||||
|
||||
#define LIBFFI_ASM
|
||||
#include <fficonfig.h>
|
||||
#include <ffi.h>
|
||||
|
||||
.text
|
||||
.align 4
|
||||
|
||||
/* void ffi_call_LINUX(void (*)(char *, extended_cif *),
|
||||
extended_cif *ecif,
|
||||
unsigned bytes,
|
||||
unsigned flags,
|
||||
unsigned *rvalue,
|
||||
void (*fn)());
|
||||
*/
|
||||
|
||||
.export ffi_call_LINUX,code
|
||||
.import ffi_prep_args_LINUX,code
|
||||
|
||||
.type ffi_call_LINUX, @function
|
||||
.LFB1:
|
||||
ffi_call_LINUX:
|
||||
.proc
|
||||
.callinfo FRAME=64,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=4
|
||||
.entry
|
||||
stw %rp, -20(%sp)
|
||||
copy %r3, %r1
|
||||
.LCFI11:
|
||||
|
||||
copy %sp, %r3
|
||||
.LCFI12:
|
||||
|
||||
/* Setup the stack for calling prep_args...
|
||||
We want the stack to look like this:
|
||||
|
||||
[ Previous stack ] <- %r3
|
||||
|
||||
[ 64-bytes register save area ] <- %r4
|
||||
|
||||
[ Stack space for actual call, passed as ] <- %arg0
|
||||
[ arg0 to ffi_prep_args_LINUX ]
|
||||
|
||||
[ Stack for calling prep_args ] <- %sp
|
||||
*/
|
||||
|
||||
stwm %r1, 64(%sp)
|
||||
stw %r4, 12(%r3)
|
||||
.LCFI13:
|
||||
copy %sp, %r4
|
||||
|
||||
addl %arg2, %r4, %arg0 /* arg stack */
|
||||
stw %arg3, -48(%r3) /* save flags; we need it later */
|
||||
|
||||
/* Call prep_args:
|
||||
%arg0(stack) -- set up above
|
||||
%arg1(ecif) -- same as incoming param
|
||||
%arg2(bytes) -- same as incoming param */
|
||||
bl ffi_prep_args_LINUX,%r2
|
||||
ldo 64(%arg0), %sp
|
||||
ldo -64(%sp), %sp
|
||||
|
||||
/* now %sp should point where %arg0 was pointing. */
|
||||
|
||||
/* Load the arguments that should be passed in registers */
|
||||
The fp args were loaded by the prep_args function. */
|
||||
ldw -36(%sp), %arg0
|
||||
ldw -40(%sp), %arg1
|
||||
ldw -44(%sp), %arg2
|
||||
ldw -48(%sp), %arg3
|
||||
|
||||
/* in case the function is going to return a structure
|
||||
we need to give it a place to put the result. */
|
||||
ldw -52(%r3), %ret0 /* %ret0 <- rvalue */
|
||||
ldw -56(%r3), %r22 /* %r22 <- function to call */
|
||||
bl $$dyncall, %r31 /* Call the user function */
|
||||
copy %r31, %rp
|
||||
|
||||
/* Prepare to store the result; we need to recover flags and rvalue. */
|
||||
ldw -48(%r3), %r21 /* r21 <- flags */
|
||||
ldw -52(%r3), %r20 /* r20 <- rvalue */
|
||||
|
||||
/* Store the result according to the return type. */
|
||||
|
||||
checksmst1:
|
||||
comib,<>,n FFI_TYPE_SMALL_STRUCT1, %r21, checksmst2
|
||||
/* There is maybe a better way to handle 3 byte structs. */
|
||||
sh2add %ret0,0,%ret0
|
||||
sh2add %ret0,0,%ret0
|
||||
sh2add %ret0,0,%ret0
|
||||
sh2add %ret0,0,%ret0
|
||||
b done
|
||||
stw %ret0, 0(%r20)
|
||||
|
||||
checksmst2:
|
||||
comib,<>,n FFI_TYPE_SMALL_STRUCT2, %r21, checkint8
|
||||
/* Up to now I don't have a way to handle 6/7 byte structs.
|
||||
The values are left bounded in the registers. In the struct
|
||||
itself they are left bounded. */
|
||||
stw %ret0, 0(%r20)
|
||||
b done
|
||||
stw %ret1, 4(%r20)
|
||||
|
||||
checkint8:
|
||||
comib,<>,n FFI_TYPE_UINT8, %r21, checkint16
|
||||
b done
|
||||
stb %ret0, 0(%r20)
|
||||
|
||||
checkint16:
|
||||
comib,<>,n FFI_TYPE_UINT16, %r21, checkint32
|
||||
b done
|
||||
sth %ret0, 0(%r20)
|
||||
|
||||
checkint32:
|
||||
comib,<>,n FFI_TYPE_UINT32, %r21, checkint
|
||||
b done
|
||||
stw %ret0, 0(%r20)
|
||||
|
||||
checkint:
|
||||
comib,<>,n FFI_TYPE_INT, %r21, checkll
|
||||
b done
|
||||
stw %ret0, 0(%r20)
|
||||
|
||||
checkll:
|
||||
comib,<>,n FFI_TYPE_UINT64, %r21, checkdbl
|
||||
stw %ret0, 0(%r20)
|
||||
b done
|
||||
stw %ret1, 4(%r20)
|
||||
|
||||
checkdbl:
|
||||
comib,<>,n FFI_TYPE_DOUBLE, %r21, checkfloat
|
||||
b done
|
||||
fstd %fr4,0(%r20)
|
||||
|
||||
checkfloat:
|
||||
comib,<>,n FFI_TYPE_FLOAT, %r21, done
|
||||
fstw %fr4L,0(%r20)
|
||||
|
||||
/* structure returns are either handled by one of the
|
||||
INT/UINT64 cases above, or, if passed by pointer,
|
||||
is handled by the callee. */
|
||||
|
||||
done:
|
||||
/* all done, return */
|
||||
copy %r4, %sp /* pop arg stack */
|
||||
ldw 12(%r3), %r4
|
||||
ldwm -64(%sp), %r3 /* .. and pop stack */
|
||||
ldw -20(%sp), %rp
|
||||
bv %r0(%rp)
|
||||
nop
|
||||
.exit
|
||||
.procend
|
||||
.LFE1:
|
||||
|
||||
/* void ffi_closure_LINUX(void);
|
||||
Called with closure argument in %r21 */
|
||||
.export ffi_closure_LINUX,code
|
||||
.import ffi_closure_inner_LINUX,code
|
||||
|
||||
.type ffi_closure_LINUX, @function
|
||||
.LFB2:
|
||||
ffi_closure_LINUX:
|
||||
.proc
|
||||
.callinfo FRAME=64,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=3
|
||||
.entry
|
||||
|
||||
stw %rp, -20(%sp)
|
||||
.LCFI20:
|
||||
copy %r3, %r1
|
||||
.LCFI21:
|
||||
copy %sp, %r3
|
||||
.LCFI22:
|
||||
stwm %r1, 64(%sp)
|
||||
|
||||
/* Put arguments onto the stack and call ffi_closure_inner. */
|
||||
stw %arg0, -36(%r3)
|
||||
stw %arg1, -40(%r3)
|
||||
stw %arg2, -44(%r3)
|
||||
stw %arg3, -48(%r3)
|
||||
|
||||
copy %r21, %arg0
|
||||
bl ffi_closure_inner_LINUX, %r2
|
||||
copy %r3, %arg1
|
||||
|
||||
ldwm -64(%sp), %r3
|
||||
ldw -20(%sp), %rp
|
||||
ldw -36(%sp), %ret0
|
||||
bv %r0(%r2)
|
||||
ldw -40(%sp), %ret1
|
||||
|
||||
.exit
|
||||
.procend
|
||||
.LFE2:
|
||||
|
||||
.section ".eh_frame",EH_FRAME_FLAGS,@progbits
|
||||
.Lframe1:
|
||||
.word .LECIE1-.LSCIE1 ;# Length of Common Information Entry
|
||||
.LSCIE1:
|
||||
.word 0x0 ;# CIE Identifier Tag
|
||||
.byte 0x1 ;# CIE Version
|
||||
.ascii "\0" ;# CIE Augmentation
|
||||
.uleb128 0x1 ;# CIE Code Alignment Factor
|
||||
.sleb128 4 ;# CIE Data Alignment Factor
|
||||
.byte 0x2 ;# CIE RA Column
|
||||
.byte 0xc ;# DW_CFA_def_cfa
|
||||
.uleb128 0x1e
|
||||
.uleb128 0x0
|
||||
.align 4
|
||||
.LECIE1:
|
||||
.LSFDE1:
|
||||
.word .LEFDE1-.LASFDE1 ;# FDE Length
|
||||
.LASFDE1:
|
||||
.word .LASFDE1-.Lframe1 ;# FDE CIE offset
|
||||
.word .LFB1 ;# FDE initial location
|
||||
.word .LFE1-.LFB1 ;# FDE address range
|
||||
|
||||
.byte 0x4 ;# DW_CFA_advance_loc4
|
||||
.word .LCFI11-.LFB1
|
||||
.byte 0x83 ;# DW_CFA_offset, column 0x3
|
||||
.uleb128 0x0
|
||||
.byte 0x11 ;# DW_CFA_offset_extended_sf; save r2 at [r30-20]
|
||||
.uleb128 0x2
|
||||
.sleb128 -5
|
||||
|
||||
.byte 0x4 ;# DW_CFA_advance_loc4
|
||||
.word .LCFI12-.LCFI11
|
||||
.byte 0xd ;# DW_CFA_def_cfa_register = r3
|
||||
.uleb128 0x3
|
||||
|
||||
.byte 0x4 ;# DW_CFA_advance_loc4
|
||||
.word .LCFI13-.LCFI12
|
||||
.byte 0x84 ;# DW_CFA_offset, column 0x4
|
||||
.uleb128 0x3
|
||||
|
||||
.align 4
|
||||
.LEFDE1:
|
||||
|
||||
.LSFDE2:
|
||||
.word .LEFDE2-.LASFDE2 ;# FDE Length
|
||||
.LASFDE2:
|
||||
.word .LASFDE2-.Lframe1 ;# FDE CIE offset
|
||||
.word .LFB2 ;# FDE initial location
|
||||
.word .LFE2-.LFB2 ;# FDE address range
|
||||
.byte 0x4 ;# DW_CFA_advance_loc4
|
||||
.word .LCFI21-.LFB2
|
||||
.byte 0x83 ;# DW_CFA_offset, column 0x3
|
||||
.uleb128 0x0
|
||||
.byte 0x11 ;# DW_CFA_offset_extended_sf
|
||||
.uleb128 0x2
|
||||
.sleb128 -5
|
||||
|
||||
.byte 0x4 ;# DW_CFA_advance_loc4
|
||||
.word .LCFI12-.LCFI11
|
||||
.byte 0xd ;# DW_CFA_def_cfa_register = r3
|
||||
.uleb128 0x3
|
||||
|
||||
.align 4
|
||||
.LEFDE2:
|
@ -113,7 +113,7 @@ ffi_status ffi_prep_cif(/*@out@*/ /*@partial@*/ ffi_cif *cif,
|
||||
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
|
||||
#if !defined M68K && !defined __x86_64__ && !defined S390 && !defined PA
|
||||
/* Make space for the return structure pointer */
|
||||
if (cif->rtype->type == FFI_TYPE_STRUCT
|
||||
#ifdef SPARC
|
||||
@ -134,7 +134,7 @@ ffi_status ffi_prep_cif(/*@out@*/ /*@partial@*/ ffi_cif *cif,
|
||||
check after the initialization. */
|
||||
FFI_ASSERT_VALID_TYPE(*ptr);
|
||||
|
||||
#if !defined __x86_64__ && !defined S390
|
||||
#if !defined __x86_64__ && !defined S390 && !defined PA
|
||||
#ifdef SPARC
|
||||
if (((*ptr)->type == FFI_TYPE_STRUCT
|
||||
&& ((*ptr)->size > 16 || cif->abi != FFI_V9))
|
||||
|
Loading…
x
Reference in New Issue
Block a user