3-304
INSTRUCTION SET REFERENCE
INS/INSB/INSW/INSDInput from Port to String (Continued)
The INS, INSB, INSW, and INSD instructions can be preceded by the REP prefix for block input
of ECX bytes, words, or doublewords. Refer to REP/REPE/REPZ/REPNE /REPNZRepeat
String Operation Prefix in this chapter for a description of the REP prefix.
These instructions are only useful for accessing I/O ports located in the processors I/O address
space. Refer to Chapter 10, Input/Output of the Intel Architecture Software Developers Manual,
Volume 1, for more information on accessing I/O ports in the I/O address space.
Operation
IF ((PE = 1) AND ((CPL > IOPL) OR (VM = 1)))
THEN (* Protected mode with CPL > IOPL or virtual-8086 mode *)
IF (Any I/O Permission Bit for I/O port being accessed = 1)
THEN (* I/O operation is not allowed *)
#GP(0);
ELSE ( * I/O operation is allowed *)
DEST
<
SRC; (* Reads from I/O port *)
FI;
ELSE (Real Mode or Protected Mode with CPL
?
IOPL *)
DEST
<
SRC; (* Reads from I/O port *)
FI;
IF (byte transfer)
THEN IF DF = 0
THEN (E)DI
<
(E)DI + 1;
ELSE (E)DI
<
(E)DI 1;
FI;
ELSE IF (word transfer)
THEN IF DF = 0
THEN (E)DI
<
(E)DI + 2;
ELSE (E)DI
<
(E)DI 2;
FI;
ELSE (* doubleword transfer *)
THEN IF DF = 0
THEN (E)DI
<
(E)DI + 4;
ELSE (E)DI
<
(E)DI 4;
FI;
FI;
FI;
Flags Affected
None.