Unreal mode
Lua error in package.lua at line 80: module 'strict' not found.
In x86 computing, unreal mode, also big real mode, huge real mode, or flat real mode, is a variant of real mode, 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 processors can operate in. It is used in the 80386 and later x86 processors.
Overview
For efficiency reasons, the 80286 and all later x86 processors use the base address, size and other attributes stored in their internal segment descriptor cache whenever computing effective memory addresses, even in real mode. Contrary to simplified descriptions found in early Intel manuals, a "selector", i.e. a 16-bit "segment number" stored and kept in a (visible to the programmer) "segment register" is not used to calculate addresses.
HIMEM.SYS uses this feature to address extended memory.[1] 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, which run MS-DOS programs in virtual 8086 mode that is incompatible with unreal mode. 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[citation needed]. In particular, the System Management Mode (SMM) in Intel 386SL and later processors places the processor in unreal mode.
Enabling Unreal Mode
To put an 80386 or higher microprocessor into unreal mode, a program must first enter protected 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.[2]
Starting with the 80386, real mode programs can use the 32 bit registers with the Operand Size Override Prefix.[3] This allows programs to use an address like DS:[EAX]. In normal real mode, a fault occurs if EAX exceeds 0xFFFF. In unreal mode, the access is allowed.
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.