mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 22:37:49 +00:00
Some small improvements
This commit is contained in:
@@ -8,7 +8,7 @@ In this post we will create a paging module, which allows us to access and modif
|
||||
TODO current Rust nightly version, link to github repo, etc.
|
||||
|
||||
## Paging
|
||||
_Paging_ is a memory management scheme that separates virtual and physical memory. The address space is split into equal sized _pages_ and _page tables_ specify which virtual page points to which physical page. For an extensive paging introduction take a look at the paging chapter ([PDF][paging chapter]) of the [Three Easy Pieces] OS book.
|
||||
_Paging_ is a memory management scheme that separates virtual and physical memory. The address space is split into equal sized _pages_ and _page tables_ specify which virtual page points to which physical frame. For an extensive paging introduction take a look at the paging chapter ([PDF][paging chapter]) of the [Three Easy Pieces] OS book.
|
||||
|
||||
[paging chapter]: http://pages.cs.wisc.edu/~remzi/OSTEP/vm-paging.pdf
|
||||
[Three Easy Pieces]: http://pages.cs.wisc.edu/~remzi/OSTEP/
|
||||
@@ -25,7 +25,7 @@ To translate an address, the CPU reads the P4 address from the CR3 register. The
|
||||
|
||||

|
||||
|
||||
The P4 entry points to a P3 table, where the next 9 bits of the address are used to select an entry. The P3 entry then points to a P2 table and the P2 entry points to a P1 table. The P1 entry, which is specified through bits 12–20, finally points to the physical page.
|
||||
The P4 entry points to a P3 table, where the next 9 bits of the address are used to select an entry. The P3 entry then points to a P2 table and the P2 entry points to a P1 table. The P1 entry, which is specified through bits 12–20, finally points to the physical frame.
|
||||
|
||||
So let's create a Rust module for it! (TODO better transition)
|
||||
|
||||
@@ -737,7 +737,7 @@ We can also free the P1, P2, or even P3 table when the last entry is freed. But
|
||||
|
||||
_Spoiler_: There is an ugly bug in this function, which we will find in the next section.
|
||||
|
||||
## Testing it
|
||||
## Testing and Bugfixing
|
||||
To test it, we add a `test_paging` function in `memory/paging/mod.rs`:
|
||||
|
||||
```rust
|
||||
|
||||
Reference in New Issue
Block a user