Doubts About Cache Manager Routines

Mohamed Naufal naufal11 at gmail.com
Tue Apr 5 18:49:43 UTC 2011


Hi

I'm trying to implement to write an sptest to check the working of
cache manager routines as a qualification task for the cache manager
support GSoC project.

This is what I have so far:

on i386:

rtems_task Init(rtems_task_argument arg)
{
   int volatile a = 1;
   //Writeback and invalidate
   __asm__ __volatile__("wbinvd");
   a = 2;
   //Invalidate
   __asm__ __volatile__("invd");
   if (a == 1)
       printf("Invalidation successful\n");
   else
       printf("Invalidation unsuccessful\n");

   exit(0);
}
This doesn't work on qemu but does on real hardware.

Using the cache manager routines, this is what I did
rtems_task Init(rtems_task_argument arg)
{
   int volatile a = 1;

   rtems_cache_data_enable();
   rtems_cache_flush_entire_data();
   a = 2;
   rtems_cache_invalidate_entire_data();
   if (a == 1)
       printf("Invalidation successful\n");
   else
       printf("Invalidation unsuccessful\n");

   exit(0);
}

This doesn't work as I'd hoped. On checking, it seems
invalidate_data() returns to the line a=2 and thus infinite loops.My
understanding is that in the invalidate function, the dirty blocks
including the stack part which contains the return address are
invalidated. So it uses the return address of the flush function which
was the previously written out to the same memory location.

How do I handle this?

Thanks
Naufal



More information about the users mailing list