Allows to prefetch data into level 1 cache.
HWCache | Allows to prefetch data into level 1 cache. |
Copyright | This program is free software. |
Files | |
C-kern/ | Header file HWCache. |
C-kern/ | Implementation file HWCache impl. |
Types | |
struct hwcache_t | Export hwcache_t into global namespace. |
Functions | |
test | |
unittest_memory_hwcache | Test hwcache_t functionality. |
hwcache_t | Implicit type allows to access a hardware object. |
query | |
sizedataprefetch_hwcache | Size of aligned memory block transfered to and from data cache. |
update | |
prefetchdata_hwcache | Prefetches data into all levels of hw cache. |
inline implementation | |
Macros | |
prefetchdata_hwcache | Implements hwcache_t.prefetchdata_hwcache. |
sizedataprefetch_hwcache | Implements hwcache_t.sizedataprefetch_hwcache. |
This program is free software. You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
© 2012 Jörg Seebohn
Header file HWCache.
Implementation file HWCache impl.
typedef struct hwcache_t hwcache_t
Export hwcache_t into global namespace.
test | |
unittest_memory_hwcache | Test hwcache_t functionality. |
int unittest_memory_hwcache( void )
Test hwcache_t functionality.
struct hwcache_t
Implicit type allows to access a hardware object.
query | |
sizedataprefetch_hwcache | Size of aligned memory block transfered to and from data cache. |
update | |
prefetchdata_hwcache | Prefetches data into all levels of hw cache. |
uint32_t sizedataprefetch_hwcache( void )
Size of aligned memory block transfered to and from data cache. The stored blocks are also called cache lines internally. A cache line stores more then raw data bytes. It stores also the memory address and additional flags which describe the state of the cached data.
This value also gives the memory address alignment of such a cache line.
The returned value is reasonable but does not adapt to the current hardware. TODO: Implement it in a hardware specific way.
void prefetchdata_hwcache( void * addr )
Prefetches data into all levels of hw cache. The transfered data block is of size sizedataprefetch_hwcache and has the same alignment. The transfered data block contains at least the first byte of the given address.
#define prefetchdata_hwcache( addr ) (__builtin_prefetch((addr), 0/*read*/, 3/*put data in all cache levels*/))
Implements hwcache_t.prefetchdata_hwcache.
#define sizedataprefetch_hwcache( ) (16)
Implements hwcache_t.sizedataprefetch_hwcache.
Export hwcache_t into global namespace.
typedef struct hwcache_t hwcache_t
Implicit type allows to access a hardware object.
struct hwcache_t
Test hwcache_t functionality.
int unittest_memory_hwcache( void )
Size of aligned memory block transfered to and from data cache.
uint32_t sizedataprefetch_hwcache( void )
Prefetches data into all levels of hw cache.
void prefetchdata_hwcache( void * addr )
Implements hwcache_t.prefetchdata_hwcache.
#define prefetchdata_hwcache( addr ) (__builtin_prefetch((addr), 0/*read*/, 3/*put data in all cache levels*/))
Implements hwcache_t.sizedataprefetch_hwcache.
#define sizedataprefetch_hwcache( ) (16)