src/ssx/ppc405/ppc405_cache_core.c
/// Invalidate a range of addresses from the D-cache
///
/// \param p A pointer to the memory area to be invalidated.
///
/// \param bytes The size (in bytes) of the area to invalidate.
///
/// The dcache_invalidate() API is used to invalidate an arbitrary range of
/// memory in the cache. Note that invalidation is a destructive operation
/// that may cause the loss of information.  This API will invalidate all
/// cache lines from the line containing the address \a p, to the line
/// containing the address \a p + \a size - 1.  (If \a size == 0 this call is
/// a NOP.) It is the caller's responsibility to insure that no useful data is
/// inadverdently invalidated.  D-cache invalidation is more-or-less a no-op
/// for data either not in the cache or marked as non-cacheable.
///
/// This API always issues a sync() after the invalidation, even in the event
/// of \a size == 0.
///
/// \note For invalidating small blocks of data where some alignmment
/// constraints are known it may be more efficient to use
/// dcache_invalidate_line() rather than this API.
Invalidate a range of addresses from the D-cache
\param p A pointer to the memory area to be invalidated.

\param bytes The size (in bytes) of the area to invalidate.

The dcache_invalidate() API is used to invalidate an arbitrary range of
memory in the cache. Note that invalidation is a destructive operation
that may cause the loss of information.  This API will invalidate all
cache lines from the line containing the address \a p, to the line
containing the address \a p + \a size - 1.  (If \a size == 0 this call is
a NOP.) It is the caller's responsibility to insure that no useful data is
inadverdently invalidated.

This API always issues a sync() after the invalidation, even in the event
of \a size == 0.

\note For invalidating small blocks of data where some alignmment
constraints are known it may be more efficient to use
dcache_invalidate_line() rather than this API.
Invalidate a range of addresses from the D - cache \ param p A pointer to the memory area to be invalidated . \ param bytes The size ( in bytes ) of the area to invalidate . The dcache_invalidate () API is used to invalidate an arbitrary range of memory in the cache . Note that invalidation is a destructive operation that may cause the loss of information . This API will invalidate all cache lines from the line containing the address \ a p to the line containing the address \ a p + \ a size - 1 . ( If \ a size == 0 this call is a NOP . ) It is the caller ' s responsibility to insure that no useful data is inadverdently invalidated . This API always issues a sync () after the invalidation even in the event of \ a size == 0 . \ note For invalidating small blocks of data where some alignmment constraints are known it may be more efficient to use dcache_invalidate_line () rather than this API .
void
dcache_invalidate(void* p, size_t bytes)
{
    size_t lines;
    if (bytes != 0)
    {
        lines = 1;
        bytes -=
            MIN((CACHE_LINE_SIZE - ((unsigned long)p % CACHE_LINE_SIZE)),
                bytes);
        lines += bytes / CACHE_LINE_SIZE;
        if (!cache_aligned(bytes))
        {
            lines++;
        }
        while (lines--)
        {
            dcbi(p);
            p += CACHE_LINE_SIZE;
        }
    }
    sync();
}
void dcache_invalidate ( void * p , size_t bytes ) { size_t lines ; if ( bytes != 0 ) { lines = 1 ; bytes -= MIN ( ( CACHE_LINE_SIZE - ( ( unsigned long ) p % CACHE_LINE_SIZE ) ) , bytes ) ; lines += bytes / CACHE_LINE_SIZE ; if ( ! cache_aligned ( bytes ) ) { lines ++ ; } while ( lines -- ) { dcbi ( p ) ; p += CACHE_LINE_SIZE ; } } sync ( ) ; }
Invalidate a range of addresses from the D-cache
\param p A pointer to the memory area to be invalidated.
Invalidate a range of addresses from the D - cache \ param p A pointer to the memory area to be invalidated .