CPU three mode of operation

Source: Internet
Author: User
It has always been unclear what these concepts are. Search on the Internet, put it on the sun, will not forget. Have other content, please see the friend please Add.

Starting with 80386, the CPU has three ways of working: Real mode, protected mode, and virtual 8086 mode. Only when the boot is Real-mode, when the Linux operating system is running, it will run in protected mode. Real mode can only access the memory of the address under 1M is called conventional memory, we have the address of more than 1M of memory called extended memory. In protected mode, all 32 address lines are valid, addressing up to 4G bytes of physical address space; The extended memory segmentation management mechanism and optional memory paging management mechanism not only provide hardware support for memory sharing and protection, but also provide hardware support for realizing virtual memory. Multi-task support, able to fast task switching and protection of task environment; 4 privilege level and perfect privilege checking mechanism, which can not only realize resource sharing but also guarantee the security and secrecy of code and data and the separation of tasks; Support virtual 8086 mode, easy to execute 8086 programs.

Virtual 8086 mode is a real mode that runs in protected mode, in order to execute pure 16-bit programs in 32-bit protection mode. It is not a real CPU mode, it is also a protection mode.

The fundamental difference between protected mode and real mode is that process memory is protected or not. The difference between addressable spaces is only the result of this. Real-mode treats the entire physical memory as a segmented area, where program code and data are located in different regions, System programs and user programs are not treated differently, and each pointer is a physical address that points to "reality". As a result, if a pointer to a user program points to a System program area or other user program area and changes the value, the consequences for the modified system program or user program are likely to be catastrophic. To overcome this poor memory management, the processor manufacturer emits protection mode. In this way, the physical memory address can not be directly accessed by the program, the program's internal address (virtual address) to be converted from the operating system to the physical address to access, the program is ignorant of this.

At this point, the process (where we can call the program a process) has a strict boundary, no other process has access to a region of physical memory that does not belong to itself, even within its own virtual address range, because there are virtual areas that have been put into some common system runtime libraries. These areas can also not be arbitrarily modified, if modified will be: SIGSEGV (Linux segment error), Illegal Memory Access dialog box (Windows dialog box).

The CPU boot environment is 16-bit real mode and can then be switched to protected mode. However, you cannot switch back to real mode from protected mode

In fact, the 64-bit Pentium 4 processor now has three basic modes and one extended mode,
Basic mode:
Protection mode: Pure 32-bit protection execution environment.
Real mode: Pure 16-bit unprotected execution environment.
System Management mode: When SMI pins for effective access to System Management mode, first save the current CPU context. It has a separate address space that is used to perform power management or system security directives.
Extended mode:
ia-32e mode: 64-bit operating system running in this mode. The pattern has two seed modes:
1 compatibility mode: In this mode, 64-bit operating system running in 32-bit compatible environment, can operate normally 16, 32-bit applications are like basic protection mode,
Access to the 32-bit address space, but cannot run pure 16-bit real-mode programs (just can't run virtual 86-mode programs).
2 64-bit mode: In this mode, the processor fully executes the 64-bit instruction, uses 64-bit address space and 64 operand, runs 16, 32-bit programs must switch to compatibility mode.
The ia-32e of the sub mode is entirely based on the code segment registers. As a result, an OS running in ia-32e mode (64-bit) can seamlessly run all 16,32,64 as an application,
                 by setting the 32-bit post CS.

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.