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 2005LFENCELoad FenceActs as a barrier to force strong memory ordering (serialization) between loadinstructions preceding the LFENCE and load instructions that follow the LFENCE. Aweakly-ordered memory system allows hardware to reorder reads and writes betweenthe processor and memory. The LFENCE instruction guarantees that the systemcompletes all previous loads before executing subsequent loads.The LFENCE instruction is weakly-ordered with respect to store instructions, dataand instruction prefetches, and the SFENCE instruction. Speculative loads initiatedby the processor, or specified explicitly using cache-prefetch instructions, can bereordered around an LFENCE.In addition to load instructions, the LFENCE instruction is strongly ordered withrespect to other LFENCE instructions, MFENCE instructions, and serializinginstructions.Support for the LFENCE instruction is indicated when the SSE2 bit (bit 26) is set to 1in EDX after executing CPUID standard function 1.Mnemonic Opcode DescriptionLFENCE 0F AE E8 Force strong ordering of (serialize) load operations.Related InstructionsMFENCE, SFENCErFLAGS AffectedNoneExceptionsException RealVirtual8086 Protected Cause of ExceptionInvalid opcode, #UD X X X The LFENCE instruction is not supported as indicated by EDX bit 26of CPUID standard function 1.186 LFENCE
24594 Rev. 3.10 February 2005 AMD64 TechnologyLODSLODSBLODSWLODSDLODSQLoad StringCopies the byte, word, doubleword, or quadword in the memory location pointed to bythe DS:rSI registers to the AL, AX, EAX, or RAX register, depending on the size of theoperand, and then increments or decrements the rSI register according to the state ofthe DF flag in the rFLAGS register.If the DF flag is 0, the instruction increments rSI; otherwise, it decrements rSI. Itincrements or decrements rSI by 1, 2, 4, or 8, depending on the number of bytes beingloaded.The forms of the LODS instruction with an explicit operand address the operand atseg:[rSI]. The value of seg defaults to the DS segment, but may be overridden by asegment prefix. The explicit operand serves only to specify the type (size) of the valuebeing copied and the specific registers used.The no-operands forms of the instruction always use the DS:[rSI] registers to point tothe value to be copied (they do not allow a segment prefix). The mnemonic determinesthe size of the operand and the specific registers used.The LODSx instructions support the REP prefixes. For details about the REP prefixes,see “Repeat Prefixes” on page 10. More often, software uses the LODSx instructioninside a loop controlled by a LOOPcc instruction as a more efficient replacement forinstructions like:mov eax, dword ptr ds:[esi]add esi, 4The LODSQ instruction can only be used in 64-bit mode.Mnemonic Opcode DescriptionLODS mem8 AC Load byte at DS:rSI into AL and then increment or decrement rSI.LODS mem16LODS mem32ADADLoad word at DS:rSI into AX and then increment or decrementrSI.Load doubleword at DS:rSI into EAX and then increment ordecrement rSI.LODSx 187
- 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
- Page 180 and 181: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 182 and 183: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 184 and 185: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 186 and 187: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 188 and 189: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 190 and 191: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 192 and 193: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 194 and 195: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 196 and 197: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 198 and 199: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 200 and 201: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 202 and 203: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 204 and 205: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 206 and 207: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 208 and 209: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 210 and 211: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 212 and 213: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 214 and 215: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 218 and 219: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 220 and 221: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 222 and 223: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 224 and 225: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 226 and 227: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 228 and 229: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 230 and 231: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 232 and 233: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 234 and 235: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 236 and 237: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 238 and 239: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 240 and 241: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 242 and 243: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 244 and 245: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 246 and 247: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 248 and 249: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 250 and 251: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 252 and 253: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 254 and 255: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 256 and 257: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 258 and 259: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 260 and 261: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 262 and 263: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 264 and 265: AMD64 Technology 24594 Rev. 3.10 Fe
24594 Rev. 3.10 February 2005 AMD64 TechnologyLODSLODSBLODSWLODSDLODSQLoad StringCopies the byte, word, doubleword, or quadword in the memory location pointed to bythe DS:rSI registers to the AL, AX, EAX, or RAX register, depending on the size of theoper<strong>and</strong>, <strong>and</strong> then increments or decrements the rSI register according to the state ofthe DF flag in the rFLAGS register.If the DF flag is 0, the instruction increments rSI; otherwise, it decrements rSI. Itincrements or decrements rSI by 1, 2, 4, or 8, depending on the number of bytes beingloaded.The forms of the LODS instruction with an explicit oper<strong>and</strong> address the oper<strong>and</strong> atseg:[rSI]. The value of seg defaults to the DS segment, but may be overridden by asegment prefix. The explicit oper<strong>and</strong> serves only to specify the type (size) of the valuebeing copied <strong>and</strong> the specific registers used.The no-oper<strong>and</strong>s forms of the instruction always use the DS:[rSI] registers to point tothe value to be copied (they do not allow a segment prefix). The mnemonic determinesthe size of the oper<strong>and</strong> <strong>and</strong> the specific registers used.The LODSx instructions support the REP prefixes. For details about the REP prefixes,see “Repeat Prefixes” on page 10. More often, software uses the LODSx instructioninside a loop controlled by a LOOPcc instruction as a more efficient replacement forinstructions like:mov eax, dword ptr ds:[esi]add esi, 4The LODSQ instruction can only be used in 64-bit mode.Mnemonic Opcode DescriptionLODS mem8 AC Load byte at DS:rSI into AL <strong>and</strong> then increment or decrement rSI.LODS mem16LODS mem32ADADLoad word at DS:rSI into AX <strong>and</strong> then increment or decrementrSI.Load doubleword at DS:rSI into EAX <strong>and</strong> then increment ordecrement rSI.LODSx 187