public inbox for libffi-discuss@sourceware.org
 help / color / mirror / Atom feed
* MIPS Patch and testresults.
@ 2008-02-15 18:26 David Daney
  2008-02-15 20:48 ` Jakub Jelinek
  0 siblings, 1 reply; 3+ messages in thread
From: David Daney @ 2008-02-15 18:26 UTC (permalink / raw)
  To: libffi-discuss

[-- Attachment #1: Type: text/plain, Size: 1339 bytes --]

Please consider the attached patch.


Tested on mipsel-linux with gcc-4.2.3:


Native configuration is mips64el-unknown-linux-gnu

                 === libffi tests ===

Schedule of variations:
     unix

Running target unix
Using /usr/share/dejagnu/baseboards/unix.exp as board description file 
for target.
Using /usr/share/dejagnu/config/unix.exp as generic interface file for 
target.
Using /home/ddaney/libffi-2.99.9/testsuite/config/default.exp as 
tool-and-target-specific interface file.
Running /home/ddaney/libffi-2.99.9/testsuite/libffi.call/call.exp ...
Running /home/ddaney/libffi-2.99.9/testsuite/libffi.special/special.exp ...

                 === libffi Summary ===

# of expected passes            1389
# of unsupported tests          15



Also built on mipsel-linux with gcc-3.3.6, but not tested due to lack of 
dejagnu in that environment.


Note that for the libffi home page, that Casey Marshall did the initial 
mips o32 closure support.


2008-02-15  David Daney  <ddaney@avtrex.com>

	* src/mips/ffi.c (USE__BUILTIN___CLEAR_CACHE): Define for GCC >= 4.3.
	(sys/cachectl.h): Include if not USE__BUILTIN___CLEAR_CACHE.
	(ffi_prep_closure_loc):  Use cacheflush if not
	USE__BUILTIN___CLEAR_CACHE
	* src/mips/ffitarget.h (asm/sgidefs.h): Include if linux.
	(_ABIN32, _ABI64, _ABIO32): Define if not already defined.

[-- Attachment #2: ffi.patch --]
[-- Type: text/x-patch, Size: 1587 bytes --]

diff -rup libffi-2.99.9/src/mips/ffi.c libffi-2.99.9.DD/src/mips/ffi.c
--- libffi-2.99.9/src/mips/ffi.c	2008-02-14 17:17:13.000000000 -0800
+++ libffi-2.99.9.DD/src/mips/ffi.c	2008-02-15 10:07:43.000000000 -0800
@@ -29,6 +29,16 @@
 
 #include <stdlib.h>
 
+#ifdef __GNUC__
+#  if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))
+#    define USE__BUILTIN___CLEAR_CACHE 1
+#  endif
+#endif
+
+#ifndef USE__BUILTIN___CLEAR_CACHE
+#include <sys/cachectl.h>>
+#endif
+
 #ifdef FFI_DEBUG
 # define FFI_MIPS_STOP_HERE() ffi_stop_here()
 #else
@@ -616,8 +626,11 @@ ffi_prep_closure_loc (ffi_closure *closu
   closure->fun = fun;
   closure->user_data = user_data;
 
+#ifdef USE__BUILTIN___CLEAR_CACHE
   __builtin___clear_cache(clear_location, clear_location + FFI_TRAMPOLINE_SIZE);
-
+#else
+  cacheflush (tramp, FFI_TRAMPOLINE_SIZE, ICACHE);
+#endif
   return FFI_OK;
 }
 
Only in libffi-2.99.9.DD/src/mips: ffi.c~
diff -rup libffi-2.99.9/src/mips/ffitarget.h libffi-2.99.9.DD/src/mips/ffitarget.h
--- libffi-2.99.9/src/mips/ffitarget.h	2008-02-14 17:15:46.000000000 -0800
+++ libffi-2.99.9.DD/src/mips/ffitarget.h	2008-02-15 09:58:48.000000000 -0800
@@ -27,6 +27,19 @@
 #ifndef LIBFFI_TARGET_H
 #define LIBFFI_TARGET_H
 
+#ifdef linux
+#include <asm/sgidefs.h>
+#  ifndef _ABIN32
+#    define _ABIN32 _MIPS_SIM_NABI32
+#  endif
+#  ifndef _ABI64
+#    define _ABI64 _MIPS_SIM_ABI64
+#  endif
+#  ifndef _ABIO32
+#    define _ABIO32 _MIPS_SIM_ABI32
+#  endif
+#endif
+
 #if !defined(_MIPS_SIM)
 -- something is very wrong --
 #else
Only in libffi-2.99.9.DD/src/mips: ffitarget.h~

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: MIPS Patch and testresults.
  2008-02-15 18:26 MIPS Patch and testresults David Daney
@ 2008-02-15 20:48 ` Jakub Jelinek
  2008-02-15 21:34   ` David Daney
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Jelinek @ 2008-02-15 20:48 UTC (permalink / raw)
  To: David Daney; +Cc: libffi-discuss

On Fri, Feb 15, 2008 at 10:25:58AM -0800, David Daney wrote:
> Please consider the attached patch.

How could:
#ifndef USE__BUILTIN___CLEAR_CACHE
#include <sys/cachectl.h>>
#endif

compile?  Note >> instead of > .

	Jakub

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: MIPS Patch and testresults.
  2008-02-15 20:48 ` Jakub Jelinek
