Fix bad_abi test. rc5.

This commit is contained in:
Anthony Green
2011-02-13 08:06:39 -05:00
parent 90af15ef5c
commit 1fbf9dc44f
54 changed files with 10999 additions and 237 deletions

View File

@@ -1,7 +1,8 @@
/* -----------------------------------------------------------------------
ffi.c - Copyright (c) 1998 Geoffrey Keating
Copyright (C) 2007, 2008 Free Software Foundation, Inc
Copyright (C) 2008 Red Hat, Inc
ffi.c - Copyright (C) 2011 Anthony Green
Copyright (C) 2008 Red Hat, Inc
Copyright (C) 2007, 2008 Free Software Foundation, Inc
Copyright (c) 1998 Geoffrey Keating
PowerPC Foreign Function Interface
@@ -949,14 +950,16 @@ ffi_prep_closure_loc (ffi_closure *closure,
#ifdef POWERPC64
void **tramp = (void **) &closure->tramp[0];
FFI_ASSERT (cif->abi == FFI_LINUX64);
if (cif->abi != FFI_LINUX64)
return FFI_BAD_ABI;
/* Copy function address and TOC from ffi_closure_LINUX64. */
memcpy (tramp, (char *) ffi_closure_LINUX64, 16);
tramp[2] = codeloc;
#else
unsigned int *tramp;
FFI_ASSERT (cif->abi == FFI_GCC_SYSV || cif->abi == FFI_SYSV);
if (! (cif->abi == FFI_GCC_SYSV || cif->abi == FFI_SYSV))
return FFI_BAD_ABI;
tramp = (unsigned int *) &closure->tramp[0];
tramp[0] = 0x7c0802a6; /* mflr r0 */