Skip to content

Commit

Permalink
Add PageSize trait for defining 4K, 2M, and 1G huge pages (#1031)
Browse files Browse the repository at this point in the history
* All chunk-related types are now parameterized with a `P: PageSize`
  type parameter:
  * `Page` and `Frame`, which ensure that the underlying virtual
    or physical address is always properly aligned to the specified size.
  * `PageRange` and `FrameRange`, which ensure that the range of
    pages or frames are correctly aligned and only can be created
    in granular chunks of the given `PageSize`.
    * When iterating over a range of huge pages or frames, each step
      will be at the granularity of one huge page, which makes it easy
      to iterate of huge pages and huge frames in lockstep.
  * There are various implementations of the conversion traits 
    `From` and `TryFrom` for normal and huge pages/frames and ranges.
  * The `PageSize` parameter can only be one of 3 marker structs:
    1. `Page4K`: a normal 4KiB page (P1-level), which is the default.
    2. `Page2M`: a P2-level huge page.
    3. `Page1G`: a P3-level huge page.


* This is only relevant to x86_64 at the moment, though we may add
  aarch64 huge page sizes in the future too.

Co-authored-by: Kevin Boos <kevinaboos@gmail.com>
  • Loading branch information
NIMogen and kevinaboos authored Sep 8, 2023
1 parent 349adf8 commit b521678
Show file tree
Hide file tree
Showing 2 changed files with 481 additions and 85 deletions.
Loading

0 comments on commit b521678

Please sign in to comment.