Storage Management under Linux ---- Original reprint, please inform me! ! !

xiaoxiao2021-03-06  20

The Linux kernel uses page storage management, and the three mapping mechanism implements mapping from linear addresses to physical addresses. The main reason for this way is to consider the implementation of different CPUs, which is convenient for future expansion. In the I386 platform, the method of paragraph page is managed. For this structure, the Linux kernel selects PGTABLE-2LEVEL.H1 when compiling in the system configuration process. This file is mainly used to assign the range of PGD, PMD, and PT. In this file, all of the starting position of the PGD and the starting position of the PMD are set to bit22, that is, the length of the PMD bit segment is 0. This puts the LINUX logically three-layer mapping model to the physical Layer 2 mapping of the I386 structure.

The 32-bit linear address of I386 maps memory physical space to 4G virtual space. Which 0xc00000 to 0xFffffFFFFFFFFFFFFFFFF is the kernel space shared by the process, each process has its own 3G user space.

The specific mapping process is:

(1) From the CR3 register, the address of the current page directory is obtained as a subscript with DIR, find the pointer to the corresponding page table.

(2) Find the corresponding page table item with Page to bind the current page table.

(3) Get the final physical memory address of the last physical memory address.

The specific mapping process is:

(1) From the CR3 register, the address of the current page directory is obtained as a subscript with DIR, find the pointer to the corresponding page table.

(2) Find the corresponding page table item with Page to bind the current page table.

(3) Get the final physical memory address of the last physical memory address.

转载请注明原文地址:https://www.9cbs.com/read-39989.html

New Post(0)