Doubts About Cache Manager Routines

Thomas Doerfler (nt) Thomas.Doerfler at imd-systems.de
Tue Apr 5 19:19:13 UTC 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Naufal,

maybe using a local (stack) variable as a test target is not really a
good idea, because you will _always_ hit stuff in the neighbourhood.
Your analysis is totally to the point regarding the effects you have.

A proper way may include:
- - allocate a cache-aligned chunk of memory (e.g. from the heap, using
malloc() ).
- - use this location as your test area.

wkr,
Thomas.


Am 05.04.2011 20:49, schrieb Mohamed Naufal:
> 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
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-users


- -- 
- --------------------------------------------
IMD Ingenieurbuero fuer Microcomputertechnik
Thomas Doerfler           Herbststrasse 8
D-82178 Puchheim          Germany
email:    Thomas.Doerfler at imd-systems.de
PGP public key available at:
     http://www.imd-systems.de/pgpkey_en.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2bazAACgkQwHyg4bDtfjQ7GgCglF6xGTGfapGuObGXok6QjnOA
M3MAn1nBHuZmc4nNj2Q7ryZX33KlIenU
=bNHw
-----END PGP SIGNATURE-----



More information about the users mailing list