Mapping of virtual addresses to physical addresses

Source: Internet
Author: User

Transfer from http://blog.csdn.net/sinat_16790541/article/details/42247907

Virtual Address and Physical address
=========================================

The CPU accesses the memory unit through the address, the address has the virtual address and the physical address cent, if the CPU does not have the MMU (Memory Management unit, the Ram Management Unit), or has the MMU but is not enabled, the CPU core sends the address to take the instruction or accesses the memory
directly to the external address pin of the CPU chip, directly to the memory chip (hereinafter referred to as physical memory, in order to differentiate with virtual memory) received,
This is called the Physical Address (physical, hereinafter referred to as PA), as shown in the following figure:
Figure 1. Physical Address Map



If the CPU is enabled to mmu,cpu the address will be intercepted by the MMU, the address from the CPU to the MMU is called the virtual address (Vsan, hereinafter referred to as VA), and the MMU translates this address to another address on the external address pin of the CPU chip, which is
The virtual address is mapped to a physical address, as shown in the following figure:
Figure 2. Virtual Address Map



The MMU maps virtual addresses to physical addresses in pages (page), typically 4K for 32-bit CPUs. For example, the virtual address 0xb7001000~0xb7001fff is a page that may be mapped by the MMU to a physical address 0x2000~0x2fff, and a physical page in physical memory is also called a page frame

when a variety of registers are introduced in datasheet, the address attached is the physical address.

Since the virtual address is eventually converted to a physical address, then why do you need a virtual address?
Virtual addresses provide permission checking: For example, when we set a mapping relationship between a virtual address and a physical address, you can set a block address to be read-only, write-only, and only accessible when the CPU is in admin mode. These functions can make the kernel of the system, the running space of the user program is independent of each other: the user program can not destroy the kernel, even if error, user program a crashes, and can not affect the user program B.

When the split paging mechanism is turned on, the typical x86 addressing process is

Memory addressing is done by the Linux kernel and the MMU, where the Linux kernel is responsible for setting up registers such as CR3,GDTR, maintenance of page tables, page management, and MMU for specific mapping work.

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.