In-depth understanding of Linux memory Management learning notes (iv)

Source: Internet
Author: User
Solemn statement: Without my permission, not for commercial or non-commercial reprint and use, if necessary, please contact: yrj1978@hotmail.com Actions for page table entries

In the case of the X86 architecture, in the Include/asm-x86/pgtable.h file, several macros that define the values in the "precipitate" or "Check" page table entries (in the 2.6.24 version of the kernel, which may be distributed in several related header files due to the architectural relationships).

Through 4 macros, a linear address is tracked from the first Level page Catalog table (page directories) to the last level of the page catalog table.

Pgd_offset: Returns an address to the PGD entry, which is the first address of a PUD page, through a linear address in which a portion of the memory address in the PGD index is identified and the process's mm_struct data structure object.

Pud_offset: Returns an address to a PUD entry with a linear address (also an index) and an address to a PGD entry, which is the first address of a PMD page. If the hardware system does not support PUD, the address to the PGD entry is returned directly. That is, by subtly returning PGD directly, a unified software architecture is made in different architectures.

Pmd_offset: Returns an address to a PMD entry with a linear address (also an index) and an address to a PUD entry, which is the first address of a PTE page. If the hardware system does not support PMD, the address to the PUD entry is returned directly. That is, through the ingenious direct return PUD way, make the unified software architecture under the different architecture.

Pte_offset: Returns an address to a PTE entry with a linear address (also an index) and an address to a PMD entry (content is the first address of the PMD page), which is the first address (physical address) of a page of data memory that needs to be accessed. This address and the lower part of the linear address of the data in the memory page of the offset added to get the actual data of the physical address.

A

The second set of macros used to detect whether a page table entry exists or is available. Pte_none (), Pmd_none (), Pud_none (), Pgd_none (), returns 1 if the corresponding entry does not exist. A macro is defined only to detect whether the content of an entry is 0 full. Pte_present (), Pmd_present (), Pud_present (), Pgd_present (), and returns 1 if the present bit in the entry is set. Pte_clear (), Pmd_clear (), Pud_clean (), Pgd_clear (), clear zero for the corresponding entry. Pmd_bad (), Pud_bad (), Pgd_bad (),

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.