Struct EnarxAllocator

Source
pub struct EnarxAllocator { /* private fields */ }
Expand description

The allocator

The allocator struct is holding a linked list Heap allocator and information about the hypervisor’s capabilities to extend the available memory.

It also implements:

  • paging::FrameAllocator
  • paging::FrameAllocator

Implementations§

Source§

impl EnarxAllocator

Source

pub fn allocate_and_map_memory( &mut self, map_to: VirtAddr, size: usize, flags: PageTableFlags, parent_flags: PageTableFlags, ) -> Result<&'static mut [u8], AllocateError>

Allocate memory and map it to the given virtual address

Source

pub fn map_memory( &mut self, map_from: PhysAddr, map_to: VirtAddr, size: usize, flags: PageTableFlags, parent_flags: PageTableFlags, ) -> Result<(), AllocateError>

Map physical memory to the given virtual address

FIXME: change PhysAddr to ShimPhysAddr to ensure encrypted memory

Source

pub fn unmap_memory( &mut self, virt_addr: VirtAddr, size: usize, ) -> Result<(), UnmapError>

FIXME: unmap

Source

pub fn try_alloc(&mut self, layout: Layout) -> Option<NonNull<u8>>

Allocate memory by Layout

Source

pub unsafe fn deallocate(&mut self, ptr: *mut u8, layout: Layout)

Deallocate memory

§Safety

Unsafe, because the caller has to ensure to not use any references left.

Source

pub fn free(&self) -> usize

returns the amount of free memory

Trait Implementations§

Source§

impl Debug for EnarxAllocator

Source§

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

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

impl FrameAllocator<Size1GiB> for EnarxAllocator

Source§

fn allocate_frame(&mut self) -> Option<PhysFrame<Size1GiB>>

Allocate a frame of the appropriate size and return it if possible.
Source§

impl FrameAllocator<Size2MiB> for EnarxAllocator

Source§

fn allocate_frame(&mut self) -> Option<PhysFrame<Size2MiB>>

Allocate a frame of the appropriate size and return it if possible.
Source§

impl FrameAllocator<Size4KiB> for EnarxAllocator

Source§

fn allocate_frame(&mut self) -> Option<PhysFrame<Size4KiB>>

Allocate a frame of the appropriate size and return it if possible.

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

Source§

type Output = T

Should always be Self
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.