Rebase from GCC

This commit is contained in:
Anthony Green
2011-02-08 14:28:59 -05:00
parent a26e394061
commit 3b836249fe
41 changed files with 264 additions and 27 deletions

View File

@@ -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;

View File

@@ -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