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.

24594 Rev. 3.10 February 2005 AMD64 TechnologyBTRBit Test <strong>and</strong> ResetCopies a bit, specified by a bit index in a register or 8-bit immediate value (secondoper<strong>and</strong>), from a bit string (first oper<strong>and</strong>), also called the bit base, to the carry flag(CF) of the rFLAGS register, <strong>and</strong> then clears the bit in the bit string to 0.If the bit base oper<strong>and</strong> is a register, the instruction uses the modulo 16, 32, or 64(depending on the oper<strong>and</strong> size) of the bit index to select a bit in the register.If the bit base oper<strong>and</strong> is a memory location, bit 0 of the byte at the specified addressis the bit base of the bit string. If the bit index is in a register, the instruction selects abit position relative to the bit base in the range –2 63 to +2 63 – 1 if the oper<strong>and</strong> size is64, –2 31 to +2 31 – 1, if the oper<strong>and</strong> size is 32, <strong>and</strong> –2 15 to +2 15 – 1 if the oper<strong>and</strong> size is16. If the bit index is in an immediate value, the bit selected is that value modulo 16,32, or 64, depending on the oper<strong>and</strong> size.This instruction is useful for implementing semaphores in concurrent operatingsystems. Such applications should precede this instruction with the LOCK prefix. Fordetails about the LOCK prefix, see “Lock Prefix” on page 10.Mnemonic Opcode DescriptionBTR reg/mem16, reg16 0F B3 /rBTR reg/mem32, reg32 0F B3 /rBTR reg/mem64, reg64 0F B3 /rBTR reg/mem16, imm80F BA /6 ibBTR reg/mem32, imm80F BA /6 ibBTR reg/mem64, imm80F BA /6 ibCopy the value of the selected bit to the carry flag, then clear theselected bit.Copy the value of the selected bit to the carry flag, then clear theselected bit.Copy the value of the selected bit to the carry flag, then clear theselected bit.Copy the value of the selected bit to the carry flag, then clear theselected bit.Copy the value of the selected bit to the carry flag, then clear theselected bit.Copy the value of the selected bit to the carry flag, then clear theselected bit.Related <strong>Instructions</strong>BT, BTC, BTSBTR 83

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

Saved successfully!

Ooh no, something went wrong!