Intel 64 and IA-32 Architectures Software Developers Manual Volume 1, Basic Architecture
7-28 Vol. 1
PROGRAMMING WITH GENERAL-PURPOSE INSTRUCTIONS
The block I/O instructions (INS and OUTS) instructions move blocks of data (strings)
between an I/O port and memory. These instructions operate similar to the string
instructions (see Section 7.3.9, “String Operations”). The ESI and EDI registers are
used to specify string elements in memory and the repeat prefixes (REP) are used to
repeat the instructions to implement block moves. The assembler recognizes the
following alternate mnemonics for these instructions: INSB (input byte), INSW (input
word), and INSD (input doubleword), and OUTB (output byte), OUTW (output word),
and OUTD (output doubleword).
The INS and OUTS instructions use an address in the DX register to specify the I/O
port to be read or written to.
7.3.12 I/O Instructions in 64-Bit Mode
For I/O instructions to and from memory, the differences in 64-bit mode are:
• The source operand is specified by RSI or DS:ESI, depending on the address size
attribute of the operation.
• The destination operand is specified by RDI or DS:EDI, depending on the address
size attribute of the operation.
• Operation on 64-bit data is not encodable and REX prefixes are silently ignored.
7.3.13 Enter and Leave Instructions
The ENTER and LEAVE instructions provide machine-language support for procedure
calls in block-structured languages, such as C and Pascal. These instructions and the
call and return mechanism that they support are described in detail in Section 6.5,
“Procedure Calls for Block-Structured Languages”.
7.3.14 Flag Control (EFLAG) Instructions
The Flag Control (EFLAG) instructions allow the state of selected flags in the EFLAGS
register to be read or modified. For the purpose of this discussion, these instructions
are further divided subordinate subgroups of instructions that manipulate:
• Carry and direction flags
• The EFLAGS register
• Interrupt flags
7.3.14.1 Carry and Direction Flag Instructions
The STC (set carry flag), CLC (clear carry flag), and CMC (complement carry flag)
instructions allow the CF flags in the EFLAGS register to be modified directly. They
are typically used to initialize the CF flag to a known state before an instruction that