@ 2008-02-15 21:34   ` David Daney
  0 siblings, 0 replies; 3+ messages in thread
From: David Daney @ 2008-02-15 21:34 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: libffi-discuss

[-- Attachment #1: Type: text/plain, Size: 695 bytes --]

Jakub Jelinek wrote:
> On Fri, Feb 15, 2008 at 10:25:58AM -0800, David Daney wrote:
>> Please consider the attached patch.
> 
> How could:
> #ifndef USE__BUILTIN___CLEAR_CACHE
> #include <sys/cachectl.h>>
> #endif
> 
> compile?  Note >> instead of > .
> 

Indeed, it is an interesting question.  The answer is:

src/mips/ffi.c:39:26: warning: extra tokens at end of #include directive

So it works, but issues a warning that I somehow missed.


The attached test fixes all warnings in src/mips/ffi.c

Tested on mipsel-linux.

2008-02-15  David Daney  <ddaney@avtrex.com>

	* src/mips/ffi.c: Remove extra '>' from include directive.
	(ffi_prep_closure_loc):  Use clear_location instead of tramp.

[-- Attachment #2: ffi.diff --]
[-- Type: text/x-patch, Size: 723 bytes --]

diff -rup libffi-3.0.0/src/mips/ffi.c libffi-3.0.0.DD/src/mips/ffi.c
--- libffi-3.0.0/src/mips/ffi.c	2008-02-15 10:33:13.000000000 -0800
+++ libffi-3.0.0.DD/src/mips/ffi.c	2008-02-15 13:17:39.000000000 -0800
@@ -36,7 +36,7 @@
 #endif
 
 #ifndef USE__BUILTIN___CLEAR_CACHE
-#include <sys/cachectl.h>>
+#include <sys/cachectl.h>
 #endif
 
 #ifdef FFI_DEBUG
@@ -629,7 +629,7 @@ ffi_prep_closure_loc (ffi_closure *closu
 #ifdef USE__BUILTIN___CLEAR_CACHE
   __builtin___clear_cache(clear_location, clear_location + FFI_TRAMPOLINE_SIZE);
 #else
-  cacheflush (tramp, FFI_TRAMPOLINE_SIZE, ICACHE);
+  cacheflush (clear_location, FFI_TRAMPOLINE_SIZE, ICACHE);
 #endif
   return FFI_OK;
 }
Only in libffi-3.0.0.DD/src/mips: ffi.c~

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-02-15 21:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-15 18:26 MIPS Patch and testresults David Daney
2008-02-15 20:48 ` Jakub Jelinek
2008-02-15 21:34   ` David Daney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).