Protected mode, also known as 386 Enhanced Mode is currently the main mode of operation for x86 processors. It was introduced in current form on the Intel 80386, in 1986, and has been present relatively unchanged since then. Before the 386, the 80286 had a protected mode, but it had fewer benefits and was more difficult to use, so it was rarely used. Protected mode was designed to work around the shortcomings of the original 8086 processor, and to leverage the full 32-bit nature of the 386. The original, non-protected mode is called real mode.

Protected mode, unlike real mode, uses a flat address space to access the memory in the system. A protected mode address is just a 32-bit integer, allowing 4GB of memory to be used without modification. In comparison, real mode uses a segmented address space where the address supplied by the program is combined with a 'segment register' to form the memory address. This scheme is messily implemented but allows the 16-bit 8086 and 80286 to have a 20-bit, 1MB address space. Extensions such as EMS and XMS provide extra memory, at the cost of speed and ease of programming, but protected mode fixes the address space problem cleanly. (XMS is in fact just protected mode addressing in disguise.)

Protected mode gets its name from its connection to the 386's MMU, which allows a system of protected memory and virtual memory to be created. The now unused segment registers become indices into a table (called the GDT or LDT) describing memory page properties and permissions. The memory block properties are combined with the running program's addresses to create a virtual 32-bit address space mapped to physical memory by the segment registers. These features can be used by a modern operating system such as Linux or Windows NT to create effective protected and virtual memory.

Inside protected mode, memory pages can be set to contain either 16-bit or 32-bit code. The GDT/LDT entry for each memory block contains a flag which determines which of these it contains. However, 16-bit and 32-bit code are deeply incompatible, and are difficult to mix in the same program. This causes problems for operating system initialisation, as the processor boots in 16-bit real mode. A messy kluge called unreal mode can be used for part of this, but there is still quite a bit of very obscure code in an operating system boot sequence. Other incompatibilities prevent the use of the BIOS in protected mode.

In recent years, problems with x86 protected mode have arisen. Foremost among these is the limitation to 4GB of memory. Many x86-based servers now need more memory than that. Intel's answer has been PAE, the Physical Address Extension, which enables the use of up to 24GB of RAM. It is considered a rather messy solution, in the same way as the original x86 real mode was. A more elegant solution appears in AMD's x86-64 architecture, which extends the x86 architecture to be 64-bit. x86-64 CPUs have a mode called long mode, where the full 64-bit capabilities of the chip are available, including a 40-bit (1TB) physical address space. In 2004, Intel recognised the long-term power of the x86-64 solution and (quietly) added it to their processors under the name EM64T.

The gory details of protected mode and its features can be found at http://www.embedded.com/98/9804fe4.htm


(CC)
This writeup is copyright 2003 D.G. Roberge and is released under the Creative Commons Attribution-NonCommercial-ShareAlike licence. Details can be found at http://creativecommons.org/licenses/by-nc-sa/2.0/ .

Log in or register to write something here or to contact authors.