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

Re: Flushing the data cache

>>>>> On Wed, 13 Nov 2002 19:04:44 -0500, Camm Maguire <camm@enhanced.com> said:

  Camm> Greetings!  GCL loads binary modules into its data section,
  Camm> and then attempts executing the code thus loaded.  On some
  Camm> RISC machines, it needs to flush the data cache after writing
  Camm> and before executing.  Some samples are included at the end of
  Camm> this post.

  Camm> What I'm looking for is the analog on ia64, which does appear
  Camm> to be necessary after all.  Can anyone help?

I attached the GNU C routine which flushes the cache in the address
range [ADDR,ADDR+LEN).  Hope that helps.


static void
flush_cache (void *addr, unsigned long len)
  void *end = (char *) addr + len;

  while (addr < end)
      asm volatile ("fc %0" :: "r"(addr));
      addr = (char *) addr + 32;
  asm volatile (";;sync.i;;srlz.i;;");

Reply to: