The following C code flushes out the table from all caches. It works on Intel Core 2 Duo and above and doesn't work on Pentium 3. I haven't checked on Pentium 4.
void clean_tables()
{
int i;
for(i=0; i<256; i+=CACHE_LINE_SIZE){
asm volatile("clflush (%0)" :: "r" (table+i));
}
}
#define CACHE_LINE_SIZE 64
unsigned char table[256];
{
int i;
for(i=0; i<256; i+=CACHE_LINE_SIZE){
asm volatile("clflush (%0)" :: "r" (table+i));
}
}
No comments:
Post a Comment