Misplaced Pages

Unreal mode

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.

This is an old revision of this page, as edited by Fnagaton (talk | contribs) at 13:53, 29 October 2007 (MOSNUM Don't change types.). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Revision as of 13:53, 29 October 2007 by Fnagaton (talk | contribs) (MOSNUM Don't change types.)(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
Part of a series on
Microprocessor modes for the x86 architecture
First supported platform shown in parentheses

Unreal mode, also big real mode, huge real mode, or flat real mode, is a variant of real mode (PE=0), in which one or more data segment registers have been loaded with 32-bit addresses and limits. Contrary to its name, it is a not a separate addressing mode that the x86 and x86-64 processors can operate in. It is used in the 80386 and later x86 processors.

Overview

For efficiency reasons, the 80386 and later x86 processors use the base address stored in their internal "descriptor" cache whenever accessing memory, regardless if they are operating in real or protected mode. The "selector", i.e. the 16-bit "segment number" visible to the programmer is used once, while reloading a segment register, to update the various fields of the respective "descriptor", and then is simply disregarded.

Some DOS extenders use this feature to address the high memory. It was used by many computer games in the 1990 to 1995 time frame, since it allowed programmers to use more memory than in real mode, which is restricted to 1 MB (640 KB usable), but still access the DOS operating system, which doesn't work in protected mode. After the introduction of Windows 95 unreal mode quickly fell out of favour as programs using it cannot be run in the DOS prompt of Microsoft Windows; they require a "Restart in MS-DOS mode" in Windows 95 and 98, and cannot be run at all on NT and later Windows systems. For those operating systems, an emulator such as DOSBox is the only way to run programs designed for unreal mode. Unreal mode is still extensively used by BIOS code.

Enabling Unreal Mode

To enable unreal mode, the program has to enter protected mode, locate a flat descriptor in the GDT or LDT or create such, load some of the segment registers with the respective protected mode "selector", then cancel back protected mode. When jumping back to RM, the processor will continue using the cached descriptors as established in PM - thus allowing access to 4 GB of "extended" memory from inside real mode.

A bug?

The Intel 80386 Programmers Reference Manual (section 14.5, page 210) from 1986 does not contain any information about what happens if the programmer does not follow the guidelines when returning to real mode. Thus unreal mode could be described as originally being a side-effect or a bug. However, code that makes use of unreal mode can run without changes on modern processors as well, provided that the the code is not executed in virtual 8086-mode.

See also

Categories: