This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java 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]

Re: [patch] libffi EABI sys_cacheflush


--- David Daney <ddaney@avtrex.com> wrote:

> Steven Newbury wrote:
> > The existing code in FFI_INIT_TRAMPOLINE calls sys_cacheflush using only
> the
> > OABI syscall interface ie. the syscall number is encoded in the swi
> > instruction.
> >
> > This patch passes the syscall number in r7 and calls "swi 0" as is needed
> by
> > the EABI Linux syscall ABI.
> >
> > 2007-08-03  Steven Newbury  <s_j_newbury@yahoo.co.uk>
> >
> > 	* src/arm/ffi.c (FFI_INIT_TRAMPOLINE): Use EABI syscall ABI for 
> >           sys_cacheflush.
> >   
> An alternative would be to call the __clear_cache() function provided by 
> libgcc, or even better implement __builtin___clear_cache for arm and use 
> that.
 
Now that I've tested it, I've discovered that the patch I sent doesn't actually
work; #ifdef's inside macros are not a good idea..

As David suggested:

Use __clear_cache from libgcc for cache flushing.  This function uses the
appropriate EABI/OABI ABI for the cache flush operation.

2007-08-05  Steven Newbury  <s_j_newbury@yahoo.co.uk>
 	* src/arm/ffi.c (FFI_INIT_TRAMPOLINE): Use __clear_cache instead of 
          directly using the sys_cacheflush syscall.


Steve


      ___________________________________________________________
Yahoo! Answers - Got a question? Someone out there knows the answer. Try it
now.
http://uk.answers.yahoo.com/ 
--- libffi/src/arm/ffi.c~	2007-08-05 13:30:27.683858627 +0100
+++ libffi/src/arm/ffi.c	2007-08-05 13:30:27.683858627 +0100
@@ -257,12 +257,7 @@
    *(unsigned int*) &__tramp[8] = 0xe59ff000; /* ldr pc, [pc] */ \
    *(unsigned int*) &__tramp[12] = __ctx; \
    *(unsigned int*) &__tramp[16] = __fun; \
-   register unsigned long _beg __asm ("a1") = (unsigned long) (&__tramp[0]);	\
-   register unsigned long _end __asm ("a2") = (unsigned long) (&__tramp[19]);	\
-   register unsigned long _flg __asm ("a3") = 0;			\
-   __asm __volatile ("swi 0x9f0002		@ sys_cacheflush"	\
-	   		    : "=r" (_beg)				\
-	   		    : "0" (_beg), "r" (_end), "r" (_flg));	\
+   __clear_cache((&__tramp[0]), (&__tramp[19])); \
  })
 
 

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