Tuesday, February 22, 2022

[SOLVED] inl instruction in __asm__

Issue

Been going through the linux kernel code and I have seen this:

__asm__("inl (%%dx)..."

Been trying to look it up online but couldnt find any docs on this instruction.

Its supposed to be something related to I/O.


Solution

It is the IN instruction with a 16-bit port argument (%dx) and a 32-bit destination value (%eax):

OpCode  Instruction  Op/En  64-Bit Mode     Compat/Leg Mode  Description
ED      IN EAX,DX    ZO     Valid           Valid            Input doubleword from I/O port in DX into EAX.

It reads a DWORD from the I/O address space.



Answered By - zx485
Answer Checked By - Cary Denson (WPSolving Admin)