Unreal mode
Encyclopedia
In x86 computing
, 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 not a separate addressing mode that the x86-32 and x86-64
processors can operate in. It is used in the 80386 and later x86 processors.
cache whenever accessing memory, regardless of whether 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 base address of the respective descriptor.
Some DOS extender
s use this feature to address the high memory
. It was used by many computer games in the 1990-to-1995 time frame, because it allowed programmers to address more memory than in real mode (only 1 MiB
; only 640 KiB
usable on IBM PC-compatible machines), without losing access to the DOS
operating system (which doesn't work in protected mode). After the introduction of Windows 95
, unreal mode quickly fell out of favor because programs using it cannot 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. In particular the SMM mode in Intel 386SL and later processors places the processor in unreal mode.
, find or create a flat descriptor in the GDT
or LDT
, load some of the data segment registers with the respective protected mode "selector", and then switch back to real mode. After returning to real mode, the processor will continue using the cached descriptors as established in protected mode, thus allowing access to 4 GiB of "extended" memory from real mode.
There is a time penalty for leaving protected mode on the 286, because the CPU must be reset. Undocumented features of the CPU, such as LOADALL
, can be used to enter unreal mode more quickly.
"Huge" real mode is attained by, in addition, loading the code selector (CS) from a descriptor allowing access to the whole memory and having the 32-bit attribute ("D" bit) set to one. This rarely used "mode" presents some advantages but it is more difficult to set up, since real mode interrupts do not automatically preserve the high sixteen bits of the extended instruction pointer, EIP.
Computing
Computing is usually defined as the activity of using and improving computer hardware and software. It is the computer-specific part of information technology...
, unreal mode, also big real mode, huge real mode, or flat real mode, is a variant of real mode
Real mode
Real mode, also called real address mode, is an operating mode of 80286 and later x86-compatible CPUs. Real mode is characterized by a 20 bit segmented memory address space and unlimited direct software access to all memory, I/O addresses and peripheral hardware...
(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 not a separate addressing mode that the x86-32 and x86-64
X86-64
x86-64 is an extension of the x86 instruction set. It supports vastly larger virtual and physical address spaces than are possible on x86, thereby allowing programmers to conveniently work with much larger data sets. x86-64 also provides 64-bit general purpose registers and numerous other...
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 segment descriptorSegment descriptor
In memory addressing for Intel x86 computer architectures, segment descriptors are a part of the segmentation unit, used for translating a logical address to a linear address...
cache whenever accessing memory, regardless of whether 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 base address of the respective descriptor.
Some DOS extender
DOS extender
A DOS extender is a computer software program which enables software to run under a protected mode environment even though the host operating system is only capable of operating in real mode....
s use this feature to address the high memory
High memory
High Memory is the part of physical memory in a computer which is not directly mapped by the page tables of its operating system kernel. The phrase is also sometimes used as shorthand for the High Memory Area, which is a different concept entirely....
. It was used by many computer games in the 1990-to-1995 time frame, because it allowed programmers to address more memory than in real mode (only 1 MiB
Mebibyte
The mebibyte is a multiple of the unit byte for digital information. The binary prefix mebi means 220, therefore 1 mebibyte is . The unit symbol for the mebibyte is MiB. The unit was established by the International Electrotechnical Commission in 2000 and has been accepted for use by all major...
; only 640 KiB
Kibibyte
The kibibyte is a multiple of the unit byte for quantities of digital information. The binary prefix kibi means 1024; therefore, 1 kibibyte is . The unit symbol for the kibibyte is KiB. The unit was established by the International Electrotechnical Commission in 1999 and has been accepted for use...
usable on IBM PC-compatible machines), without losing access to the DOS
DOS
DOS, short for "Disk Operating System", is an acronym for several closely related operating systems that dominated the IBM PC compatible market between 1981 and 1995, or until about 2000 if one includes the partially DOS-based Microsoft Windows versions 95, 98, and Millennium Edition.Related...
operating system (which doesn't work in protected mode). After the introduction of Windows 95
Windows 95
Windows 95 is a consumer-oriented graphical user interface-based operating system. It was released on August 24, 1995 by Microsoft, and was a significant progression from the company's previous Windows products...
, unreal mode quickly fell out of favor because programs using it cannot run in the DOS prompt of Microsoft Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...
; they require a "Restart in MS-DOS mode" in Windows 95 and 98
Windows 98
Windows 98 is a graphical operating system by Microsoft. It is the second major release in the Windows 9x line of operating systems. It was released to manufacturing on 15 May 1998 and to retail on 25 June 1998. Windows 98 is the successor to Windows 95. Like its predecessor, it is a hybrid...
, and cannot be run at all on NT
Windows NT
Windows NT is a family of operating systems produced by Microsoft, the first version of which was released in July 1993. It was a powerful high-level-language-based, processor-independent, multiprocessing, multiuser operating system with features comparable to Unix. It was intended to complement...
and later Windows systems. For those operating systems, an emulator
Emulator
In computing, an emulator is hardware or software or both that duplicates the functions of a first computer system in a different second computer system, so that the behavior of the second system closely resembles the behavior of the first system...
such as DOSBox
DOSBox
DOSBox is emulator software that emulates an IBM PC compatible computer running MS-DOS. It is intended especially for use with old PC games. DOSBox is free software....
is the only way to run programs designed for unreal mode. Unreal mode is still extensively used by BIOS
BIOS
In IBM PC compatible computers, the basic input/output system , also known as the System BIOS or ROM BIOS , is a de facto standard defining a firmware interface....
code. In particular the SMM mode in Intel 386SL and later processors places the processor in unreal mode.
Enabling Unreal Mode
To enable unreal mode without using any undocumented features of the CPU, the program has to enter protected modeProtected mode
In computing, protected mode, also called protected virtual address mode, is an operational mode of x86-compatible central processing units...
, find or create a flat descriptor in the GDT
Global Descriptor Table
The Global Descriptor Table or GDT is a data structure used by Intel x86-family processors starting with the 80286 in order to define the characteristics of the various memory areas used during program execution, including the base address, the size and access privileges like executability and...
or LDT
Local Descriptor Table
The Local Descriptor Table is a memory table used in the x86 architecture in protected mode and containing memory segment descriptors: start in linear memory, size, executability, writability, access privilege, actual presence in memory, etc....
, load some of the data segment registers with the respective protected mode "selector", and then switch back to real mode. After returning to real mode, the processor will continue using the cached descriptors as established in protected mode, thus allowing access to 4 GiB of "extended" memory from real mode.
There is a time penalty for leaving protected mode on the 286, because the CPU must be reset. Undocumented features of the CPU, such as LOADALL
LOADALL
LOADALL is the common name for two different, undocumented machine instructions of Intel 80286 and Intel 80386 processors, which allow access to areas normally outside of the IA-32 API scope, like descriptor cache registers...
, can be used to enter unreal mode more quickly.
Huge versus Big real mode
As described above, unreal mode usually involves using one or more data selectors to address data in memory more efficiently. This has been common practice and often referred to as "big" real mode."Huge" real mode is attained by, in addition, loading the code selector (CS) from a descriptor allowing access to the whole memory and having the 32-bit attribute ("D" bit) set to one. This rarely used "mode" presents some advantages but it is more difficult to set up, since real mode interrupts do not automatically preserve the high sixteen bits of the extended instruction pointer, EIP.