[][src]Trait x86_64::structures::paging::mapper::Mapper

pub trait Mapper<S: PageSize> {
    unsafe fn map_to<A>(
        &mut self,
        page: Page<S>,
        frame: PhysFrame<S>,
        flags: PageTableFlags,
        frame_allocator: &mut A
    ) -> Result<MapperFlush<S>, MapToError>
    where
        A: FrameAllocator<Size4KiB>
;
fn unmap(
        &mut self,
        page: Page<S>
    ) -> Result<(PhysFrame<S>, MapperFlush<S>), UnmapError>;
fn update_flags(
        &mut self,
        page: Page<S>,
        flags: PageTableFlags
    ) -> Result<MapperFlush<S>, FlagUpdateError>;
fn translate_page(
        &self,
        page: Page<S>
    ) -> Result<PhysFrame<S>, TranslateError>; unsafe fn identity_map<A>(
        &mut self,
        frame: PhysFrame<S>,
        flags: PageTableFlags,
        frame_allocator: &mut A
    ) -> Result<MapperFlush<S>, MapToError>
    where
        A: FrameAllocator<Size4KiB>,
        S: PageSize,
        Self: Mapper<S>
, { ... } }

A trait for common page table operations on pages of size S.

Required methods

unsafe fn map_to<A>(
    &mut self,
    page: Page<S>,
    frame: PhysFrame<S>,
    flags: PageTableFlags,
    frame_allocator: &mut A
) -> Result<MapperFlush<S>, MapToError> where
    A: FrameAllocator<Size4KiB>, 

Creates a new mapping in the page table.

This function might need additional physical frames to create new page tables. These frames are allocated from the allocator argument. At most three frames are required.

This function is unsafe because the caller must guarantee the following:

  • The passed frame must be unused, i.e. not used for any other mappings.
  • The passed frame_allocator must only yield unused frames.

fn unmap(
    &mut self,
    page: Page<S>
) -> Result<(PhysFrame<S>, MapperFlush<S>), UnmapError>

Removes a mapping from the page table and returns the frame that used to be mapped.

Note that no page tables or pages are deallocated.

fn update_flags(
    &mut self,
    page: Page<S>,
    flags: PageTableFlags
) -> Result<MapperFlush<S>, FlagUpdateError>

Updates the flags of an existing mapping.

fn translate_page(&self, page: Page<S>) -> Result<PhysFrame<S>, TranslateError>

Return the frame that the specified page is mapped to.

This function assumes that the page is mapped to a frame of size S and returns an error otherwise.

Loading content...

Provided methods

unsafe fn identity_map<A>(
    &mut self,
    frame: PhysFrame<S>,
    flags: PageTableFlags,
    frame_allocator: &mut A
) -> Result<MapperFlush<S>, MapToError> where
    A: FrameAllocator<Size4KiB>,
    S: PageSize,
    Self: Mapper<S>, 

Maps the given frame to the virtual page with the same address.

This function is unsafe because the caller must guarantee the following:

  • The passed frame must be unused, i.e. not used for any other mappings.
  • The passed frame_allocator must only yield unused frames.
Loading content...

Implementors

impl<'a> Mapper<Size1GiB> for RecursivePageTable<'a>[src]

unsafe fn identity_map<A>(
    &mut self,
    frame: PhysFrame<S>,
    flags: PageTableFlags,
    frame_allocator: &mut A
) -> Result<MapperFlush<S>, MapToError> where
    A: FrameAllocator<Size4KiB>,
    S: PageSize,
    Self: Mapper<S>, 
[src]

impl<'a> Mapper<Size2MiB> for RecursivePageTable<'a>[src]

unsafe fn identity_map<A>(
    &mut self,
    frame: PhysFrame<S>,
    flags: PageTableFlags,
    frame_allocator: &mut A
) -> Result<MapperFlush<S>, MapToError> where
    A: FrameAllocator<Size4KiB>,
    S: PageSize,
    Self: Mapper<S>, 
[src]

impl<'a> Mapper<Size4KiB> for RecursivePageTable<'a>[src]

unsafe fn identity_map<A>(
    &mut self,
    frame: PhysFrame<S>,
    flags: PageTableFlags,
    frame_allocator: &mut A
) -> Result<MapperFlush<S>, MapToError> where
    A: FrameAllocator<Size4KiB>,
    S: PageSize,
    Self: Mapper<S>, 
[src]

impl<'a, PhysToVirt> Mapper<Size1GiB> for MappedPageTable<'a, PhysToVirt> where
    PhysToVirt: Fn(PhysFrame) -> *mut PageTable
[src]

unsafe fn identity_map<A>(
    &mut self,
    frame: PhysFrame<S>,
    flags: PageTableFlags,
    frame_allocator: &mut A
) -> Result<MapperFlush<S>, MapToError> where
    A: FrameAllocator<Size4KiB>,
    S: PageSize,
    Self: Mapper<S>, 
[src]

impl<'a, PhysToVirt> Mapper<Size2MiB> for MappedPageTable<'a, PhysToVirt> where
    PhysToVirt: Fn(PhysFrame) -> *mut PageTable
[src]

unsafe fn identity_map<A>(
    &mut self,
    frame: PhysFrame<S>,
    flags: PageTableFlags,
    frame_allocator: &mut A
) -> Result<MapperFlush<S>, MapToError> where
    A: FrameAllocator<Size4KiB>,
    S: PageSize,
    Self: Mapper<S>, 
[src]

impl<'a, PhysToVirt> Mapper<Size4KiB> for MappedPageTable<'a, PhysToVirt> where
    PhysToVirt: Fn(PhysFrame) -> *mut PageTable
[src]

unsafe fn identity_map<A>(
    &mut self,
    frame: PhysFrame<S>,
    flags: PageTableFlags,
    frame_allocator: &mut A
) -> Result<MapperFlush<S>, MapToError> where
    A: FrameAllocator<Size4KiB>,
    S: PageSize,
    Self: Mapper<S>, 
[src]

Loading content...