Changeset 9bf9068 in rtems


Ignore:
Timestamp:
Nov 25, 2016, 6:21:44 PM (3 years ago)
Author:
Martin Erik Werner <martinerikwerner.aac@…>
Branches:
master
Children:
c09db57
Parents:
a59dd5c
git-author:
Martin Erik Werner <martinerikwerner.aac@…> (11/25/16 18:21:44)
git-committer:
Sebastian Huber <sebastian.huber@…> (11/28/16 06:30:44)
Message:

or1k: Avoid multiple iterations over cache

Previously, if the cache range operations were called with a range that
was larger than the cache size, this would lead to multiple iterations
over the cache, which is unnecessary.

Limit this so that if the range is larger than the cache size, the
operations will only iterate over the whole cache once.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libcpu/or1k/shared/cache/cache.c

    ra59dd5c r9bf9068  
    226226  d_addr = (void *)((size_t)d_addr & ~(CPU_DATA_CACHE_ALIGNMENT - 1));
    227227
     228  if( final_address - d_addr > _CPU_cache_get_data_cache_size(0) ) {
     229    /*
     230     * Avoid iterating over the whole cache multiple times if the range is
     231     * larger than the cache size.
     232     */
     233    _CPU_cache_flush_entire_data();
     234    return;
     235  }
     236
    228237  _ISR_Local_disable (level);
    229238
     
    254263  d_addr = (void *)((size_t)d_addr & ~(CPU_DATA_CACHE_ALIGNMENT - 1));
    255264
     265  if( final_address - d_addr > _CPU_cache_get_data_cache_size(0) ) {
     266    /*
     267     * Avoid iterating over the whole cache multiple times if the range is
     268     * larger than the cache size.
     269     */
     270    _CPU_cache_invalidate_entire_data();
     271    return;
     272  }
     273
    256274  _ISR_Local_disable (level);
    257275
     
    282300  i_addr = (void *)((size_t)i_addr & ~(CPU_INSTRUCTION_CACHE_ALIGNMENT - 1));
    283301
     302  if( final_address - i_addr > _CPU_cache_get_data_cache_size(0) ) {
     303    /*
     304     * Avoid iterating over the whole cache multiple times if the range is
     305     * larger than the cache size.
     306     */
     307    _CPU_cache_invalidate_entire_instruction();
     308    return;
     309  }
     310
    284311  _ISR_Local_disable (level);
    285312
Note: See TracChangeset for help on using the changeset viewer.