Real mode, protection mode, and virtual 8086 Mode

Source: Internet
Author: User

Reference address:

Http://www.cnblogs.com/jnet/archive/2008/05/12/1193675.html

 

These concepts have never been clarified. I searched the internet and posted it. I won't forget it! If you have other content, please add it to your friends.

Starting from 80386, the CPU has three ways to work: real mode, protection mode, and virtual 8086 mode. It is only real-mode when it is just started. Wait until the Linux operating system runs
It runs in protection mode. In real mode, only the memory with the address below 1 MB is called regular memory.
The above memory is called extended memory. In protection mode, all 32 address lines are valid and can address up to 4 GB of physical address space;
The expanded memory segment management mechanism and the optional memory paging management mechanism not only provide hardware support for Memory sharing and protection, but also provide hardware support for implementing virtual memory;
Supports multiple tasks to quickly switch tasks and protect the task environment;
The four privileged levels and comprehensive privileged inspection mechanisms enable resource sharing, security and confidentiality of code and data, and task isolation. The virtual 8086 approach is supported, easy to execute 8086 programs.

Virtual 8086 mode is the real mode running in protection mode, in order to execute pure 16-bit programs in 32-bit protection mode. It is not a real CPU mode, but also a protection mode.

The fundamental difference between the protection mode and the actual mode is whether the process memory is protected or not. The difference between addressable spaces is only the result of this reason. The real mode regards the entire physical memory as a segmented area, and the program code and data are located in different
There is no difference between the system program and the user program, and every Pointer Points to a "real" physical address. In this way, if a pointer of a user program points to the system program area or other user programs
Region, and changed the value, then the consequences for the modified system program or user program are likely to be disastrous. To overcome this poor memory management approach, processor vendors have developed a protection mode. This
In this example, the physical memory address cannot be directly accessed by the program. The internal address (virtual address) of the program must be converted from the operating system to the physical address for access.

So far, the process (now we can call it a program
With a strict boundary, no other process can access a physical memory area that is not owned by itself, or even within its own virtual address range, because there are some virtual zones
The domain has been put into some public system runtime libraries. These regions cannot be modified at will. If you modify them, there will be: SIGSEGV (Linux
Invalid Memory Access dialog box (Windows dialog box ).

The CPU startup environment is in 16-bit real-time mode, and then you can switch to the protection mode. However, you cannot switch back from the protection mode to the actual mode.


In fact, the current 64-bit Pentium 4 processor has three basic modes and one extension mode,
Basic Mode:
Protection Mode: Pure 32-bit protection of the execution environment.
Real mode: Pure 16-bit unprotected execution environment.
System Management Mode: When the SMI pin is effective in system management mode, the current CPU context is saved first. It has an independent address space for executing commands on power management or system security.

Extended Mode:
IA-32e die
Type: The 64-bit operating system runs in this mode. This mode has two submodes:

1) compatibility mode: In this mode, the 64-bit operating system runs in a 32-bit compatible environment and can run 16 or 32-bit applications normally, just like the basic protection mode,
Access the 32-bit address space, but cannot
Run the pure 16-bit real-Mode Program (that is, the virtual 86-mode program cannot be run ).

2) 64-Bit mode: In this mode, the processor fully executes 64-bit commands and uses 64-bit address space and 64-bit operands. To run 16-bit programs, you must switch to the compatible mode.
The switch of the IA-32e sub-mode is fully based on the code segment register. In this way, the operating system running in IA-32e mode (64-bit) can seamlessly run all 16, 32, 64 for the application,
Set the CS after 32 bits.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.