summaryrefslogtreecommitdiff
path: root/patches/sparc-v8-aggregate-returns
diff options
context:
space:
mode:
authorAnthony Green <green@moxielogic.com>2011-08-22 14:50:10 -0400
committerAnthony Green <green@moxielogic.com>2011-08-22 14:50:10 -0400
commit049d8386ff52399e69a530b55b9feedc8a2589d2 (patch)
tree278f699fe36d6793c592352b834c4b6862b71a8f /patches/sparc-v8-aggregate-returns
parent3b7efa4e74f0dcebf70b447391987aedd3473306 (diff)
downloadlibffi-049d8386ff52399e69a530b55b9feedc8a2589d2.tar.gz
Many new patches
Diffstat (limited to 'patches/sparc-v8-aggregate-returns')
-rw-r--r--patches/sparc-v8-aggregate-returns45
1 files changed, 42 insertions, 3 deletions
diff --git a/patches/sparc-v8-aggregate-returns b/patches/sparc-v8-aggregate-returns
index b8718ae..6b8460e 100644
--- a/patches/sparc-v8-aggregate-returns
+++ b/patches/sparc-v8-aggregate-returns
@@ -2,14 +2,15 @@ Index: libffi/ChangeLog
===================================================================
--- libffi.orig/ChangeLog
+++ libffi/ChangeLog
-@@ -33,6 +33,11 @@
+@@ -33,6 +33,12 @@
* configure: Regenerate.
+2011-02-08 Ginn Chen <ginn.chen@oracle.com>
+
+ * src/sparc/ffi.c (ffi_call): Make compatible with Solaris Studio
-+ aggregate return ABI.
++ aggregate return ABI. Flush cache.
++ (ffi_prep_closure_loc): Flush cache.
+
2011-02-11 Anthony Green <green@moxielogic.com>
@@ -18,7 +19,14 @@ Index: libffi/src/sparc/ffi.c
===================================================================
--- libffi.orig/src/sparc/ffi.c
+++ libffi/src/sparc/ffi.c
-@@ -406,8 +406,46 @@ void ffi_call(ffi_cif *cif, void (*fn)(v
+@@ -1,5 +1,6 @@
+ /* -----------------------------------------------------------------------
+ ffi.c - Copyright (c) 1996, 2003, 2004, 2007, 2008 Red Hat, Inc.
++ Copyright (c) 2011 Anthony Green
+
+ SPARC Foreign Function Interface
+
+@@ -406,8 +407,50 @@ void ffi_call(ffi_cif *cif, void (*fn)(v
/* We don't yet support calling 32bit code from 64bit */
FFI_ASSERT(0);
#else
@@ -49,6 +57,10 @@ Index: libffi/src/sparc/ffi.c
+ call_struct[5] = 0x01000000; /* nop */
+ call_struct[6] = 0x81c7e008; /* ret */
+ call_struct[7] = 0xbe100017; /* mov %l7, %i7 */
++ asm volatile ("iflush %0; iflush %0+8; iflush %0+16; iflush %0+24" : :
++ "r" (call_struct) : "memory");
++ /* SPARC v8 requires 5 instructions for flush to be visible */
++ asm volatile ("nop; nop; nop; nop; nop");
+ ffi_call_v8(ffi_prep_args_v8, &ecif, cif->bytes,
+ cif->flags, rvalue, call_struct);
+ ffi_closure_free(call_struct);
@@ -67,3 +79,30 @@ Index: libffi/src/sparc/ffi.c
#endif
break;
case FFI_V9:
+@@ -425,7 +468,6 @@ void ffi_call(ffi_cif *cif, void (*fn)(v
+ FFI_ASSERT(0);
+ break;
+ }
+-
+ }
+
+
+@@ -468,13 +510,13 @@ ffi_prep_closure_loc (ffi_closure* closu
+ closure->fun = fun;
+ closure->user_data = user_data;
+
+- /* Flush the Icache. FIXME: alignment isn't certain, assume 8 bytes */
++ /* Flush the Icache. closure is 8 bytes aligned. */
+ #ifdef SPARC64
+- asm volatile ("flush %0" : : "r" (closure) : "memory");
+- asm volatile ("flush %0" : : "r" (((char *) closure) + 8) : "memory");
++ asm volatile ("flush %0; flush %0+8" : : "r" (closure) : "memory");
+ #else
+- asm volatile ("iflush %0" : : "r" (closure) : "memory");
+- asm volatile ("iflush %0" : : "r" (((char *) closure) + 8) : "memory");
++ asm volatile ("iflush %0; iflush %0+8" : : "r" (closure) : "memory");
++ /* SPARC v8 requires 5 instructions for flush to be visible */
++ asm volatile ("nop; nop; nop; nop; nop");
+ #endif
+
+ return FFI_OK;