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 2005Mnemonic Opcode DescriptionOUTSBOUTSWOUTSDRelated InstructionsIN, INSx, OUTrFLAGS AffectedNoneExceptions6E6F6FOutput the byte in DS:rSI to the port specified in DX, thenincrement or decrement rSI.Output the word in DS:rSI to the port specified in DX, thenincrement or decrement rSI.Output the doubleword in DS:rSI to the port specified in DX, thenincrement or decrement rSI.Exception RealVirtual8086 Protected Cause of ExceptionStack, #SS X X X A memory address exceeded the stack segment limit or was noncanonical.General protection,#GPXXXA memory address exceeded a data segment limit or was non-canonical.XA null data segment was used to reference memory.XOne or more I/O permission bits were set in the TSS for the accessedport.X The CPL was greater than the IOPL and one or more I/O permissionbits were set in the TSS for the accessed port.Page fault, #PF X X A page fault resulted from the execution of the instruction.Alignment check, #AC X X An unaligned memory reference is performed while alignmentchecking was enabled.222 OUTSx
24594 Rev. 3.10 February 2005 AMD64 TechnologyPOPPop StackCopies the value pointed to by the stack pointer (SS:rSP) to the specified register ormemory location and then increments the rSP by 2 for a 16-bit pop, 4 for a 32-bit pop,or 8 for a 64-bit pop.The operand-size attribute determines the amount by which the stack pointer isincremented (2,4 or 8 bytes). The stack-size attribute determines whether SP, ESP, orRSP is incremented.For forms of the instruction that load a segment register (POP DS, POP ES, POP FS,POP GS, POP SS), the source operand must be a valid segment selector. When asegment selector is popped into a segment register, the processor also loads allassociated descriptor information into the hidden part of the register and validates it.It is possible to pop a null segment selector value (0000–0003h) into the DS, ES, FS, orGS register. This action does not cause a general protection fault, but a subsequentreference to such a segment does cause a #GP exception. For more information aboutsegment selectors, see “Segment Selectors and Registers” on page 82.In 64-bit mode, the POP operand size defaults to 64 bits and there is no prefixavailable to encode a 32-bit operand size. Using POP DS, POP ES, or POP SSinstruction in 64-bit mode generates an invalid-opcode exception.This instruction cannot pop a value into the CS register. The RET (Far) instructionperforms this function.Mnemonic Opcode DescriptionPOP reg/mem16 8F /0 Pop the top of the stack into a 16-bit register or memory location.POP reg/mem32 8F /0Pop the top of the stack into a 32-bit register or memory location.(No prefix for encoding this in 64-bit mode.)POP reg/mem64 8F /0 Pop the top of the stack into a 64-bit register or memory location.POP reg16 58 +rw Pop the top of the stack into a 16-bit register.POP reg3258 +rdPop the top of the stack into a 32-bit register.(No prefix for encoding this in 64-bit mode.)POP reg64 58 +rq Pop the top of the stack into a 64-bit register.POP DS1FPop the top of the stack into the DS register.(Invalid in 64-bit mode.)POP 223
- 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 216 and 217: 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 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
- Page 266 and 267: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 268 and 269: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 270 and 271: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 272 and 273: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 274 and 275: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 276 and 277: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 278 and 279: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 280 and 281: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 282 and 283: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 284 and 285: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 286 and 287: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 288 and 289: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 290 and 291: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 292 and 293: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 294 and 295: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 296 and 297: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 298 and 299: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 300 and 301: AMD64 Technology 24594 Rev. 3.10 Fe
24594 Rev. 3.10 February 2005 AMD64 TechnologyPOPPop StackCopies the value pointed to by the stack pointer (SS:rSP) to the specified register ormemory location <strong>and</strong> then increments the rSP by 2 for a 16-bit pop, 4 for a 32-bit pop,or 8 for a 64-bit pop.The oper<strong>and</strong>-size attribute determines the amount by which the stack pointer isincremented (2,4 or 8 bytes). The stack-size attribute determines whether SP, ESP, orRSP is incremented.For forms of the instruction that load a segment register (POP DS, POP ES, POP FS,POP GS, POP SS), the source oper<strong>and</strong> must be a valid segment selector. When asegment selector is popped into a segment register, the processor also loads allassociated descriptor information into the hidden part of the register <strong>and</strong> validates it.It is possible to pop a null segment selector value (0000–0003h) into the DS, ES, FS, orGS register. This action does not cause a general protection fault, but a subsequentreference to such a segment does cause a #GP exception. For more information aboutsegment selectors, see “Segment Selectors <strong>and</strong> Registers” on page 82.In 64-bit mode, the POP oper<strong>and</strong> size defaults to 64 bits <strong>and</strong> there is no prefixavailable to encode a 32-bit oper<strong>and</strong> size. Using POP DS, POP ES, or POP SSinstruction in 64-bit mode generates an invalid-opcode exception.This instruction cannot pop a value into the CS register. The RET (Far) instructionperforms this function.Mnemonic Opcode DescriptionPOP reg/mem16 8F /0 Pop the top of the stack into a 16-bit register or memory location.POP reg/mem32 8F /0Pop the top of the stack into a 32-bit register or memory location.(No prefix for encoding this in 64-bit mode.)POP reg/mem64 8F /0 Pop the top of the stack into a 64-bit register or memory location.POP reg16 58 +rw Pop the top of the stack into a 16-bit register.POP reg3258 +rdPop the top of the stack into a 32-bit register.(No prefix for encoding this in 64-bit mode.)POP reg64 58 +rq Pop the top of the stack into a 64-bit register.POP DS1FPop the top of the stack into the DS register.(Invalid in 64-bit mode.)POP 223