[][src]Struct sunrise_kernel::frame_allocator::FrameAllocator

pub struct FrameAllocator;

The physical memory manager.

Serves physical memory in atomic blocks of size PAGE_SIZE, called frames.

An allocation request returns a PhysicalMemRegion, which represents a list of physically adjacent frames. When this returned PhysicalMemRegion is eventually dropped the frames are automatically freed and can be re-served by the FrameAllocator.

Trait Implementations

impl Debug for FrameAllocator[src]

impl FrameAllocatorTrait for FrameAllocator[src]

fn allocate_region(length: usize) -> Result<PhysicalMemRegion, KernelError>[src]

Allocates a single PhysicalMemRegion. Frames are physically consecutive.

Errors

  • InvalidSize
    • length is not page size aligned.
    • length is 0.

Panics

fn allocate_frames_fragmented(
    length: usize
) -> Result<Vec<PhysicalMemRegion>, KernelError>
[src]

Allocates physical frames, possibly fragmented across several physical regions.

Errors

  • InvalidSize:
    • length is not page size aligned.
    • length is 0.

Panics

  • Panics if FRAME_ALLOCATOR was not initialized.

impl FrameAllocatorTraitPrivate for FrameAllocator[src]

fn free_region(region: &PhysicalMemRegion)[src]

Frees an allocated physical region.

Panic

  • Panics if the frame was not allocated.
  • Panics if FRAME_ALLOCATOR was not initialized.

fn check_is_allocated(address: PhysicalAddress, length: usize) -> bool[src]

Checks that a physical region is marked allocated.

Rounds address and length.

Panic

  • Panics if FRAME_ALLOCATOR was not initialized.

fn check_is_reserved(address: PhysicalAddress, length: usize) -> bool[src]

Checks that a physical region is marked reserved. This implementation does not distinguish between allocated and reserved frames, so for us it's equivalent to check_is_allocated.

Rounds address and length.

Panic

  • Panics if FRAME_ALLOCATOR was not initialized.

Auto Trait Implementations

impl RefUnwindSafe for FrameAllocator

impl Send for FrameAllocator

impl Sync for FrameAllocator

impl Unpin for FrameAllocator

impl UnwindSafe for FrameAllocator

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.