Real mode, also called real address mode, is an operating mode of all
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 ...
-compatible
CPUs
A central processing unit (CPU), also called a central processor, main processor or just processor, is the electronic circuitry that executes instructions comprising a computer program. The CPU performs basic arithmetic, logic, controlling, and ...
. 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
The bit is the most basic unit of information in computing and digital communications. The name is a portmanteau of binary digit. The bit represents a logical state with one of two possible values. These values are most commonly represente ...
segmented
memory address
In computing, a memory address is a reference to a specific memory location used at various levels by software and hardware. Memory addresses are fixed-length sequences of digits conventionally displayed and manipulated as unsigned integers. Su ...
space (giving 1
MB of addressable memory) and unlimited direct software access to all addressable memory, I/O addresses and peripheral hardware. Real mode provides no support for memory protection, multitasking, or code privilege levels.
Before the release of 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 ...
, which introduced
protected mode, real mode was the only available mode for x86 CPUs; and for
backward compatibility
Backward compatibility (sometimes known as backwards compatibility) is a property of an operating system, product, or technology that allows for interoperability with an older legacy system, or with input designed for such a system, especiall ...
, all x86 CPUs start in real mode when reset, though it is possible to emulate real mode on other systems when starting on other modes.
History
The 286 architecture introduced
protected mode, allowing for (among other things) hardware-level memory protection. Using these new features, however, required a new
operating system
An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs.
Time-sharing operating systems schedule tasks for efficient use of the system and may also in ...
that was specifically designed for protected mode. Since a primary
design specification
A design specification is a detailed document that sets out exactly what a product or a process should present. For example, the design specification could include required dimensions, environmental factors, ergonomic factors, aesthetic factors, m ...
of x86 microprocessors is that they are fully backward compatible with software written for all x86 chips before them, the 286 chip was made to start in 'real mode' – that is, in a mode which turned off the new memory protection features, so that it could run
operating system
An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs.
Time-sharing operating systems schedule tasks for efficient use of the system and may also in ...
s written for the
8086
The 8086 (also called iAPX 86) is a 16-bit microprocessor chip designed by Intel between early 1976 and June 8, 1978, when it was released. The Intel 8088, released July 1, 1979, is a slightly modified chip with an external 8-bit data bus (allowi ...
and the
8088
The Intel 8088 ("''eighty-eighty-eight''", also called iAPX 88) microprocessor is a variant of the Intel 8086. Introduced on June 1, 1979, the 8088 has an eight-bit external data bus instead of the 16-bit bus of the 8086. The 16-bit registers a ...
. As of 2018, current x86 CPUs (including
x86-64
x86-64 (also known as x64, x86_64, AMD64, and Intel 64) is a 64-bit version of the x86 instruction set, first released in 1999. It introduced two new modes of operation, 64-bit mode and compatibility mode, along with a new 4-level paging mod ...
CPUs) are able to boot real mode operating systems and can run software written for almost any previous x86 chip without emulation or virtualization.
The PC
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 ...
which IBM introduced operates in real mode, as do the
DOS
DOS is shorthand for the MS-DOS and IBM PC DOS family of operating systems.
DOS may also refer to:
Computing
* Data over signalling (DoS), multiplexing data onto a signalling channel
* Denial-of-service attack (DoS), an attack on a communicat ...
operating systems (
MS-DOS
MS-DOS ( ; acronym for Microsoft Disk Operating System, also known as Microsoft DOS) is an operating system for x86-based personal computers mostly developed by Microsoft. Collectively, MS-DOS, its rebranding as IBM PC DOS, and a few ope ...
,
DR-DOS
DR-DOS (written as DR DOS, without a hyphen, in versions up to and including 6.0) is a disk operating system for IBM PC compatibles. Upon its introduction in 1988, it was the first DOS attempting to be compatible with IBM PC DOS and MS-D ...
, etc.). Early versions of
Microsoft Windows
Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
ran in real mode.
Windows/386
Windows 2.0 is a major release of Microsoft Windows, a family of Graphical user interface, graphical operating system, operating systems for Personal computer, personal computers developed by Microsoft. It was Released-to-manufacturing, release ...
made it possible to make some use of protected mode, and this was more fully realized in
Windows 3.0
Windows 3.0 is the third major release of Microsoft Windows, launched in 1990. It features a new graphical user interface (GUI) where applications are represented as clickable icons, as opposed to the list of file names seen in its predeces ...
, which could run in either real mode or make use of protected mode in the manner of Windows/386. Windows 3.0 actually had several modes: "real mode", "standard mode" and "386-enhanced mode"; the latter required some of the virtualization features of the 80386 processor, and thus would not run on an 80286. Windows 3.1 removed support for real mode, and it was the first mainstream operating environment which required at least an 80286 processor. None of these versions could be considered a modern x86 operating system, since they switched to protected mode only for certain functions.
Unix
Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and ot ...
,
Linux
Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which ...
,
OS/2
OS/2 (Operating System/2) is a series of computer operating systems, initially created by Microsoft and IBM under the leadership of IBM software designer Ed Iacobucci. As a result of a feud between the two companies over how to position OS/2 ...
,
Windows NT
Windows NT is a proprietary graphical operating system
An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs.
Time-sharing operating systems sc ...
are considered modern OS's as they switch the CPU into protected mode at startup, never return to real mode and provide all of the benefits of protected mode all of the time. 64-bit operating systems use real mode only at startup stage, and the OS kernel will switch the CPU into
long mode. Notably, the protected mode of the 80286 is considerably more primitive than the improved protected mode introduced with the 80386; the latter is sometimes called 386 protected mode, and is the mode modern 32-bit x86 operating systems run in.
Addressing capacity
The 8086, 8088, and 80186 have a 20-bit address bus, but the unusual segmented addressing scheme Intel chose for these processors actually produces effective addresses which can have 21 significant bits. This scheme shifts a 16-bit segment number left four bits (making a 20-bit number with four least-significant zeros) before adding to it a 16-bit address offset; the maximum sum occurs when both the segment and offset are 0xFFFF, yielding 0xFFFF0 + 0xFFFF = 0x10FFEF. On the 8086, 8088, and 80186, the result of an effective address that overflows 20 bits is that the address "wraps around" to the zero end of the address range, i.e. it is taken modulo 2^20 (2^20 = 1048576 = 0x100000). However, the 80286 has 24 address bits and computes effective addresses to 24 bits even in real mode. Therefore, for the segment 0xFFFF and offset greater than 0x000F, the 80286 would actually make an access into the beginning of the second
megabyte
The megabyte is a multiple of the unit byte for digital information. Its recommended unit symbol is MB. The unit prefix ''mega'' is a multiplier of (106) in the International System of Units (SI). Therefore, one megabyte is one million bytes o ...
of memory, whereas the 80186 and earlier would access an address equal to
ffset0x10, which is at the beginning of the first megabyte. (Note that on the 80186 and earlier, the first
kilobyte
The kilobyte is a multiple of the unit byte for digital information.
The International System of Units (SI) defines the prefix ''kilo'' as 1000 (103); per this definition, one kilobyte is 1000 bytes.International Standard IEC 80000-13 Quantiti ...
of the address space, starting at address 0, is the permanent, immovable location of the interrupt vector table.) So, the actual amount of memory addressable by the 80286 and later x86 CPUs in real mode is 1
MB + 64
KB – 16
B = 1,114,096 B.
A20 line
Some programs predating the 80286 were designed to take advantage of the wrap-around (modulo) memory addressing behavior, so the 80286 presented a problem for backward compatibility. Forcing the 21st address line (the actual logic signal wire coming out of the chip) to a logic low, representing a zero, results in a modulo-2^20 effect to match the earlier processors' address arithmetic, but the 80286 has no internal capability to perform this function. When IBM used the 80286 in their
IBM PC/AT
The IBM Personal Computer/AT (model 5170, abbreviated as IBM AT or PC/AT) was released in 1984 as the fourth model in the IBM Personal Computer line, following the IBM PC/XT and its IBM Portable PC variant. It was designed around the Intel 80 ...
, they solved this problem by including a software-settable gate to enable or disable (force to zero) the A20 address line, between the A20 pin on the 80286 and the system bus; this is known as Gate-A20 (the A20 gate), and it is still implemented in PC chipsets to this day. Most versions of the HIMEM.SYS extended memory driver for IBM-/MS-DOS famously displayed upon loading a message that they had installed an "A20 handler", a piece of software to control Gate-A20 and coordinate it to the needs of programs. In protected mode the A20 line needs to be enabled, or else physical addressing errors will occur, likely leading to a system crash. Modern legacy boot loaders (such as
GNU GRUB
GNU GRUB (short for GNU GRand Unified Bootloader, commonly referred to as GRUB) is a boot loader package from the GNU Project. GRUB is the reference implementation of the Free Software Foundation's Multiboot Specification, which provides a use ...
) use A20 line.
Switching to real mode
Intel introduced protected mode into the x86 family with the intention that operating systems which used it would run entirely in the new mode and that all programs running under a protected mode operating system would run in protected mode as well. Because of the substantial differences between real mode and even the rather limited 286 protected mode, programs written for real mode cannot run in protected mode without being rewritten. Therefore, with a wide base of existing real mode applications which users depended on, abandoning real mode posed problems for the industry, and programmers sought a way to switch between the modes at will. However, Intel, consistent with their intentions for the processor's usage, provided an easy way to switch into protected mode on the 80286 but no easy way to switch back to real mode. Before the 386 the only way to switch from protected mode back to real mode was to reset the processor; after a reset it always starts up in real mode to be compatible with earlier x86 CPUs back to the 8086. Resetting the processor does not clear the system's RAM, so this, while awkward and inefficient, is actually feasible. From protected mode, the processor's state is saved in memory, then the processor is reset, restarts in real mode, and executes some real mode code to restore the saved state from memory. It can then run other real mode code until the program is ready to switch back to protected mode. The switch to real mode is costly in terms of time, but this technique allows protected mode programs to use services such as BIOS, which runs entirely in real mode (having been designed originally for the
8088
The Intel 8088 ("''eighty-eighty-eight''", also called iAPX 88) microprocessor is a variant of the Intel 8086. Introduced on June 1, 1979, the 8088 has an eight-bit external data bus instead of the 16-bit bus of the 8086. The 16-bit registers a ...
-based
IBM Personal Computer
The IBM Personal Computer (model 5150, commonly known as the IBM PC) is the first microcomputer released in the IBM PC model line and the basis for the IBM PC compatible de facto standard. Released on August 12, 1981, it was created by a team ...
model ''(machine type)'' 5150). This mode-switching technique is also the one used by
DPMI (under real, not emulated, DOS) and
DOS extender
A DOS extender is a computer software program running under DOS that enables software to run in a protected mode environment even though the host operating system is only capable of operating in real mode.
DOS extenders were initially develope ...
s like
DOS/4GW
DOS/4G is a 32-bit DOS extender developed by Rational Systems (later Tenberry Software). It allows DOS programs to eliminate the 640 KB conventional memory limit by addressing up to 64 MB of extended memory on Intel 80386 and above machines ...
to allow protected mode programs to run under DOS; the DPMI system or DOS extender switches to real mode to invoke DOS or BIOS calls, then switches back to return to the application program which runs in protected mode.
Decline
The changing towards the NT kernel resulted in the operating system not needing DOS to boot the computer as well as being unable to use it. The need to restart the computer in real mode MS-DOS declined after
Windows 3.1x
Windows 3.1 is a major release of Microsoft Windows. It was released to manufacturing on April 6, 1992, as a successor to Windows 3.0.
Like its predecessors, the Windows 3.1 series ran as a shell on top of MS-DOS. Codenamed Janus, Windows 3 ...
until it was no longer supported in
Windows ME
Windows Millennium Edition, or Windows Me (marketed with the pronunciation of the pronoun "me"), is an operating system developed by Microsoft as part of its Windows 9x family of Microsoft Windows operating systems. It is the successor to Windo ...
. The only way of currently running DOS applications that require real mode from within newer versions of Windows is by using emulators such as
DOSBox
DOSBox is a free and open-source emulator which runs software for MS-DOS compatible disk operating systems—primarily video games. It was first released in 2002, when DOS technology was becoming obsolete. Its adoption for running DOS games i ...
or
x86 virtualization
x86 virtualization is the use of hardware-assisted virtualization capabilities on an x86/x86-64 CPU.
In the late 1990s x86 virtualization was achieved by complex software techniques, necessary to compensate for the processor's lack of hardware-as ...
products.
See also
*
Unreal mode
In x86 computing, unreal mode, also big real mode, huge real mode, flat real mode, or voodoo mode is a variant of real mode, in which one or more segment descriptors has been loaded with non-standard values, like 32-bit limits allowing access to ...
*
Protected Mode
*
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 ...
*
80386
*
IA-32
IA-32 (short for "Intel Architecture, 32-bit", commonly called i386) is the 32-bit version of the x86 instruction set architecture, designed by Intel and first implemented in the 80386 microprocessor in 1985. IA-32 is the first incarnation o ...
*
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 ...
*
Conventional memory
In DOS memory management, conventional memory, also called base memory, is the first 640 kilobytes of the memory on IBM PC or compatible systems. It is the read-write memory directly addressable by the processor for use by the operating system ...
References
External links
*
{{DEFAULTSORT:Real Mode
X86 operating modes
Programming language implementation