IOPL
Encyclopedia
The IOPL flag is a flag found on all IA-32 compatible x86 CPUs
. It occupies bits 12 and 13 in the FLAGS register
. In protected mode
and long mode
, it shows the I/O privilege level of the current program or task. The CPL (Current Privilege Level)
of the task or program must be less than or equal to the IOPL in order for the task or program to access I/O ports.
The IOPL can be changed using PUSHF and POPF only when the current privilege level is Ring 0.
Besides IOPL, the I/O Port Permissions in the TSS also take part in determining the ability of a task to access an I/O port.
X86 architecture
The term x86 refers to a family of instruction set architectures based on the Intel 8086 CPU. The 8086 was launched in 1978 as a fully 16-bit extension of Intel's 8-bit based 8080 microprocessor and also introduced segmentation to overcome the 16-bit addressing barrier of such designs...
. It occupies bits 12 and 13 in the FLAGS register
FLAGS register (computing)
The FLAGS register is the status register in Intel x86 microprocessors that contains the current state of the processor. This register is 16 bits wide. Its successors, the EFLAGS and RFLAGS registers, are 32 bits and 64 bits wide, respectively...
. In protected mode
Protected mode
In computing, protected mode, also called protected virtual address mode, is an operational mode of x86-compatible central processing units...
and long mode
Long mode
In the x86-64 computer architecture, long mode is the mode where a 64-bit application can access 64-bit instructions and registers...
, it shows the I/O privilege level of the current program or task. The CPL (Current Privilege Level)
Privilege level
A privilege level in the x86 instruction set controls the access of the program currently running on the processor to resources such as memory regions, I/O ports, and special instructions. There are 4 privilege levels ranging from 0 which is the most privileged, to 3 which is least privileged...
of the task or program must be less than or equal to the IOPL in order for the task or program to access I/O ports.
The IOPL can be changed using PUSHF and POPF only when the current privilege level is Ring 0.
Besides IOPL, the I/O Port Permissions in the TSS also take part in determining the ability of a task to access an I/O port.