Skip to main content

PageFrameManager

Struct PageFrameManager 

Source
pub struct PageFrameManager;
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 PageFrameManager

Source

pub const fn new() -> Self

Creates a new uninitialised page frame manager.

The manager is not usable until init() is called.

Source

pub fn init(&self)

Initialises the global page frame manager.

self function:

  1. Detects total physical memory and computes the number of frames.
  2. Finds a physical memory region large enough to hold the PageFrame array.
  3. Maps that region into the kernel’s virtual address space.
  4. Initialises each PageFrame with default values.
  5. Sets the RESERVED flag for all frames, then clears it for usable RAM entries.
  6. 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

Source§

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)

Clears the specified flags on the given page frame.

Source§

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

Returns the minimum possible page frame number (always 0).

Source§

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)

Sets the specified flags on the given page frame.

Source§

fn get(&self, pfn: PageFrameNumber) -> Self::Access

Returns a locked guard that provides mutable access to the page frame metadata.

Source§

type Flags = PageFlags

Type representing flags that can be set on a page frame. Must implement AbsFlags.
Source§

type Access = MutexGuard<'static, PageFrame, Spin>

Type used to access a page frame (e.g., a reference or a descriptor).
Source§

impl Clone for PageFrameManager

Source§

fn clone(&self) -> PageFrameManager

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for PageFrameManager

Source§

impl Debug for PageFrameManager

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PageFrameManager

Source§

fn default() -> PageFrameManager

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.