13.07.2015 Views

Volume 3: General-Purpose and System Instructions - Stanford ...

Volume 3: General-Purpose and System Instructions - Stanford ...

Volume 3: General-Purpose and System Instructions - Stanford ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

AMD64 Technology 24594 Rev. 3.10 February 2005CLFLUSHCache Line FlushFlushes the cache line specified by the mem8 linear-address. The instruction checksall levels of the cache hierarchy—internal caches <strong>and</strong> external caches—<strong>and</strong>invalidates the cache line in every cache in which it is found. If a cache contains a dirtycopy of the cache line (that is, the cache line is in the modified or owned MOESI state),the line is written back to memory before it is invalidated. The instruction sets thecache-line MOESI state to invalid.The instruction also checks the physical address corresponding to the linear-addressoper<strong>and</strong> against the processor’s write-combining buffers. If the write-combiningbuffer holds data intended for that physical address, the instruction writes the entirecontents of the buffer to memory. This occurs even though the data is not cached inthe cache hierarchy. In a multiprocessor system, the instruction checks the writecombiningbuffers only on the processor that executed the CLFLUSH instruction.The CLFLUSH instruction is weakly-ordered with respect to other instructions thatoperate on memory. Speculative loads initiated by the processor, or specifiedexplicitly using cache-prefetch instructions, can be reordered around a CLFLUSHinstruction. Such reordering can cause freshly-loaded cache lines to be flushedunintentionally. The only way to avoid this situation is to use the MFENCE instructionto force strong-ordering of the CLFLUSH instruction with respect to other memoryoperations. The LFENCE, SFENCE, <strong>and</strong> serializing instructions are not ordered withrespect to CLFLUSH.The CLFLUSH instruction behaves like a load instruction with respect to setting thepage-table accessed <strong>and</strong> dirty bits. That is, it sets the page-table accessed bit to 1, butdoes not set the page-table dirty bit.The CLFLUSH instruction is supported if CPUID st<strong>and</strong>ard function 1 sets EDX bit 19.CPUID function 1 returns the CLFLUSH size in EBX bits 23:16. This value reports thesize of a line flushed by CLFLUSH in quadwords. See CPUID for details.The CLFLUSH instruction executes at any privilege level. CLFLUSH performs all thesegmentation <strong>and</strong> paging checks that a 1-byte read would perform, except that it alsoallows references to execute-only segments.Mnemonic Opcode DescriptionCFLUSH mem8 0F AE /7 flush cache line containing mem8.100 CLFLUSH

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!