[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: gcl and reverse dependencies on arm



Camm Maguire <camm@maguirefamily.org> writes:

Hi,

> Greetings!  OK I think we've found it.
>
> A long time ago, some very helpful arm developer told me how to clear
> the instruction and data caches.  GCL needs to do this as it loads
> compiled code into its .data section, relocates it, clears the cache,
> and then executes.  
>
> Here is the arm bit:
>
> #define CLEAR_CACHE do {\
>   void *v=memory->cfd.cfd_start,*ve=v+memory->cfd.cfd_size; \
>   register unsigned long _beg __asm ("a1") = (unsigned long)(v);	\
>   register unsigned long _end __asm ("a2") = (unsigned long)(ve);\
>   register unsigned long _flg __asm ("a3") = 0;			\
>   __asm __volatile ("swi 0x9f0002		@ sys_cacheflush"	\
> 		    : "=r" (_beg)				\
> 		    : "0" (_beg), "r" (_end), "r"(_flg));	\
> } while (0)

hmm... it looks like oabi syscall not eabi syscall. 

>
>
> Since this time, many architectures use more portable alternatives

On recent enough gcc (>= 4.1 iirc), __clear_cache() should be a more
portable way to clean caches. Can you give it a try ?


Arnaud


Reply to: