Volume 3: General-Purpose and System Instructions - Stanford ...
Volume 3: General-Purpose and System Instructions - Stanford ... Volume 3: General-Purpose and System Instructions - Stanford ...
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 and external caches—andinvalidates 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-addressoperand 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, and serializing instructions are not ordered withrespect to CLFLUSH.The CLFLUSH instruction behaves like a load instruction with respect to setting thepage-table accessed and 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 standard 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 and 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
24594 Rev. 3.10 February 2005 AMD64 TechnologyRelated InstructionsINVD, WBINVDrFLAGS AffectedNoneExceptionsException (vector) RealVirtual8086 Protected Cause of ExceptionInvalid opcode, #UD X X X The CLFLUSH instruction is not supported, as indicated byEDX bit 19 of CPUID standard function 1.Stack, #SS X X X A memory address exceeded the stack segment limit or wasnon-canonical.General protection, #GP X X XA memory address exceeded a data segment limit or wasnon-canonical.X A null data segment was used to reference memory.Page fault, #PF X X A page fault resulted from the execution of the instruction.CLFLUSH 101
- Page 80 and 81: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 82 and 83: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 84 and 85: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 86 and 87: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 88 and 89: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 90 and 91: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 92 and 93: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 94 and 95: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 96 and 97: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 98 and 99: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 100 and 101: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 102 and 103: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 104 and 105: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 106 and 107: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 108 and 109: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 110 and 111: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 112 and 113: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 114 and 115: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 116 and 117: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 118 and 119: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 120 and 121: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 122 and 123: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 124 and 125: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 126 and 127: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 128 and 129: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 132 and 133: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 134 and 135: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 136 and 137: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 138 and 139: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 140 and 141: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 142 and 143: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 144 and 145: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 146 and 147: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 148 and 149: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 150 and 151: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 152 and 153: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 154 and 155: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 156 and 157: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 158 and 159: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 160 and 161: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 162 and 163: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 164 and 165: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 166 and 167: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 168 and 169: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 170 and 171: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 172 and 173: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 174 and 175: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 176 and 177: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 178 and 179: AMD64 Technology 24594 Rev. 3.10 Fe
24594 Rev. 3.10 February 2005 AMD64 TechnologyRelated <strong>Instructions</strong>INVD, WBINVDrFLAGS AffectedNoneExceptionsException (vector) RealVirtual8086 Protected Cause of ExceptionInvalid opcode, #UD X X X The CLFLUSH instruction is not supported, as indicated byEDX bit 19 of CPUID st<strong>and</strong>ard function 1.Stack, #SS X X X A memory address exceeded the stack segment limit or wasnon-canonical.<strong>General</strong> protection, #GP X X XA memory address exceeded a data segment limit or wasnon-canonical.X A null data segment was used to reference memory.Page fault, #PF X X A page fault resulted from the execution of the instruction.CLFLUSH 101