Saturday, November 3, 2012
Flush the Instruction Cache
// flush the cache, eip is the current eip address
__asm__ __volatile__("wbinvd"); // write back cache and invalidate cache
__asm__ __volatile__(
"CLFLUSH (%0)"
:"=r"(eip));
wbinvd:
Writes back all modified cache lines in the processor’s internal cache to main memory and invalidates (flushes) the internal caches. The instruction then issues a special- function bus cycle that directs external caches to also write back modified data and another bus cycle to indicate that the external caches should be invalidated.
clfush:
Invalidates the cache line that contains the linear address specified with the source operand from all levels of the processor cache hierarchy (data and instruction). The invalidation is broadcast throughout the cache coherence domain. If, at any level of the cache hierarchy, the line is inconsistent with memory (dirty) it is written to memory before invalidation
Please see intel manual instruction volume for more details
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment