pub struct PageFrameManager;Expand description
The page frame manager singleton.
This type implements AbsPageFrameManager and is the central point for
manipulating page frame flags and accessing per‑frame metadata.
Implementations§
Source§impl PageFrameManager
impl PageFrameManager
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Creates a new uninitialised page frame manager.
The manager is not usable until init() is called.
Sourcepub fn init()
pub fn init()
Initialises the global page frame manager.
This function:
- Detects total physical memory and computes the number of frames.
- Finds a physical memory region large enough to hold the
PageFramearray. - Maps that region into the kernel’s virtual address space.
- Initialises each
PageFramewith default values. - Sets the
RESERVEDflag for all frames, then clears it for usable RAM entries. - Finally reserves the frames that contain the metadata array itself.
§Panics
Panics if the memory map is unavailable or if no suitable region is found.
Trait Implementations§
Source§impl AbsPageFrameManager for PageFrameManager
impl AbsPageFrameManager for PageFrameManager
Source§fn check_flags(&self, pfn: PageFrameNumber, flag: PageFlags) -> bool
fn check_flags(&self, pfn: PageFrameNumber, flag: PageFlags) -> bool
Checks whether a given flag is set on the specified page frame.
Source§fn clear_flags(&self, pfn: PageFrameNumber, flag: PageFlags)
fn clear_flags(&self, pfn: PageFrameNumber, flag: PageFlags)
Clears the specified flags on the given page frame.
Source§fn max(&self) -> PageFrameNumber
fn max(&self) -> PageFrameNumber
Returns the maximum possible page frame number.
§TODO
This currently returns PFN::MAX, which may be larger than the actual
number of frames. A proper implementation should return the highest
valid PFN based on the detected memory size.
Source§fn min(&self) -> PageFrameNumber
fn min(&self) -> PageFrameNumber
Returns the minimum possible page frame number (always 0).
Source§fn present(&self, _pfn: PageFrameNumber) -> bool
fn present(&self, _pfn: PageFrameNumber) -> bool
Returns whether a page frame is physically present.
§TODO
This always returns true. A real implementation should validate
the PFN against the number of available frames.
Source§fn set_flags(&self, pfn: PageFrameNumber, flag: PageFlags)
fn set_flags(&self, pfn: PageFrameNumber, flag: PageFlags)
Sets the specified flags on the given page frame.
Source§fn get(&self, pfn: PageFrameNumber) -> Self::Access
fn get(&self, pfn: PageFrameNumber) -> Self::Access
Returns a locked guard that provides mutable access to the page frame metadata.
Source§impl Clone for PageFrameManager
impl Clone for PageFrameManager
Source§fn clone(&self) -> PageFrameManager
fn clone(&self) -> PageFrameManager
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more