Skip to main content

Zone

Struct Zone 

Source
pub struct Zone {
    pub zone_type: ZoneType,
    pub base: PhysAddr,
    pub page_count: usize,
    pub span_pages: usize,
    pub allocated: usize,
    pub free_lists: [u64; 12],
    pub buddy_bitmaps: [BuddyBitmap; 12],
    pub alloc_bitmap: BuddyBitmap,
}
Expand description

Memory zone with buddy allocator free lists

Fields§

§zone_type: ZoneType

Zone type

§base: PhysAddr

Base physical address of this zone

§page_count: usize

Total number of managed pages in this zone.

§span_pages: usize

Total address span covered by this zone metadata, in pages.

Unlike page_count, this includes holes and is used to size bitmaps.

§allocated: usize

Number of allocated pages

§free_lists: [u64; 12]

Free lists for each order (0-11), intrusive list head as physical addr. 0 means empty.

§buddy_bitmaps: [BuddyBitmap; 12]

Per-order buddy pair bitmaps (Linux-style parity map).

§alloc_bitmap: BuddyBitmap

Optional debug bitmap: 1 bit per page = allocated.

Implementations§

Source§

impl Zone

Source

pub const fn new(zone_type: ZoneType) -> Self

Create a new empty zone

Source

pub fn contains_address(&self, addr: PhysAddr) -> bool

Check if an address is within this zone

Source

pub fn available_pages(&self) -> usize

Get number of available (free) pages

Auto Trait Implementations§

§

impl Freeze for Zone

§

impl RefUnwindSafe for Zone

§

impl Send for Zone

§

impl !Sync for Zone

§

impl Unpin for Zone

§

impl UnsafeUnpin for Zone

§

impl UnwindSafe for Zone

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. 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.