Big Real Mode
   HOME

TheInfoList



OR:

In
x86 x86 (also known as 80x86 or the 8086 family) is a family of complex instruction set computer (CISC) instruction set architectures initially developed by Intel based on the Intel 8086 microprocessor and its 8088 variant. The 8086 was introd ...
computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes, and development of both hardware and software. Computing has scientific, e ...
, unreal mode, also big real mode, huge real mode, flat real mode, or voodoo mode is a variant of
real mode Real mode, also called real address mode, is an operating mode of all x86-compatible CPUs. The mode gets its name from the fact that addresses in real mode always correspond to real locations in memory. Real mode is characterized by a 20-bit seg ...
, in which one or more segment descriptors has been loaded with non-standard values, like 32-bit limits allowing access to the entire memory. Contrary to its name, it is not a separate addressing mode that the x86 processors can operate in. It is used in the
80286 The Intel 80286 (also marketed as the iAPX 286 and often called Intel 286) is a 16-bit microprocessor that was introduced on February 1, 1982. It was the first 8086-based CPU with separate, non-multiplexed address and data buses and also the fi ...
and later x86 processors.


Overview

For efficiency reasons, the
80286 The Intel 80286 (also marketed as the iAPX 286 and often called Intel 286) is a 16-bit microprocessor that was introduced on February 1, 1982. It was the first 8086-based CPU with separate, non-multiplexed address and data buses and also the fi ...
and all later x86 processors use the base address, size and other attributes stored in their internal
segment 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. Segment descriptors describe the memory segment referred to in the logic ...
cache whenever computing effective memory addresses, even in real mode. Therefore, a modification of the internal segment descriptor allows altering some properties of segments in real mode, like the size of addressable memory. This technique became widely used and is supported by all Intel processors.
HIMEM.SYS HIMEM.SYS is a DOS device driver which allows DOS programs to store data in extended memory according to the Extended Memory Specification (XMS). The memory beyond the first 1 MB of address space is required by Windows 9x/ Me in order to load ...
uses this feature to address
extended memory In DOS memory management, extended memory refers to memory above the first megabyte (220 bytes) of address space in an IBM PC or compatible with an 80286 or later processor. The term is mainly used under the DOS and Windows operating systems. DOS ...
, unless DOS is switched to run in a
virtual 8086 mode In the 80386 microprocessor and later, virtual 8086 mode (also called virtual real mode, V86-mode, or VM86) allows the execution of real mode applications that are incapable of running directly in protected mode while the processor is runnin ...
that is incompatible with unreal mode. One of the very few games—if not the only one—that used unreal mode was ''
Ultima VII ''Ultima VII: The Black Gate'' is the seventh installment of the ''Ultima (series), Ultima series'' of role-playing video games, released on April 16, 1992. In it the player returns as The Avatar, a would-be paragon of moral virtue who faces down ...
''. Unreal mode is used by
BIOS In computing, BIOS (, ; Basic Input/Output System, also known as the System BIOS, ROM BIOS, BIOS ROM or PC BIOS) is firmware used to provide runtime services for operating systems and programs and to perform hardware initialization during the ...
code as this is the initial mode of modern Intel processors. Furthermore, the
System Management Mode System Management Mode (SMM, sometimes called ring −2 in reference to protection rings) is an operating mode of x86 central processor units (CPUs) in which all normal execution, including the operating system, is suspended. An alternate ...
(SMM) in Intel 386SL and later processors places the processor in huge real mode. A program in unreal mode can call 16-bit code programmed for real mode (BIOS, DOS kernel and drivers) without any thunking. This makes an unreal mode driver simpler than a DPMI driver. However unreal mode is incompatible with protected mode operating systems such as Windows 3.x/9x/NT and OS/2. Big real mode has a 1 MiB code segment and a 4 GiB data segment. Some
boot loader A bootloader, also spelled as boot loader or called boot manager and bootstrap loader, is a computer program that is responsible for booting a computer. When a computer is turned off, its softwareincluding operating systems, application code, a ...
s (such as LILO) use the unreal mode to access up to 4 GiB of memory.


Enabling unreal mode

