10-5
INPUT/OUTPUT
exception (#GP) being signaled. Because each task has its own copy of the EFLAGS register,
each task can have a different IOPL.
The I/O permission bit map in the TSS can be used to modify the effect of the IOPL on I/O sensi-
tive instructions, allowing access to some I/O ports by less privileged programs or tasks (refer
to Section 10.5.2.).
A program or task can change its IOPL only with the POPF and IRET instructions; however,
such changes are privileged. No procedure may change the current IOPL unless it is running at
privilege level 0. An attempt by a less privileged procedure to change the IOPL does not result
in an exception; the IOPL simply remains unchanged.
The POPF instruction also may be used to change the state of the IF flag (as can the CLI and
STI instructions); however, the POPF instruction in this case is also I/O sensitive. A procedure
may use the POPF instruction to change the setting of the IF flag only if the CPL is less than or
equal to the current IOPL. An attempt by a less privileged procedure to change the IF flag does
not result in an exception; the IF flag simply remains unchanged.
10.5.2.I/O Permission Bit Map
The I/O permission bit map is a device for permitting limited access to I/O ports by less privi-
leged programs or tasks and for tasks operating in virtual-8086 mode. The I/O permission bit
map is located in the TSS (refer to Figure 10-2) for the currently running task or program. The
address of the first byte of the I/O permission bit map is given in the I/O map base address field
of the TSS. The size of the I/O permission bit map and its location in the TSS are variable.
Because each task has its own TSS, each task has its own I/O permission bit map. Access to indi-
vidual I/O ports can thus be granted to individual tasks.
Figure 10-2. I/O Permission Bit Map
I/O Map Base
Task State Segment (TSS)
64H
31
2423
0
1
1
1
1
1
1
1
1
I/O Permission Bit Map
0
I/O base map must
not exceed DFFFH.
Last byte of bit
map must be
followed by a byte
with all bits set