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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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

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

Saved successfully!

Ooh no, something went wrong!