Ptef ile may only be invoked if ptepresent returns false that is the page associated with the page table entry is not present in memory

Since the generic code relies on pte_file, it must also be defined if an architecture does not support nonlinear mappings. In this case, the function always returns 0.

A summary of all functions provided to manipulate PTE entries can be found in Table 3-3.

Table 3-3: Functions for Processing the Architecture-Dependent State of a Memory Page

Function

Description

pte_present

Is the page present?

pte_read

May the page be read from within userspace?

pte_write

May the page be written to?

pte_exec

May the data in the page be executed as binary code?

pte_dirty

Is the page dirty; that is, have its contents been modified?

pte_file

Does the PTE belong to a nonlinear mapping?

pte_young

Is the access bit (typically _page_access) set?

pte_rdprotect

Removes read permission for the page.

pte_wrprotect

Deletes write permission for the page.

pte_exprotect

Removes permission to execute binary data in the page.

pte_mkread

Sets read permission.

pte_mkwrite

Sets write permission.

pte_mkexec

Permits execution of page contents.

pte_mkdirty

Marks the page as dirty.

pte_mkclean

"Cleans" the page; that is, usually deletes the _page_dirty bit.

pte_mkyoung

Sets the accessed bit — _page_accessed on most architectures.

pte_mkold

Deletes the accessed bit.

The functions often appear in groups of three to set, delete, and query a specific attribute, for instance, write permission for a page. The kernel assumes that access to page data can be regulated in three different ways — by means of write, read, and execution permission. (Execution permission indicates that page binary data may be executed as machine code in the same way as programs are executed.) However, this assumption is a little too optimistic for some CPUs. IA-32 processors support only two control modes to allow reading and writing. In this case, the architecture-dependent code tries to emulate the desired semantics as best it can.

Continue reading here: Creating and Manipulating Entries

Was this article helpful?

0 0