From 397c1adfac42ed6f57a803f2a310b865236242c9 Mon Sep 17 00:00:00 2001
From: tsoutsman
Date: Sat, 9 Sep 2023 06:02:24 +0000
Subject: [PATCH] Add `PageSize` trait for defining 4K, 2M, and 1G huge pages
(#1031)
* 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 b5216784a10705e446b4a765c1df94dfc6cfa41b
---
doc/compositor/trait.CompositableRegion.html | 8 +-
.../fn.context_switch_regular.html | 2 +-
.../fn.read_first_register.html | 2 +-
.../macro.restore_registers_regular.html | 2 +-
.../macro.save_registers_regular.html | 2 +-
.../macro.switch_stacks.html | 2 +-
.../struct.ContextRegular.html | 6 +-
.../struct.AllocatedFrame.html | 11 +-
doc/frame_allocator/struct.Frames.html | 14 +-
.../struct.PhysicalMemoryRegion.html | 14 +-
doc/implementors/core/borrow/trait.Borrow.js | 2 +-
doc/implementors/core/clone/trait.Clone.js | 2 +-
doc/implementors/core/cmp/trait.Eq.js | 2 +-
doc/implementors/core/cmp/trait.Ord.js | 2 +-
doc/implementors/core/cmp/trait.PartialEq.js | 2 +-
doc/implementors/core/cmp/trait.PartialOrd.js | 2 +-
doc/implementors/core/convert/trait.From.js | 4 +-
doc/implementors/core/convert/trait.Into.js | 2 +-
.../core/convert/trait.TryFrom.js | 1 +
.../core/default/trait.Default.js | 2 +-
doc/implementors/core/fmt/trait.Binary.js | 2 +-
doc/implementors/core/fmt/trait.Debug.js | 4 +-
doc/implementors/core/fmt/trait.Display.js | 2 +-
doc/implementors/core/fmt/trait.LowerHex.js | 2 +-
doc/implementors/core/fmt/trait.Octal.js | 2 +-
doc/implementors/core/fmt/trait.Pointer.js | 2 +-
doc/implementors/core/fmt/trait.UpperHex.js | 2 +-
doc/implementors/core/hash/trait.Hash.js | 2 +-
.../core/iter/range/trait.Step.js | 2 +-
.../iter/traits/collect/trait.IntoIterator.js | 2 +-
doc/implementors/core/marker/trait.Copy.js | 4 +-
doc/implementors/core/marker/trait.Freeze.js | 2 +-
doc/implementors/core/marker/trait.Send.js | 2 +-
.../core/marker/trait.StructuralEq.js | 2 +-
.../core/marker/trait.StructuralPartialEq.js | 2 +-
doc/implementors/core/marker/trait.Sync.js | 2 +-
doc/implementors/core/marker/trait.Unpin.js | 2 +-
doc/implementors/core/ops/arith/trait.Add.js | 2 +-
.../core/ops/arith/trait.AddAssign.js | 2 +-
doc/implementors/core/ops/arith/trait.Sub.js | 2 +-
.../core/ops/arith/trait.SubAssign.js | 2 +-
doc/implementors/core/ops/bit/trait.BitAnd.js | 2 +-
.../core/ops/bit/trait.BitAndAssign.js | 2 +-
doc/implementors/core/ops/bit/trait.BitOr.js | 2 +-
.../core/ops/deref/trait.Deref.js | 2 +-
.../panic/unwind_safe/trait.RefUnwindSafe.js | 2 +-
.../panic/unwind_safe/trait.UnwindSafe.js | 2 +-
.../memory_structs/trait.PageSize.js | 4 +
doc/implementors/zerocopy/trait.FromBytes.js | 2 +-
doc/memory/all.html | 2 +-
doc/memory/enum.AllocationRequest.html | 4 +-
doc/memory/enum.MemChunkSize.html | 16 +
.../fn.allocate_pages_by_bytes_in_range.html | 2 +-
doc/memory/fn.allocate_pages_in_range.html | 2 +-
doc/memory/index.html | 8 +-
doc/memory/sidebar-items.js | 2 +-
doc/memory/struct.AllocatedPages.html | 8 +-
doc/memory/struct.CopyableFrameRange.html | 28 +-
doc/memory/struct.CopyablePageRange.html | 28 +-
doc/memory/struct.Frame.html | 63 ++-
doc/memory/struct.FrameRange.html | 57 +-
doc/memory/struct.MappedPages.html | 6 +-
doc/memory/struct.Page.html | 66 ++-
doc/memory/struct.Page1G.html | 20 +
doc/memory/struct.Page2M.html | 20 +
doc/memory/struct.Page4K.html | 20 +
doc/memory/struct.PageRange.html | 57 +-
doc/memory/struct.PhysicalAddress.html | 8 +-
doc/memory/struct.VirtualAddress.html | 8 +-
doc/memory/trait.PageSize.html | 8 +
doc/memory_structs/all.html | 2 +-
doc/memory_structs/enum.MemChunkSize.html | 16 +
doc/memory_structs/enum.MemoryState.html | 6 +-
doc/memory_structs/index.html | 4 +-
doc/memory_structs/sidebar-items.js | 2 +-
.../struct.CopyableFrameRange.html | 21 +-
.../struct.CopyablePageRange.html | 21 +-
doc/memory_structs/struct.Frame.html | 45 +-
doc/memory_structs/struct.FrameRange.html | 51 +-
doc/memory_structs/struct.Page.html | 53 +-
doc/memory_structs/struct.Page1G.html | 19 +
doc/memory_structs/struct.Page2M.html | 19 +
doc/memory_structs/struct.Page4K.html | 19 +
doc/memory_structs/struct.PageRange.html | 51 +-
.../struct.PhysicalAddress.html | 24 +-
doc/memory_structs/struct.VirtualAddress.html | 24 +-
doc/memory_structs/trait.PageSize.html | 8 +
.../struct.UnmappedFrameRange.html | 14 +-
doc/search-index.js | 6 +-
doc/serial_port/struct.SerialPort.html | 14 +-
doc/spawn/fn.cleanup_bootstrap_tasks.html | 2 +-
doc/spawn/fn.init.html | 2 +-
.../fn.new_application_task_builder.html | 2 +-
doc/spawn/fn.new_task_builder.html | 2 +-
doc/spawn/index.html | 2 +-
doc/spawn/struct.BootstrapTaskRef.html | 6 +-
doc/spawn/struct.TaskBuilder.html | 24 +-
doc/src/context_switch_regular/x86_64.rs.html | 12 +
doc/src/memory_structs/lib.rs.html | 528 +++++++++++++++---
doc/src/spawn/lib.rs.html | 24 +-
doc/stack/struct.Stack.html | 6 +-
101 files changed, 1139 insertions(+), 471 deletions(-)
create mode 100644 doc/implementors/memory_structs/trait.PageSize.js
create mode 100644 doc/memory/enum.MemChunkSize.html
create mode 100644 doc/memory/struct.Page1G.html
create mode 100644 doc/memory/struct.Page2M.html
create mode 100644 doc/memory/struct.Page4K.html
create mode 100644 doc/memory/trait.PageSize.html
create mode 100644 doc/memory_structs/enum.MemChunkSize.html
create mode 100644 doc/memory_structs/struct.Page1G.html
create mode 100644 doc/memory_structs/struct.Page2M.html
create mode 100644 doc/memory_structs/struct.Page4K.html
create mode 100644 doc/memory_structs/trait.PageSize.html
diff --git a/doc/compositor/trait.CompositableRegion.html b/doc/compositor/trait.CompositableRegion.html
index d39215c90f..c62dc234c8 100644
--- a/doc/compositor/trait.CompositableRegion.html
+++ b/doc/compositor/trait.CompositableRegion.html
@@ -31,16 +31,16 @@
The dest_coord
is the coordinate in the destination buffer (relative to its top-left corner)
where the src_fb
will be composited (starting at the src_fb
’s top-left corner).
src_fb_row_range
is the index range of rows in the source framebuffer to blend.
-