aboutsummaryrefslogtreecommitdiff
path: root/libffi
diff options
context:
space:
mode:
authorJoel Sherrill <joel@gcc.gnu.org>2011-02-08 19:19:01 +0000
committerJoel Sherrill <joel@gcc.gnu.org>2011-02-08 19:19:01 +0000
commit9993cf60700c3242fffaaa60e53ecfa42d971b85 (patch)
tree720a5e2be6e9d3b7feb5562d579672dea14fb590 /libffi
parent899fb23dc0a29755ea65c940113d8117e326bd20 (diff)
downloadgcc-9993cf60700c3242fffaaa60e53ecfa42d971b85.zip
gcc-9993cf60700c3242fffaaa60e53ecfa42d971b85.tar.gz
gcc-9993cf60700c3242fffaaa60e53ecfa42d971b85.tar.bz2
ffi.c: Add RTEMS support for cache flushing.
2011-02-07 Joel Sherrill <joel.sherrill@oarcorp.com> * libffi/src/m68k/ffi.c: Add RTEMS support for cache flushing. Handle case when CPU variant does not have long double support. * libffi/src/m68k/sysv.S: Add support for mc68000, Coldfire, and cores with soft floating point. From-SVN: r169938
Diffstat (limited to 'libffi')
-rw-r--r--libffi/src/m68k/ffi.c10
-rw-r--r--libffi/src/m68k/sysv.S36
2 files changed, 46 insertions, 0 deletions
diff --git a/libffi/src/m68k/ffi.c b/libffi/src/m68k/ffi.c
index 600cf20..0d4df1e 100644
--- a/libffi/src/m68k/ffi.c
+++ b/libffi/src/m68k/ffi.c
@@ -9,8 +9,12 @@
#include <stdlib.h>
#include <unistd.h>
+#ifdef __rtems__
+void rtems_cache_flush_multiple_data_lines( const void *, size_t );
+#else
#include <sys/syscall.h>
#include <asm/cachectl.h>
+#endif
void ffi_call_SYSV (extended_cif *,
unsigned, unsigned,
@@ -144,9 +148,11 @@ ffi_prep_cif_machdep (ffi_cif *cif)
cif->flags = CIF_FLAGS_DOUBLE;
break;
+#if (FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE)
case FFI_TYPE_LONGDOUBLE:
cif->flags = CIF_FLAGS_LDOUBLE;
break;
+#endif
case FFI_TYPE_POINTER:
cif->flags = CIF_FLAGS_POINTER;
@@ -266,8 +272,12 @@ ffi_prep_closure_loc (ffi_closure* closure,
else
*(void **)(closure->tramp + 8) = ffi_closure_SYSV;
+#ifdef __rtems__
+ rtems_cache_flush_multiple_data_lines( codeloc, FFI_TRAMPOLINE_SIZE );
+#else
syscall(SYS_cacheflush, codeloc, FLUSH_SCOPE_LINE,
FLUSH_CACHE_BOTH, FFI_TRAMPOLINE_SIZE);
+#endif
closure->cif = cif;
closure->user_data = user_data;
diff --git a/libffi/src/m68k/sysv.S b/libffi/src/m68k/sysv.S
index 58822e0..c782f51 100644
--- a/libffi/src/m68k/sysv.S
+++ b/libffi/src/m68k/sysv.S
@@ -1,4 +1,5 @@
/* -----------------------------------------------------------------------
+
sysv.S - Copyright (c) 1998 Andreas Schwab
Copyright (c) 2008 Red Hat, Inc.
@@ -85,7 +86,12 @@ ffi_call_SYSV:
move.l 16(%fp),%d2
| If the return value pointer is NULL, assume no return value.
+ | NOTE: On the mc68000, tst on an address register is not supported.
+#if defined(__mc68000__) && !defined(__mcoldfire__)
+ cmp.w #0, %a1
+#else
tst.l %a1
+#endif
jbeq noretval
btst #0,%d2
@@ -103,19 +109,34 @@ retlongint:
retfloat:
btst #2,%d2
jbeq retdouble
+#if defined(__MC68881__)
fmove.s %fp0,(%a1)
+#else
+ move.l %d0,(%a1)
+#endif
jbra epilogue
retdouble:
btst #3,%d2
jbeq retlongdouble
+#if defined(__MC68881__)
fmove.d %fp0,(%a1)
+#else
+ move.l %d0,(%a1)+
+ move.l %d1,(%a1)
+#endif
jbra epilogue
retlongdouble:
btst #4,%d2
jbeq retpointer
+#if defined(__MC68881__)
fmove.x %fp0,(%a1)
+#else
+ move.l %d0,(%a1)+
+ move.l %d1,(%a1)+
+ move.l %d2,(%a1)
+#endif
jbra epilogue
retpointer:
@@ -178,16 +199,31 @@ ffi_closure_SYSV:
move.l (%a0),%d1
jra .Lcls_epilogue
.Lcls_ret_float:
+#if defined(__MC68881__)
fmove.s (%a0),%fp0
+#else
+ move.l (%a0),%d0
+#endif
jra .Lcls_epilogue
1:
lsr.l #2,%d0
jne 1f
jcs .Lcls_ret_ldouble
+#if defined(__MC68881__)
fmove.d (%a0),%fp0
+#else
+ move.l (%a0)+,%d0
+ move.l (%a0),%d1
+#endif
jra .Lcls_epilogue
.Lcls_ret_ldouble:
+#if defined(__MC68881__)
fmove.x (%a0),%fp0
+#else
+ move.l (%a0)+,%d0
+ move.l (%a0)+,%d1
+ move.l (%a0),%d2
+#endif
jra .Lcls_epilogue
1:
lsr.l #2,%d0