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 2005Segment Overrides in 64-Bit Mode. In 64-bit mode, the CS, DS, ES,<strong>and</strong> SS segment-override prefixes have no effect. These fourprefixes are not treated as segment-override prefixes for thepurposes of multiple-prefix rules. Instead, they are treated asnull prefixes.The FS <strong>and</strong> GS segment-override prefixes are treated as truesegment-override prefixes in 64-bit mode. Use of the FS or GSprefix causes their respective segment bases to be added to theeffective address calculation. See “FS <strong>and</strong> GS Registers in 64-Bit Mode” in <strong>Volume</strong> 2 for details.1.2.5 Lock Prefix The LOCK prefix causes certain kinds of memory read-modifywriteinstructions to occur atomically. The mechanism for doingso is implementation-dependent (for example, the mechanismmay involve bus signaling or packet messaging between theprocessor <strong>and</strong> a memory controller). The prefix is intended togive the processor exclusive use of shared memory in amultiprocessor system.The LOCK prefix can only be used with forms of the followinginstructions that write a memory oper<strong>and</strong>: ADC, ADD, AND,BTC, BTR, BTS, CMPXCHG, CMPXCHG8B, DEC, INC, NEG,NOT, OR, SBB, SUB, XADD, XCHG, <strong>and</strong> XOR. An invalidopcodeexception occurs if the LOCK prefix is used with anyother instruction.1.2.6 Repeat Prefixes The repeat prefixes cause repetition of certain instructions thatload, store, move, input, or output strings. The prefixes shouldonly be used with such string instructions. Two pairs of repeatprefixes, REPE/REPZ <strong>and</strong> REPNE/REPNZ, perform the samerepeat functions for certain compare-string <strong>and</strong> scan-stringinstructions. The repeat function uses rCX as a count register.The size of rCX is based on address size, as shown in Table 1-4on page 8.REP. The REP prefix repeats its associated string instruction thenumber of times specified in the counter register (rCX). Itterminates the repetition when the value in rCX reaches 0. Theprefix can only be used with the INS, LODS, MOVS, OUTS, <strong>and</strong>STOS instructions. Table 1-6 shows the valid REP prefixopcodes.10 Chapter 1: Instruction Formats

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

Saved successfully!

Ooh no, something went wrong!