This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Correct cache-flushing bug in libffi on darwin


In Darwin's assembler, ';' is a comment character, and so
the asm statement wasn't doing the right thing.  It was, however,
close enough to work under nearly all circumstances, until I touched
a completely different bit of code and suddenly got some mysterious
gij failures in the libjava testsuite.

Tested with 'make check-target-libjava' on powerpc-darwin, on the
patched tree that was previously showing the bug; with 'make
check-target-libffi'; and by using 'otool -vt' to inspect flush_icache
in ffi_darwin.o.

-- 
- Geoffrey Keating <geoffk@apple.com>

===File ~/patches/libffi-darwin-flushcache.patch============
2004-06-30  Geoffrey Keating  <geoffk@apple.com>

	* src/powerpc/ffi_darwin.c (flush_icache): ';' is a comment
	character on Darwin, use '\n\t' instead.

Index: src/powerpc/ffi_darwin.c
===================================================================
RCS file: /cvs/gcc/gcc/libffi/src/powerpc/ffi_darwin.c,v
retrieving revision 1.11
diff -u -p -u -p -r1.11 ffi_darwin.c
--- src/powerpc/ffi_darwin.c	21 Oct 2003 19:01:56 -0000	1.11
+++ src/powerpc/ffi_darwin.c	30 Jun 2004 09:13:58 -0000
@@ -530,11 +530,11 @@ flush_icache(char *addr)
 {
 #ifndef _AIX
   __asm__ volatile (
-		"dcbf 0,%0;"
-		"sync;"
-		"icbi 0,%0;"
-		"sync;"
-		"isync;"
+		"dcbf 0,%0\n"
+		"\tsync\n"
+		"\ticbi 0,%0\n"
+		"\tsync\n"
+		"\tisync"
 		: : "r"(addr) : "memory");
 #endif
 }
============================================================


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]