To put an 80386 or higher microprocessor into unreal mode, a program must first enter
protected mode In computing, protected mode, also called protected virtual address mode, is an operational mode of x86-compatible central processing units (CPUs). It allows system software to use features such as virtual memory, paging and safe multi-tasking d ...
, 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 In DOS memory management, extended memory refers to memory above the first megabyte (220 bytes) of address space in an IBM PC or compatible with an 80286 or later processor. The term is mainly used under the DOS and Windows operating systems. DOS ...
from real mode. The 80286 microprocessor can be put into unreal mode only with help of the undocumented instruction
LOADALL LOADALL is the common name for two different, undocumented machine instructions of Intel 80286 and Intel 80386 processors, which allow access to areas of the internal processor state that are normally outside of the IA-32 API scope, like ''descr ...
to modify the hidden segment base registers to point to the source or target memory location above 1 MiB. Starting with the 80386, real mode programs can use the 32 bit registers with the Address Size Override Prefix. This allows programs to use an address like DS: BX In normal real mode, a fault occurs if EBX exceeds 0xFFFF. In unreal mode, the access is allowed.


Variants of unreal 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 "flat real mode" or "big real mode". The "huge real mode" is a variant where also the code segment is extended to 4 GiB. A special case of unreal mode is attained by, in addition, loading the code selector (CS) from a descriptor having the 32-bit attribute ("D" bit) set to one. This rarely used variant presents some advantages, mainly because it allows avoiding the Operand Size Override Prefixes normally required when using 32-bit addressing in 16-bit code segment, 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), the code needs to either fit in the low portion of code segment or be able to preserve and restore the high bits of EIP in some way. In addition, if BIOS or DOS interrupt functions that use 16-bit code are to be called, mode switching is required to switch the "D" bit back and forth. Some emulators do not support emulation of programs running in this variant of unreal mode.


See also

*
LOADALL LOADALL is the common name for two different, undocumented machine instructions of Intel 80286 and Intel 80386 processors, which allow access to areas of the internal processor state that are normally outside of the IA-32 API scope, like ''descr ...
*
Global EMM Import Specification EMM386 is the expanded memory manager of Microsoft's MS-DOS, IBM's PC DOS, Digital Research's DR-DOS, and Datalight's ROM-DOS which is used to create expanded memory using extended memory on Intel 80386 CPUs. There also is an EMM386.EXE availabl ...
(GEMMIS) *
x86 assembly language x86 assembly language is the name for the family of assembly languages which provide some level of backward compatibility with CPUs back to the Intel 8008 microprocessor, which was launched in April 1972. It is used to produce object code for t ...
*
A20 line The A20, or address line 20, is one of the electrical lines that make up the system bus of an x86-based computer system. The A20 line in particular is used to transmit the 21st bit on the address bus. A microprocessor typically has a number o ...


References


Further reading

* * *

https://archive.org/download/dr_dobbs_journal_vol_15/dr_dobbs_journal_vol_15.pdf] Errata

* (NB. Implements "Big real mode" SEG4G.) *
Intel IA-32 Software Developer's Manual - Volume 3A
* The Unabridged Pentium 4: IA32 Processor Genealogy, Addison Wesley . "Big real mode" * * * * {{cite book , title=DOS Internals , author-first=Geoff , author-last=Chappell , editor-first1=Andrew , editor-last1=Schulman , editor-first2=Amorette , editor-last2=Pedersen , date=January 1994 , edition=1st printing, 1st , series=The Andrew Schulman Programming Series , publisher=
Addison Wesley Publishing Company Addison-Wesley is an American publisher of textbooks and computer literature. It is an imprint of Pearson PLC, a global publishing and education company. In addition to publishing books, Addison-Wesley also distributes its technical titles through ...
, isbn=978-0-201-60835-9 (xxvi+738+iv pages, 3.5"-flopp

https://web.archive.org/web/20200222111608/https://www.pcjs.org/pubs/pc/programming/DOS_Internals/]) Errata

https://web.archive.org/web/20200222111853/https://gopher.tildeverse.org/gopher.viste.fr/1/programming/PC/DOS/DOS%2520Internals/crtdrv

* https://patents.google.com/patent/US5642491 "Method for expanding addressable memory range in real-mode processing to facilitate loading of large programs into high memory" X86 operating modes