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 TechnologyINSINSBINSWINSDInput StringTransfers data from the I/O port specified in the DX register to an input bufferspecified in the rDI register <strong>and</strong> increments or decrements the rDI register accordingto the setting of the DF flag in the rFLAGS register.If the DF flag is 0, the instruction increments rDI by 1, 2, or 4, depending on thenumber of bytes read. If the DF flag is 1, it decrements the pointer by 1, 2, or 4.In 16-bit <strong>and</strong> 32-bit mode, the INS instruction always uses ES as the data segment. TheES segment cannot be overridden with a segment override prefix. In 64-bit mode, INSalways uses the unsegmented memory space.The INS instructions use the explicit memory oper<strong>and</strong> (first oper<strong>and</strong>) to determinethe size of the I/O port, but always use ES:[rDI] for the location of the input buffer. Theexplicit register oper<strong>and</strong> (second oper<strong>and</strong>) specifies the I/O port address <strong>and</strong> mustalways be DX.The INSB, INSW, <strong>and</strong> INSD instructions copy byte, word, <strong>and</strong> doubleword data,respectively, from the I/O port (0000h to FFFFh) specified in the DX register to theinput buffer specified in the ES:rDI registers.If the oper<strong>and</strong> size is 64-bits, the instruction behaves as if the oper<strong>and</strong> size were 32-bits.If the CPL is higher than the IOPL or the mode is virtual mode, INSx 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.)The INSx instructions support the REP prefix for block input of rCX bytes, words, ordoublewords. For details about the REP prefix, see “Repeat Prefixes” on page 10.INSx 153

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

Saved successfully!

Ooh no, something went wrong!