swissChili | 825d46b | 2021-02-21 10:14:16 -0800 | [diff] [blame] | 1 | .\" Kernel paging docs, largely as a reference for myself. |
| 2 | .TH paging 9 "18 February 2021" "1" "Paging" |
| 3 | .SH NAME |
| 4 | Paging - kernel memory paging overview |
| 5 | .SH SYNOPSIS |
| 6 | Paging allows the kernel to map arbitrary virtual memory addresses to |
| 7 | locations in physical memory. |
| 8 | .SH DESCRIPTION |
| 9 | On x86 each page is fixed at 4kb. Mapping each 4kb page for the |
| 10 | entire memory takes a lot of space, so instead, |
| 11 | .B |
| 12 | page directories |
| 13 | .NB |
| 14 | and |
| 15 | .B |
| 16 | page tables |
| 17 | .NB |
| 18 | are used. The kernel stores one or more page directories, each of |
| 19 | which contains 1024 pointers to page tables (which may be null), each |
| 20 | of which in turn contains 1024 |
| 21 | .B |
| 22 | page table entries |
| 23 | .NB |
| 24 | |
| 25 | Each page table entry contains the upper 20 bits of the physical |
| 26 | memory location it maps to |
| 27 | .B |
| 28 | (frame). |
| 29 | .NB |
| 30 | It also contains several flags describing if the page is readable or |
| 31 | writable in user mode, as well as flags set by the CPU: such as if the |
| 32 | page has been accessed or modified. |
| 33 | .SH SEE ALSO |
swissChili | dc25b2b | 2021-02-23 17:07:13 -0800 | [diff] [blame] | 34 | src/paging.c, src/paging.h, Intel manual volume 4, Figure 4-4. |