The information in this article applies to:
SUMMARY
The Intel architecture defines "privileged" instructions and "sensitive"
instructions. The privileged instructions may only be executed when the
Current Privilege Level is zero (CPL = 0). Attempting to execute a
privileged instruction when CPL != 0 will generate a general protection
(GP) exception. Windows traps GP exceptions caused by executing
privileged instructions and usually generates an application error.
MORE INFORMATIONThe privileged instructions include:
The sensitive instructions in protected mode include:
The instruction POPF is both IOPL and CPL sensitive. IOPL will only be
changed by POPF when executed at CPL = 0. The interrupt flag (IF) will
only be changed by POPF if executed with CPL <= IOPL. If POPF does not
change IOPL or the interrupt flag due to lack of privilege, no exception
is generated.
The sensitive instructions V86 mode include:
The CPL = 3 by definition in V86 mode. If IOPL < 3, attempting to execute
V86 mode sensitive instructions will generate a GP exception. The
Windows VMM will trap the GP exception and emulate the instruction in
the VM in which it was originally executed.
I/O instructions are special in that they are sensitive not only to IOPL, but also to the IO permission bitmap in the Task State Segment (TSS). If CPL <= IOPL, then the I/O operation will proceed without checking the I/O permission bitmap. If CPL > IOPL, or if in V86 mode, then the I/O permission bitmap is consulted. If the bits corresponding to the I/O port are clear, the I/O operation proceeds, otherwise, a GP exception is generated. In response to this GP exception, the VMM gets control and dispatches control to the VxD that traps the port. REFERENCEFor additional information, please see the following article(s) in the Microsoft Knowledge Base: Q100947 Port Trapping in Windows 3.0/3.1 Q112298 DOCERR: Port I/O with inp() and outp() Fails on Windows NTAlso see the Intel "i486(TM) Microprocessor Programmer's Reference Manual" and the section "The Effect of Priviledge Levels" in the article "The Tao of Interrupts" on the Microsoft Developer Network (MSDN) Development Library CD. Additional query words: 3.10
Keywords : kb16bitonly |
Last Reviewed: November 10, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |