diff --git a/blog/content/second-edition/posts/09-paging/index.md b/blog/content/second-edition/posts/09-paging/index.md index 13b0a428..1e9c38f9 100644 --- a/blog/content/second-edition/posts/09-paging/index.md +++ b/blog/content/second-edition/posts/09-paging/index.md @@ -6,10 +6,12 @@ date = 0000-01-01 template = "second-edition/page.html" +++ -In this post we start exploring memory management. We explore the difference between virtual memory and physical memory and learn how the translation process works. TODO +This post introduces _paging_, a very common memory management scheme that we will also use for our operating system. It explains why memory isolation is needed, how _segmentation_ works, what _virtual memory_ is, and how paging solves memory fragmentation issues. It also explores (multilevel) page tables and explains how paging works on the x86_64 architecture. +In contrast to the other posts on this blog, this post does not contain any code. The reason for this is that a working paging implementation already needs many advanced features, which might be overwhelming if introduced right at the beginning. By focusing on the fundamentals first we can explain the concepts step by step, before we introduce the advanced features and the implementation in the next post. + This blog is openly developed on [Github]. If you have any problems or questions, please open an issue there. You can also leave comments [at the bottom]. [Github]: https://github.com/phil-opp/blog_os @@ -88,16 +90,165 @@ In this example we have a page size of 50 bytes, which means that each memory re Compared to segmentation, paging uses lots of small, fixed sized memory regions instead of a few large, variable sized regions. Since every frame has the same size, there are no frames that are too small to be used so that no fragmentation occurs. -Or it _seems_ like no fragmentation occurs. There is still some hidden kind of fragmentation, the so-called _internal fragmentation_. Internal fragmentation occurs because not every memory region is an exact multiple of the page size. Imagine a program of size 101 in the above example: It would still need three pages of size 50, so it would occupy 49 bytes more than needed. +Or it _seems_ like no fragmentation occurs. There is still some hidden kind of fragmentation, the so-called _internal fragmentation_. Internal fragmentation occurs because not every memory region is an exact multiple of the page size. Imagine a program of size 101 in the above example: It would still need three pages of size 50, so it would occupy 49 bytes more than needed. To differentiate the two types of fragmentation, the kind of fragmentation that happens when using segmentation is called _external fragmentation_. Internal fragmentation is unfortunate, but often better than the external fragmentation that occurs with segmentation. It still wastes memory, but does not require defragmentation and makes the amount of fragmentation predictable (on average half a page per memory region). ### How does it work? -We saw that each of the potentially thousands of pages is individually mapped to a frame. This mapping information needs to be stored somewhere. Segmentation uses an individual segment selector register for each active memory region, which is not possible for paging since there are way more pages than registers. So the mapping information needs to be stored somewhere else. +We saw that each of the potentially thousands of pages is individually mapped to a frame. This mapping information needs to be stored somewhere. Segmentation uses an individual segment selector register for each active memory region, which is not possible for paging since there are way more pages than registers. Instead paging uses a table structure called _page table_ to store the mapping information. +For our above example the page tables would look like this: +![Three page tables, one for each program instance. For instance 1 the mapping is 0->100, 50->150, 100->200. For instance 2 it is 0->300, 50->350, 100->400. For instance 3 it is 0->250, 50->450, 100->500.](paging-page-tables.svg) +We see that each program instance has its own page table. A pointer to the currently active table is stored in a special CPU register. On `x86`, this register is called `CR3`. It is tha job of the operating system to load this register with the correct value before running each program instance. + +On each memory access, the CPU reads the table pointer from the register and looks up the mapped frame for the accessed page in the table. This is entirely done in hardware and completely transparent to the running program. To speed up the translation process, many CPU architectures have a special cache that remembers the results of the last translations. + +Depending on the architecture, page table entries can also store attributes such as access permissions in a flags field. In the above example, the "r/w" flag makes the page both readable and writable. + +### Multilevel Page Tables + +The simple page tables we just saw have a problem in larger address spaces: they waste memory. For example, imagine a program that uses the four virtual pages 0, 1 000 000, 1_000 050, and 1 000 100: + +![Page 0 mapped to frame 0 and pages 1 000 000–1 000 150 mapped to frames 100–250](single-level-page-table.svg) + +It only needs 4 physical frames, but the page table has over a million entries. We can't omit the empty entries because then the CPU would no longer be able to jump directly to the correct entry in the translation process (e.g. it is no longer guaranteed that the fourth page uses the fourth entry). + +To reduce the wasted memory, we can use a **two-level page table**. The idea is that we use different page tables for different address regions. An additional table called _level 2_ page table contains the mapping between address regions and (level 1) page tables. + +This is best explained by an example. Let's define that each level 1 page table is responsible for a region of size 10 000. Then the following tables would exist for the above example mapping: + +![Page 0 points to entry 0 of the level 2 page table, which points to the level 1 page table T1. The first entry of T1 points to frame 0, the other entries are empty. Pages 1 000 000–1 000 150 point to the 100th entry of the level 2 page table, which points to a different level 1 page table T2. The first three entries of T2 point to frames 100–250, the other entries are empty.](multilevel-page-table.svg) + +Page 0 falls into the first 10 000 byte region, so it uses the first entry of the level 2 page table. This entry points to level 1 page table T1, which specifies that page 0 points to frame 0. + +The pages 1 000 000, 1 000 050, and 1 000 100 all fall into the 100th memory region (which goes from 1 000 000 to 1 010 000), so they use the 100th entry of the level 2 page table. This entry points at a different level 1 page table T2. The T2 table maps the three pages to frames 100, 150, and 200. Note that the page number does not include the region offset, so e.g. for page 1 000 050 we use the T2 entry for page 50 (= 1 000 050 - 1 000 000). + +We still have 100 empty entries in the level 2 table, but much fewer than the million empty entries before. The reason for this savings is that we don't need to create level 1 page tables for the unmapped memory regions between 10 000 and 1 000 000. + +The principle of two-level page tables can be extended to three, four, or more levels. Then the page table register points at the highest level table, which points to the next lower level table, which points to the next lower level, and so on. The level 1 page table then points at the mapped frame. The principle in general is called a _multilevel_ or _hierarchical_ page table. + +Now that we know how paging and multilevel page tables works, we can look at how paging is implemented in the x86_64 architecture (we assume in the following that the CPU runs in 64-bit mode). + +## Paging on x86_64 + +The x86_64 architecture uses a 4-level page table and a page size of 4KiB. Each page table, independent of the level, has a fixed sized of 512 entries. Each entry has a size of 8 bytes, so each table is 512 * 8B = 4KiB large and thus fits exactly into one page. + +The page table index for level is derived directly from the virtual address: + +![Bits 0–12 are the page offset, bits 12–21 the level 1 index, bits 21–30 the level 2 index, bits 30–39 the level 3 index, and bits 39–48 the level 4 index](x86_64-table-indices-from-address.svg) + +We see that each table index consists of 9 bits, which makes sense because each table has 2^9 = 512 entries. The lowest 12 bits are the offset in the 4KiB page (2^12 bytes = 4KiB). Bits 48 to 64 are discarded, which means that x86_64 is not really 64-bit and only supports 48-bit addresses. There are plans to extend the address size to 57 bits through a [5-level page table], but no processors that support this feature exist yet. + +[5-level page table]: https://en.wikipedia.org/wiki/Intel_5-level_paging + +Even though bits 48 to 64 are discarded, they can't be set to arbitrary values. Instead all bits in this range have to be copies of bit 47 in order to keep addresses unique and allow future extensions like the 5-level page table. This is called _sign-extension_ because it's very similar to the [sign extension in two's complement]. When a address is not correctly sign-extended, the CPU throws an exception. + +[sign extension in two's complement]: https://en.wikipedia.org/wiki/Two's_complement#Sign_extension + +### Example Translation + +Let's go through an example to understand how the translation process works in detail: + +![An example 4-level page hierarchy with each page table shown in physical memory](x86_64-page-table-translation.svg) + +The physical address of the currently active level 4 page table, which is the root of the 4-level page table, is stored in the `CR3` register. Each page table entry then points to the physical frame of the next level table. The entry of the level 1 table then points to the mapped frame. Note that all addresses in the page tables are physical instead of virtual, because otherwise the CPU would need to translate those addresses too (which could cause a never-ending recursion). + +The above page table hierarchy maps two pages (in blue). The start addresses of these pages are `0x803FE7F000` and `0x803FE00000`. Let's see what happens when the program tries to read from address `0x803FE7F5CE`. First, we convert the address to binary and determine the page table indices and the page offset for the address: + +![An example 4-level page hierarchy with each page table shown in physical memory](x86_64-page-table-translation-addresses.svg) + +With these indices, we can now walk the page table hierarchy to determine the mapped frame for the address: + +- We start by reading the address of the level 4 table out of the `CR3` register. +- Then we look at the entry with index 1 of that table, which tells us that the level 3 table is stored at address 16KiB. +- We load the level 3 table from that address and look at the entry with index 0, which points us to the level 2 table at 14KiB. +- The level 2 index is 511, so we look at the last entry of that page to find out the address of the level 1 table. +- The entry with index 127 of the level 1 table we finally find that the page is mapped to frame 12KiB, or 0xc000 in hexadecimal. +- The final step is to add the page offset to the frame address to get the physical address 0xc000 + 0x5ce = 0xc5ce. + +The permissions for the page in the level 1 table are `r`, which means read-only. The hardware enforces this permissions and would throw an exception if we tried to write to that page. Permissions in higher level pages restrict the possible permissions in lower level, so if we set the level 3 entry to read-only, no pages that use this entry can be writable, even if lower levels specify read/write permissions. + +It's important to note that even through this example used only a single instance of each table, there are typically multiple instances of each level in each address space. At maximum, there are: + +- one level 4 table, +- 512 level 3 tables (because the level 4 table has 512 entries), +- 512 * 512 level 2 tables (because each of the 512 level 3 tables has 512 entries), and +- 512 * 512 * 512 level 1 tables (512 entries for each level 2 table). + +### Page Table Format + +Page tables on the x86_64 architecture are basically an array of 512 entries. In Rust syntax: + +```rust +#[repr(align(4096))] +pub struct PageTable { + entries: [PageTableEntry; 512], +} +``` + +As indicated by the `repr` attribute, page tables need to be page aligned, i.e. aligned on a 4KiB boundary. This requirement guarantees that a page table always fills a complete page and allows an optimization that makes entries very compact. + +Each entry is 8 bytes (64 bits) large and has the following format: + +Bit(s) | Name | Meaning +------ | ---- | ------- +0 | present | the page is currently in memory +1 | writable | it's allowed to write to this page +2 | user accessible | if not set, only kernel mode code can access this page +3 | write through caching | writes go directly to memory +4 | disable cache | no cache is used for this page +5 | accessed | the CPU sets this bit when this page is used +6 | dirty | the CPU sets this bit when a write to this page occurs +7 | huge page/null | must be 0 in P1 and P4, creates a 1GiB page in P3, creates a 2MiB page in P2 +8 | global | page isn't flushed from caches on address space switch (PGE bit of CR4 register must be set) +9-11 | available | can be used freely by the OS +12-51 | physical address | the page aligned 52bit physical address of the frame or the next page table +52-62 | available | can be used freely by the OS +63 | no execute | forbid executing code on this page (the NXE bit in the EFER register must be set) + +We see that only bits 12–51 are used to store the physical frame address, the remaining bits are used as flags or can be freely used by the operating system. This is possible because we always point to a 4096-byte aligned address, either to a page-aligned page table or to the start of a mapped frame. This means that bits 0–11 are always zero, so there is no reason to store these bits because the hardware can just set them to zero before using the address. The same is true for bits 52–63, because the x86_64 architecture only supports 52-bit physical addresses (similar to how it only supports 48-bit virtual addresses). + +Let's take a closer look at the available flags: + +- The `present` flag differentiates mapped pages from unmapped ones. It can be used to temporary swap out pages to disk when main memory becomes full. When the page is accessed subsequently, a special exception called _page fault_ occurs, to which the operating system can react by reloading the missing page from disk and then continuing the program. +- The `writable` and `no execute` flags control whether the contents of the page are writeable or contain executable instructions respectively. +- The `accessed` and `dirty` flags are automatically set by the CPU when a read or write to the page occurs. This information can be leveraged by the operating system e.g. to decide which pages to swap out or whether the page contents were modified since the last save to disk. +- The `write through caching` and `disable cache` flags allow to control the caches for every page individually. +- The `user accessible` flag makes a page available to userspace code, otherwise it is only aaccessible when the CPU is in kernel mode. This feature can be used to make [system calls] faster by keeping the kernel mapped while an userspace program is running. However, the [Spectre] vulnerability can allow userspace programs to read these pages nontheless. +- The `global` flag signals to the hardware that a page is available in all address spaces and thus does not need to be removed from the translation cache (see the section about the TLB below) on address space switches. This flag is commonly used together with a cleared `user accessible` flag to map the kernel code to all address spaces. +- The `huge page` flag allows to create pages of larger sizes by letting the entries of the level 2 or level 3 page tables directly point to a mapped frame. With this bit set, the page size increases by factor 512 to either 2MiB = 512 * 4KiB for level 2 entries or even 1GiB = 512 * 2MiB for level 3 entries. The advantage of using larger pages is that fewer lines of the translation cache and fewer page tables are needed. + +[system calls]: https://en.wikipedia.org/wiki/System_call +[Spectre]: https://en.wikipedia.org/wiki/Spectre_(security_vulnerability) + +The `x86_64` crate provides types for [page tables] and their [entries], so we don't need to create these structures ourselves. + +[page tables]: https://docs.rs/x86_64/0.3.4/x86_64/structures/paging/struct.PageTable.html +[entries]: https://docs.rs/x86_64/0.3.4/x86_64/structures/paging/struct.PageTableEntry.html + +### The Translation Lookaside Buffer + +A 4-level page table makes the translation of virtual addresses expensive, because each translation requires 4 memory accesses. To improve performance, the x86_64 architecture caches the last few translations in the so-called _translation lookaside buffer_ (TLB). This allows to skip the translation when the translation is still cached. + +Unlike the other CPU caches, the TLB is not fully transparent since it does not update or remove translations when a mapping in the page table changes. Instead it must be manually updated whenever a mapping in the page table changes. To do this, there is a special CPU instruction called [`invlpg`] (“invalidate page”) that removes the translation for the specified page from the TLB, so that it is loaded again from the page table on the next access. The TLB can also be flushed completely by reloading the `CR3` register, which simulates an address space switch. The `x86_64` crate provides Rust functions for both variants in the [`tlb` module]. + +[`invlpg`]: https://www.felixcloutier.com/x86/INVLPG.html +[`tlb` module]: https://docs.rs/x86_64/0.3.4/x86_64/instructions/tlb/index.html + +It is important to remember flushing the TLB on each page table modification because otherwise the CPU might keep using the old translation, which can lead to non-deterministic bugs that are very hard to debug. + +## Summary + +This post introduced two memory protection techniques: segmentation and paging. While the former uses a variable-sized memory regions and suffers from external fragmentation, the latter uses fixed-sized pages and allows much more fine-grained control over access permissions. + +Paging stores the mapping information for pages in page tables with one or more levels. The x86_64 architecture uses 4-level page tables and a page size of 4KiB. The hardware automatically walks the page tables and caches the resulting translations in the translation lookaside buffer (TLB). This buffer is not updated transparently and needs to be flushed manually on page table changes. + +## What's next? + +The next post will build upon the fundamentals we learned in this post. It will introduce an advanced technique called _recursive page tables_ and then use that feature to implement a software based translation function and mapping functions. ------- diff --git a/blog/content/second-edition/posts/09-paging/multilevel-page-table.svg b/blog/content/second-edition/posts/09-paging/multilevel-page-table.svg new file mode 100644 index 00000000..e9333357 --- /dev/null +++ b/blog/content/second-edition/posts/09-paging/multilevel-page-table.svg @@ -0,0 +1,2 @@ + +
Physical Memory
Physical Memory
Virtual Memory
<div>Virtual Memory</div>
0
[Not supported by viewer]
1 000 050
<div>1 000 050</div>
100
[Not supported by viewer]
250
[Not supported by viewer]
0
[Not supported by viewer]
1 000 000
<div>1 000 000</div>
1 000 100
<div>1 000 100</div>
1 000 150
<div>1 000 150</div>
Memory
Region
Level 1
Table
0T1
10 000-

1 000 000T2
[Not supported by viewer]
Page
FrameFlags
0100
r/w
50150
r/w
100200
r/w
150-
-
[Not supported by viewer]
Page
FrameFlags
00
r/w
50-
-
[Not supported by viewer]
100
100
50
50
50
50
Level 2 Page Table
Level 2 Page Table
Level 1 Page Table T1
Level 1 Page Table T1
Level 1 Page Table T2
Level 1 Page Table T2
\ No newline at end of file diff --git a/blog/content/second-edition/posts/09-paging/multilevel-paging-motivation.svg b/blog/content/second-edition/posts/09-paging/multilevel-paging-motivation.svg new file mode 100644 index 00000000..c7500104 --- /dev/null +++ b/blog/content/second-edition/posts/09-paging/multilevel-paging-motivation.svg @@ -0,0 +1,2 @@ + +
Physical Memory
Physical Memory
Virtual Memory
<div>Virtual Memory</div>
0
[Not supported by viewer]
1 000 050
<div>1 000 050</div>
100
[Not supported by viewer]
250
[Not supported by viewer]
0
[Not supported by viewer]
1 000 000
<div>1 000 000</div>
1 000 100
<div>1 000 100</div>
1 000 150
<div>1 000 150</div>
\ No newline at end of file diff --git a/blog/content/second-edition/posts/09-paging/paging-page-tables.svg b/blog/content/second-edition/posts/09-paging/paging-page-tables.svg new file mode 100644 index 00000000..0674e2f2 --- /dev/null +++ b/blog/content/second-edition/posts/09-paging/paging-page-tables.svg @@ -0,0 +1,2 @@ + +
Physical Memory
Physical Memory
Virtual Memory
<div>Virtual Memory</div>
Virtual Memory
Virtual Memory
0
[Not supported by viewer]
150
[Not supported by viewer]
0
[Not supported by viewer]
150
[Not supported by viewer]
100
[Not supported by viewer]
250
[Not supported by viewer]
0
[Not supported by viewer]
300
[Not supported by viewer]
450
[Not supported by viewer]
550
[Not supported by viewer]
Virtual Memory
Virtual Memory
0
[Not supported by viewer]
150
[Not supported by viewer]
PageFrameFlags
0100r/w
50
150r/w
100200
r/w
150--
[Not supported by viewer]
PageFrameFlags
0300r/w
50
350r/w
100400
r/w
150--
[Not supported by viewer]
PageFrameFlags
0250
r/w
50
450
r/w
100500
r/w
150--
[Not supported by viewer]
\ No newline at end of file diff --git a/blog/content/second-edition/posts/09-paging/segmentation-fragmentation-compacted.svg b/blog/content/second-edition/posts/09-paging/segmentation-fragmentation-compacted.svg index b49e8813..f71d3f97 100644 --- a/blog/content/second-edition/posts/09-paging/segmentation-fragmentation-compacted.svg +++ b/blog/content/second-edition/posts/09-paging/segmentation-fragmentation-compacted.svg @@ -1,2 +1,2 @@ -
Physical Memory
Physical Memory
Virtual Memory
<div>Virtual Memory</div>
Virtual Memory
Virtual Memory
0
[Not supported by viewer]
150
[Not supported by viewer]
0
[Not supported by viewer]
150
[Not supported by viewer]
150
[Not supported by viewer]
0
[Not supported by viewer]
300
[Not supported by viewer]
Offset
0
[Not supported by viewer]
Offset
150
[Not supported by viewer]
550
[Not supported by viewer]
Virtual Memory
Virtual Memory
0
[Not supported by viewer]
150
[Not supported by viewer]
?
?
\ No newline at end of file +
Physical Memory
Physical Memory
Virtual Memory
<div>Virtual Memory</div>
Virtual Memory
Virtual Memory
0
[Not supported by viewer]
150
[Not supported by viewer]
0
[Not supported by viewer]
150
[Not supported by viewer]
150
[Not supported by viewer]
0
[Not supported by viewer]
300
[Not supported by viewer]
Offset
0
[Not supported by viewer]
Offset
150
[Not supported by viewer]
550
[Not supported by viewer]
Virtual Memory
Virtual Memory
0
[Not supported by viewer]
150
[Not supported by viewer]
Offset
300
[Not supported by viewer]
\ No newline at end of file diff --git a/blog/content/second-edition/posts/09-paging/segmentation-fragmentation.svg b/blog/content/second-edition/posts/09-paging/segmentation-fragmentation.svg index 95a143ca..6d4d726e 100644 --- a/blog/content/second-edition/posts/09-paging/segmentation-fragmentation.svg +++ b/blog/content/second-edition/posts/09-paging/segmentation-fragmentation.svg @@ -1,2 +1,2 @@ -
Physical Memory
Physical Memory
Virtual Memory
<div>Virtual Memory</div>
Virtual Memory
Virtual Memory
0
[Not supported by viewer]
150
[Not supported by viewer]
0
[Not supported by viewer]
150
[Not supported by viewer]
100
[Not supported by viewer]
250
[Not supported by viewer]
0
[Not supported by viewer]
300
[Not supported by viewer]
450
[Not supported by viewer]
Offset
100
[Not supported by viewer]
Offset
300
[Not supported by viewer]
550
[Not supported by viewer]
Virtual Memory
Virtual Memory
0
[Not supported by viewer]
150
[Not supported by viewer]
?
?
\ No newline at end of file +
Physical Memory
Physical Memory
Virtual Memory
<div>Virtual Memory</div>
Virtual Memory
Virtual Memory
0
[Not supported by viewer]
150
[Not supported by viewer]
0
[Not supported by viewer]
150
[Not supported by viewer]
100
[Not supported by viewer]
250
[Not supported by viewer]
0
[Not supported by viewer]
300
[Not supported by viewer]
450
[Not supported by viewer]
Offset
100
[Not supported by viewer]
Offset
300
[Not supported by viewer]
550
[Not supported by viewer]
Virtual Memory
Virtual Memory
0
[Not supported by viewer]
150
[Not supported by viewer]
?
?
\ No newline at end of file diff --git a/blog/content/second-edition/posts/09-paging/single-level-page-table.svg b/blog/content/second-edition/posts/09-paging/single-level-page-table.svg new file mode 100644 index 00000000..8dbefd7e --- /dev/null +++ b/blog/content/second-edition/posts/09-paging/single-level-page-table.svg @@ -0,0 +1,2 @@ + +
Page
FrameFlags
00
r/w
50
-
-



1 000 000
100
r/w
1 000 050150
r/w
1 000 100
200
r/w
1 000 150-
-
[Not supported by viewer]
Physical Memory
Physical Memory
Virtual Memory
<div>Virtual Memory</div>
0
[Not supported by viewer]
1 000 050
<div>1 000 050</div>
100
[Not supported by viewer]
250
[Not supported by viewer]
0
[Not supported by viewer]
1 000 000
<div>1 000 000</div>
1 000 100
<div>1 000 100</div>
1 000 150
<div>1 000 150</div>
50
[Not supported by viewer]
100
[Not supported by viewer]
50
50
\ No newline at end of file diff --git a/blog/content/second-edition/posts/09-paging/x86_64-page-table-translation-addresses.svg b/blog/content/second-edition/posts/09-paging/x86_64-page-table-translation-addresses.svg new file mode 100644 index 00000000..09aae1dc --- /dev/null +++ b/blog/content/second-edition/posts/09-paging/x86_64-page-table-translation-addresses.svg @@ -0,0 +1,2 @@ + +
00000000 00000000 000 000 001 000 000 000 111 111 111 001 111 111 0101 1100 1110
<div align="left">00000000 00000000 000 000 001 000 000 000 111 111 111 001 111 111 0101 1100 1110</div>
Virtual Address:
Virtual Address:
Sign Extension
Sign Extension
Level 4
Index = 1
[Not supported by viewer]
Level 3
Index = 0
[Not supported by viewer]
Level 2
Index = 511
[Not supported by viewer]
Level 1
Index = 127
[Not supported by viewer]
Offset
= 0x5CE
[Not supported by viewer]
\ No newline at end of file diff --git a/blog/content/second-edition/posts/09-paging/x86_64-page-table-translation.svg b/blog/content/second-edition/posts/09-paging/x86_64-page-table-translation.svg new file mode 100644 index 00000000..719fa4aa --- /dev/null +++ b/blog/content/second-edition/posts/09-paging/x86_64-page-table-translation.svg @@ -0,0 +1,2 @@ + +
Physical Memory
Physical Memory
0KiB
[Not supported by viewer]
IndexFrameFlags
0-
-
116KiBr/w


[Not supported by viewer]
Level 4 Page Table
Level 4 Page Table
4KiB
[Not supported by viewer]
IndexFrameFlags
024KiB
r/w



[Not supported by viewer]
Level 3 Page Table
Level 3 Page Table
16KiB
<div>16KiB</div>
24KiB
<div>24KiB</div>
8KiB
[Not supported by viewer]
IndexFrameFlags



511
24KiB
r/w
[Not supported by viewer]
Level 2 Page Table
Level 2 Page Table
Level 1 Page Table
Level 1 Page Table
32KiB
<div>32KiB</div>
IndexFrameFlags
036KiB
r/w



127
12KiBr


[Not supported by viewer]
4KiB
4KiB
CR3 Register
CR3 Register
\ No newline at end of file diff --git a/blog/content/second-edition/posts/09-paging/x86_64-table-indices-from-address.svg b/blog/content/second-edition/posts/09-paging/x86_64-table-indices-from-address.svg new file mode 100644 index 00000000..18bcdd21 --- /dev/null +++ b/blog/content/second-edition/posts/09-paging/x86_64-table-indices-from-address.svg @@ -0,0 +1,2 @@ + +
64
[Not supported by viewer]
0
[Not supported by viewer]
12
[Not supported by viewer]
21
21
30
[Not supported by viewer]
39
39
48
48
Level 4
Index
[Not supported by viewer]
Level 3
Index
[Not supported by viewer]
Level 2
Index
[Not supported by viewer]
Level 1
Index
[Not supported by viewer]
Page Offset
Page Offset
\ No newline at end of file