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 2005rFLAGS AffectedID VIP VIF AC VM RF NT IOPL OF DF IF TF SF ZF AF PF CFExceptions0 M M U M 021 20 19 18 17 16 14 13–12 11 10 9 8 7 6 4 2 0Note: Bits 31–22, 15, 5, 3, and 1 are reserved. A flag set to 1 or cleared to 0 is M (modified). Unaffected flags are blank. Undefinedflags are U.Exception RealVirtual8086 Protected Cause of ExceptionStack, #SS X X X A memory address exceeded the stack segment limit or was noncanonical.General protection,#GPX X XA memory address exceeded a data segment limit or was non-canonical.XThe destination operand was in a non-writable segment.X A null data segment was used to reference memory.Page fault, #PF X X A page fault resulted from the execution of the instruction.Alignment check, #AC X X An unaligned memory reference was performed while alignmentchecking was enabled.218 OR
24594 Rev. 3.10 February 2005 AMD64 TechnologyOUTOutput to PortCopies the value from the AL, AX, or EAX register (second operand) to an I/O port(first operand). The port address can be a byte-immediate value (00h to FFh) or thevalue in the DX register (0000h to FFFFh). The source register used determines thesize of the port (8, 16, or 32 bits).If the operand size is 64 bits, OUT only writes to a 32-bit I/O port.If the CPL is higher than the IOPL or the mode is virtual mode, OUT checks the I/Opermission bitmap in the TSS before allowing access to the I/O port. See Volume 2 fordetails on the TSS I/O permission bitmap.Mnemonic Opcode DescriptionOUT imm8, ALOUT imm8, AXOUT imm8, EAXRelated InstructionsIN, INSx, OUTSxrFLAGS AffectedNoneE6 ibE7 ibE7 ibOutput the byte in the AL register to the port specified by an 8-bitimmediate value.Output the word in the AX register to the port specified by an 8-bit immediate value.Output the doubleword in the EAX register to the port specifiedby an 8-bit immediate value.OUT DX, AL EE Output byte in AL to the output port specified in DX.OUT DX, AX EF Output word in AX to the output port specified in DX.OUT DX, EAX EF Output doubleword in EAX to the output port specified in DX.OUT 219
- 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 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 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
- 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
24594 Rev. 3.10 February 2005 AMD64 TechnologyOUTOutput to PortCopies the value from the AL, AX, or EAX register (second oper<strong>and</strong>) to an I/O port(first oper<strong>and</strong>). The port address can be a byte-immediate value (00h to FFh) or thevalue in the DX register (0000h to FFFFh). The source register used determines thesize of the port (8, 16, or 32 bits).If the oper<strong>and</strong> size is 64 bits, OUT only writes to a 32-bit I/O port.If the CPL is higher than the IOPL or the mode is virtual mode, OUT checks the I/Opermission bitmap in the TSS before allowing access to the I/O port. See <strong>Volume</strong> 2 fordetails on the TSS I/O permission bitmap.Mnemonic Opcode DescriptionOUT imm8, ALOUT imm8, AXOUT imm8, EAXRelated <strong>Instructions</strong>IN, INSx, OUTSxrFLAGS AffectedNoneE6 ibE7 ibE7 ibOutput the byte in the AL register to the port specified by an 8-bitimmediate value.Output the word in the AX register to the port specified by an 8-bit immediate value.Output the doubleword in the EAX register to the port specifiedby an 8-bit immediate value.OUT DX, AL EE Output byte in AL to the output port specified in DX.OUT DX, AX EF Output word in AX to the output port specified in DX.OUT DX, EAX EF Output doubleword in EAX to the output port specified in DX.OUT 219