Compilation of learning Notes real mode/protection mode difference

Source: Internet
Author: User
2.1 Pattern Types
Starting with 80386, the CPU has three modes of operation: Real mode, protected mode, and virtual 8086 mode. It is only real-mode when it is started, and is running in protected mode after the Linux operating system is running.
Real mode can only access memory of the address under 1M is called conventional memory, we put the address above 1M memory is called extended memory.
In protected mode, all 32 address lines are valid, addressable up to 4G bytes of physical address space, extended memory segmentation management mechanism and optional memory paging management mechanism, not only provides hardware support for memory sharing and protection, but also provides hardware support for virtual storage; multi-task support. Ability to quickly perform task switching and Protection task environment; 4 Privilege level and perfect privilege check mechanism, can realize resource sharing and ensure code and data security and confidentiality and task isolation, support virtual 8086 way, easy to execute 8086 programs.
Virtual 8086 mode is a real mode that runs in protected mode, in order to execute a pure 16-bit program in 32-bit protected mode. It is not a real CPU mode, it is also protected mode.
2.2 Mode Differences
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 fruit of this cause.
Real mode treats the whole physical memory as a segmented area, the program code and data are in different regions, the system program and the user program are not treated differently, and each pointer is a physical address that points to "real". Thus, if a pointer to a user program points to a System program area or other user program area and changes the value, the consequences of the modified system program or user program are likely to be catastrophic. To overcome this poor memory management approach, the processor vendor is emitting 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 a physical address to access, the program does not know. At this point, the process (which we can call the program as a process) has strict boundaries, and no other process has access to the physical memory areas that are not part of its own, even within its own virtual address range, because some of the virtual regions have already been put into some common system runtime libraries. These areas can not be arbitrarily modified, if the changes will be: SIGSEGV (Linux segment error); Illegal Memory Access dialog box (Windows dialog box).
2.3 64-bit Pentium 4 processor operating mode
In fact, the current 64-bit Pentium 4 processor has three basic modes and an extended mode,
A) Basic mode:
Protected Mode: Pure 32-bit protection execution environment.
Real mode: Pure 16-bit unprotected execution environment.
System Management Mode: When the SMI PIN is effectively entered into the System Management mode, the current CPU context is saved first. It has a separate address space, which is used to perform power management or system security directives.
b) Extended mode: ****ia-32e mode, 64-bit operating system running in this mode. This mode has two seed modes:
1) * * Compatibility mode: In this mode, 64-bit operating system running in 32-bit compatible environment, can run 16, 32-bit applications like basic protection mode, access to 32-bit address space, but not the pure 16-bit real-mode program (just can't run the Virtual 86 mode program).
2) **64 bit mode: In this mode, the processor fully executes 64-bit instructions, using 64-bit address space and 64 operands, running 16, 32-bit programs must switch to compatibility mode.
The switchover of the ia-32e sub-mode is based entirely on the code segment register. This way, the OS running in ia-32e mode (64-bit) can seamlessly run all 16,32,64 for the 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.