Real fashion
The term real mode , actually real address mode or Germanized real mode , designates an operating mode of the x86 -compatible processors, which has existed under this name from the Intel 80286 .
Characteristics
In real mode the processor uses the same method as the Intel 8086 processor to access the main memory . That means, from the programmer's point of view, it can be addressed like a (faster) 8086.
Every x86-compatible processor starts in real mode after a reset . A special variant of the MOV command can be used to switch the processor to protected mode .
meaning
The real mode is the default mode for PC-compatible DOS , as with PC DOS and MS-DOS with the IBM PC was, model 5150, introduced 1,981th Operating systems compatible with this include: a. DR-DOS , PTS-DOS and FreeDOS . It is also used in other operating systems compatible with the IBM PC, such as CP / M-86 , and is supported in the early versions of Windows , which up to Windows 3.x is started from DOS. Newer operating systems only use it during the start-up phase, whereby practically all modern operating systems switch to protected mode at a very early point in time .
Today, emulators such as the following are ideal for executing real-mode operating systems and the associated historical software . B. DOSBox , QEMU , Bochs etc.
Access protection
There is no access protection in real mode. This means that every running program can access the entire main memory and hardware - a single crashing program can lead to a complete system crash . However, this is not acceptable for modern multitasking operating systems.
Segment register
In real mode, the processor uses what is known as a segment : offset addressing. There are four segment registers : CS ( code segment ), DS ( data segment ), ES ( extra segment ) and SS ( stack segment ); From the 80386 onwards there are two more segment registers (FS and GS). All segment registers only contain 16-bit segment addresses in real mode. To calculate the real, linear addresses, the contents are multiplied by 16 and added to the offset. Since the offset address is also limited to 16 bits, the result is a 20-bit linear address, which means that the address space that can be used directly and without tricks is limited to one MiB (2 20 bytes). In the event of "overaddressing" and an open A20 address line , another 64 KiB (minus 16 bytes) in the range from FFFF: 0010 to FFFF: FFFF can be reached in real mode. This memory area is also known as the high memory area .
Unreal mode ("Unreal Mode", "Big Real Mode")
The limitation to one megabyte of main memory was completely inadequate for many applications even in the days of MS-DOS. However, there are two tricks with which you can increase the segment register to four GiB in real mode ; Working in real mode beyond a MiB is called “unreal mode”. This special mode is considered undocumented and does not represent a separate operating mode.
The simple "Unreal Mode" was mainly used in the first half of the 1990s for PC games, since at that time these mostly ran directly under the real-mode system MS-DOS. Windows was already a protected mode system at the time, but it did not yet offer any support for game programs that could fully utilize the computing power.
Both tricks are based on the fact that the processor also uses the shadow registers of the segment registers for the address calculation in real mode, even if these cannot be reached directly in real mode. However, in a roundabout way you can set the shadow register to values that allow access to memory areas beyond the 1 MiB limit: Either you set the segment start to a memory address beyond the 1 MiB limit, or (if at least one 80386 processor is used Is available) the segment size is increased from 64 KiB to 4 GiB.
The LOADALL trick
On the 80286 and 80386 (and some 486 models) there is an undocumented command LOADALL (286) or LOADALLD (386) with which you can fill all registers of the CPU with your own values. This also applies in particular to the registers that are not available in real mode, with which the desired values can also be loaded into the segment description caches. On newer CPUs, these commands trigger an "Unknown Opcode" exception, which can be used to emulate the command.
The PM trick
The PM trick is to switch to protected mode , load the segment registers including shadow registers with the desired values and then switch back to real mode , whereby the values in the registers are retained.
This method does not yet work with the 80286, since this CPU can only be switched back to real mode via a CPU reset ; however, the contents of the segment descriptor caches are reset to their default values. Consequently, only the LOADALL method mentioned above remains for these processor types.
DOS extender
Another possibility of addressing the entire address space in real mode is with the DOS extenders . These special programs allow the real-mode operating system MS-DOS to be used by protected-mode programs by switching between the two modes as required: the application program itself runs in protected mode, and real mode for DOS calls switched.
DOS extender have the advantage over the Unreal mode that, at least in most cases with Windows with Windows 95 / 98 / SE , are still compatible; DOS programs of this type can usually also be started directly under Windows. In contrast, the unreal mode can only be used under Windows by starting the computer in "MS-DOS mode", under Windows NT / 2000 / XP / Vista / 7/10 not directly.
See also
Web links
- Intel IA-32 Software Developer's Manual - Volume 3A (PDF file; English; 2.9 MB)