pub struct PageFrameManager<T: AbsAddressTranslator> { /* private fields */ }Expand description
The page frame manager singleton.
self type implements AbsPageFrameManager and is the central point for
manipulating page frame flags and accessing per‑frame metadata.
Implementations§
Source§impl<T: AbsAddressTranslator> PageFrameManager<T>
impl<T: AbsAddressTranslator> PageFrameManager<T>
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(&self)
pub fn init(&self)
Initialises the global page frame manager.
self 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<T: AbsAddressTranslator> AbsPageFrameManager for PageFrameManager<T>
impl<T: AbsAddressTranslator> AbsPageFrameManager for PageFrameManager<T>
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
self 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
self 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<T: Clone + AbsAddressTranslator> Clone for PageFrameManager<T>
impl<T: Clone + AbsAddressTranslator> Clone for PageFrameManager<T>
Source§fn clone(&self) -> PageFrameManager<T>
fn clone(&self) -> PageFrameManager<T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more