Struct x86_64::structures::paging::mapper::RecursivePageTable [−][src]
pub struct RecursivePageTable<'a> { /* fields omitted */ }
Expand description
A recursive page table is a last level page table with an entry mapped to the table itself.
This recursive mapping allows accessing all page tables in the hierarchy:
- To access the level 4 page table, we “loop“ (i.e. follow the recursively mapped entry) four times.
- To access a level 3 page table, we “loop” three times and then use the level 4 index.
- To access a level 2 page table, we “loop” two times, then use the level 4 index, then the level 3 index.
- To access a level 1 page table, we “loop” once, then use the level 4 index, then the level 3 index, then the level 2 index.
This struct implements the Mapper
trait.
The page table flags PRESENT
and WRITABLE
are always set for higher level page table
entries, even if not specified, because the design of the recursive page table requires it.
Implementations
Creates a new RecursivePageTable from the passed level 4 PageTable.
The page table must be recursively mapped, that means:
- The page table must have one recursive entry, i.e. an entry that points to the table
itself.
- The reference must use that “loop”, i.e. be of the form
0o_xxx_xxx_xxx_xxx_0000
wherexxx
is the recursive entry.
- The reference must use that “loop”, i.e. be of the form
- The page table must be active, i.e. the CR3 register must contain its physical address.
Otherwise Err(())
is returned.
pub unsafe fn new_unchecked(
table: &'a mut PageTable,
recursive_index: PageTableIndex
) -> Self
pub unsafe fn new_unchecked(
table: &'a mut PageTable,
recursive_index: PageTableIndex
) -> Self
Creates a new RecursivePageTable without performing any checks.
Safety
The given page table must be a level 4 page table that is active in the
CPU (i.e. loaded in the CR3 register). The recursive_index
parameter
must be the index of the recursively mapped entry of that page table.
Returns a mutable reference to the wrapped level 4 PageTable
instance.
Trait Implementations
unsafe fn map_to_with_table_flags<A: ?Sized>(
&mut self,
page: Page<Size1GiB>,
frame: PhysFrame<Size1GiB>,
flags: PageTableFlags,
parent_table_flags: PageTableFlags,
allocator: &mut A
) -> Result<MapperFlush<Size1GiB>, MapToError<Size1GiB>> where
A: FrameAllocator<Size4KiB>,
unsafe fn map_to_with_table_flags<A: ?Sized>(
&mut self,
page: Page<Size1GiB>,
frame: PhysFrame<Size1GiB>,
flags: PageTableFlags,
parent_table_flags: PageTableFlags,
allocator: &mut A
) -> Result<MapperFlush<Size1GiB>, MapToError<Size1GiB>> where
A: FrameAllocator<Size4KiB>,
Creates a new mapping in the page table. Read more
fn unmap(
&mut self,
page: Page<Size1GiB>
) -> Result<(PhysFrame<Size1GiB>, MapperFlush<Size1GiB>), UnmapError>
fn unmap(
&mut self,
page: Page<Size1GiB>
) -> Result<(PhysFrame<Size1GiB>, MapperFlush<Size1GiB>), UnmapError>
Removes a mapping from the page table and returns the frame that used to be mapped. Read more
unsafe fn update_flags(
&mut self,
page: Page<Size1GiB>,
flags: PageTableFlags
) -> Result<MapperFlush<Size1GiB>, FlagUpdateError>
unsafe fn update_flags(
&mut self,
page: Page<Size1GiB>,
flags: PageTableFlags
) -> Result<MapperFlush<Size1GiB>, FlagUpdateError>
Updates the flags of an existing mapping. Read more
unsafe fn set_flags_p4_entry(
&mut self,
page: Page<Size1GiB>,
flags: PageTableFlags
) -> Result<MapperFlushAll, FlagUpdateError>
unsafe fn set_flags_p4_entry(
&mut self,
page: Page<Size1GiB>,
flags: PageTableFlags
) -> Result<MapperFlushAll, FlagUpdateError>
Set the flags of an existing page level 4 table entry Read more
unsafe fn set_flags_p3_entry(
&mut self,
_page: Page<Size1GiB>,
_flags: PageTableFlags
) -> Result<MapperFlushAll, FlagUpdateError>
unsafe fn set_flags_p3_entry(
&mut self,
_page: Page<Size1GiB>,
_flags: PageTableFlags
) -> Result<MapperFlushAll, FlagUpdateError>
Set the flags of an existing page table level 3 entry Read more
unsafe fn set_flags_p2_entry(
&mut self,
_page: Page<Size1GiB>,
_flags: PageTableFlags
) -> Result<MapperFlushAll, FlagUpdateError>
unsafe fn set_flags_p2_entry(
&mut self,
_page: Page<Size1GiB>,
_flags: PageTableFlags
) -> Result<MapperFlushAll, FlagUpdateError>
Set the flags of an existing page table level 2 entry Read more
Return the frame that the specified page is mapped to. Read more
unsafe fn map_to<A: ?Sized>(
&mut self,
page: Page<S>,
frame: PhysFrame<S>,
flags: PageTableFlags,
frame_allocator: &mut A
) -> Result<MapperFlush<S>, MapToError<S>> where
Self: Sized,
A: FrameAllocator<Size4KiB>,
unsafe fn map_to<A: ?Sized>(
&mut self,
page: Page<S>,
frame: PhysFrame<S>,
flags: PageTableFlags,
frame_allocator: &mut A
) -> Result<MapperFlush<S>, MapToError<S>> where
Self: Sized,
A: FrameAllocator<Size4KiB>,
Creates a new mapping in the page table. Read more
unsafe fn identity_map<A: ?Sized>(
&mut self,
frame: PhysFrame<S>,
flags: PageTableFlags,
frame_allocator: &mut A
) -> Result<MapperFlush<S>, MapToError<S>> where
Self: Sized,
A: FrameAllocator<Size4KiB>,
S: PageSize,
Self: Mapper<S>,
unsafe fn identity_map<A: ?Sized>(
&mut self,
frame: PhysFrame<S>,
flags: PageTableFlags,
frame_allocator: &mut A
) -> Result<MapperFlush<S>, MapToError<S>> where
Self: Sized,
A: FrameAllocator<Size4KiB>,
S: PageSize,
Self: Mapper<S>,
Maps the given frame to the virtual page with the same address. Read more
unsafe fn map_to_with_table_flags<A: ?Sized>(
&mut self,
page: Page<Size2MiB>,
frame: PhysFrame<Size2MiB>,
flags: PageTableFlags,
parent_table_flags: PageTableFlags,
allocator: &mut A
) -> Result<MapperFlush<Size2MiB>, MapToError<Size2MiB>> where
A: FrameAllocator<Size4KiB>,
unsafe fn map_to_with_table_flags<A: ?Sized>(
&mut self,
page: Page<Size2MiB>,
frame: PhysFrame<Size2MiB>,
flags: PageTableFlags,
parent_table_flags: PageTableFlags,
allocator: &mut A
) -> Result<MapperFlush<Size2MiB>, MapToError<Size2MiB>> where
A: FrameAllocator<Size4KiB>,
Creates a new mapping in the page table. Read more
fn unmap(
&mut self,
page: Page<Size2MiB>
) -> Result<(PhysFrame<Size2MiB>, MapperFlush<Size2MiB>), UnmapError>
fn unmap(
&mut self,
page: Page<Size2MiB>
) -> Result<(PhysFrame<Size2MiB>, MapperFlush<Size2MiB>), UnmapError>
Removes a mapping from the page table and returns the frame that used to be mapped. Read more
unsafe fn update_flags(
&mut self,
page: Page<Size2MiB>,
flags: PageTableFlags
) -> Result<MapperFlush<Size2MiB>, FlagUpdateError>
unsafe fn update_flags(
&mut self,
page: Page<Size2MiB>,
flags: PageTableFlags
) -> Result<MapperFlush<Size2MiB>, FlagUpdateError>
Updates the flags of an existing mapping. Read more
unsafe fn set_flags_p4_entry(
&mut self,
page: Page<Size2MiB>,
flags: PageTableFlags
) -> Result<MapperFlushAll, FlagUpdateError>
unsafe fn set_flags_p4_entry(
&mut self,
page: Page<Size2MiB>,
flags: PageTableFlags
) -> Result<MapperFlushAll, FlagUpdateError>
Set the flags of an existing page level 4 table entry Read more
unsafe fn set_flags_p3_entry(
&mut self,
page: Page<Size2MiB>,
flags: PageTableFlags
) -> Result<MapperFlushAll, FlagUpdateError>
unsafe fn set_flags_p3_entry(
&mut self,
page: Page<Size2MiB>,
flags: PageTableFlags
) -> Result<MapperFlushAll, FlagUpdateError>
Set the flags of an existing page table level 3 entry Read more
unsafe fn set_flags_p2_entry(
&mut self,
_page: Page<Size2MiB>,
_flags: PageTableFlags
) -> Result<MapperFlushAll, FlagUpdateError>
unsafe fn set_flags_p2_entry(
&mut self,
_page: Page<Size2MiB>,
_flags: PageTableFlags
) -> Result<MapperFlushAll, FlagUpdateError>
Set the flags of an existing page table level 2 entry Read more
Return the frame that the specified page is mapped to. Read more
unsafe fn map_to<A: ?Sized>(
&mut self,
page: Page<S>,
frame: PhysFrame<S>,
flags: PageTableFlags,
frame_allocator: &mut A
) -> Result<MapperFlush<S>, MapToError<S>> where
Self: Sized,
A: FrameAllocator<Size4KiB>,
unsafe fn map_to<A: ?Sized>(
&mut self,
page: Page<S>,
frame: PhysFrame<S>,
flags: PageTableFlags,
frame_allocator: &mut A
) -> Result<MapperFlush<S>, MapToError<S>> where
Self: Sized,
A: FrameAllocator<Size4KiB>,
Creates a new mapping in the page table. Read more
unsafe fn identity_map<A: ?Sized>(
&mut self,
frame: PhysFrame<S>,
flags: PageTableFlags,
frame_allocator: &mut A
) -> Result<MapperFlush<S>, MapToError<S>> where
Self: Sized,
A: FrameAllocator<Size4KiB>,
S: PageSize,
Self: Mapper<S>,
unsafe fn identity_map<A: ?Sized>(
&mut self,
frame: PhysFrame<S>,
flags: PageTableFlags,
frame_allocator: &mut A
) -> Result<MapperFlush<S>, MapToError<S>> where
Self: Sized,
A: FrameAllocator<Size4KiB>,
S: PageSize,
Self: Mapper<S>,
Maps the given frame to the virtual page with the same address. Read more
unsafe fn map_to_with_table_flags<A: ?Sized>(
&mut self,
page: Page<Size4KiB>,
frame: PhysFrame<Size4KiB>,
flags: PageTableFlags,
parent_table_flags: PageTableFlags,
allocator: &mut A
) -> Result<MapperFlush<Size4KiB>, MapToError<Size4KiB>> where
A: FrameAllocator<Size4KiB>,
unsafe fn map_to_with_table_flags<A: ?Sized>(
&mut self,
page: Page<Size4KiB>,
frame: PhysFrame<Size4KiB>,
flags: PageTableFlags,
parent_table_flags: PageTableFlags,
allocator: &mut A
) -> Result<MapperFlush<Size4KiB>, MapToError<Size4KiB>> where
A: FrameAllocator<Size4KiB>,
Creates a new mapping in the page table. Read more
fn unmap(
&mut self,
page: Page<Size4KiB>
) -> Result<(PhysFrame<Size4KiB>, MapperFlush<Size4KiB>), UnmapError>
fn unmap(
&mut self,
page: Page<Size4KiB>
) -> Result<(PhysFrame<Size4KiB>, MapperFlush<Size4KiB>), UnmapError>
Removes a mapping from the page table and returns the frame that used to be mapped. Read more
unsafe fn update_flags(
&mut self,
page: Page<Size4KiB>,
flags: PageTableFlags
) -> Result<MapperFlush<Size4KiB>, FlagUpdateError>
unsafe fn update_flags(
&mut self,
page: Page<Size4KiB>,
flags: PageTableFlags
) -> Result<MapperFlush<Size4KiB>, FlagUpdateError>
Updates the flags of an existing mapping. Read more
unsafe fn set_flags_p4_entry(
&mut self,
page: Page<Size4KiB>,
flags: PageTableFlags
) -> Result<MapperFlushAll, FlagUpdateError>
unsafe fn set_flags_p4_entry(
&mut self,
page: Page<Size4KiB>,
flags: PageTableFlags
) -> Result<MapperFlushAll, FlagUpdateError>
Set the flags of an existing page level 4 table entry Read more
unsafe fn set_flags_p3_entry(
&mut self,
page: Page<Size4KiB>,
flags: PageTableFlags
) -> Result<MapperFlushAll, FlagUpdateError>
unsafe fn set_flags_p3_entry(
&mut self,
page: Page<Size4KiB>,
flags: PageTableFlags
) -> Result<MapperFlushAll, FlagUpdateError>
Set the flags of an existing page table level 3 entry Read more
unsafe fn set_flags_p2_entry(
&mut self,
page: Page<Size4KiB>,
flags: PageTableFlags
) -> Result<MapperFlushAll, FlagUpdateError>
unsafe fn set_flags_p2_entry(
&mut self,
page: Page<Size4KiB>,
flags: PageTableFlags
) -> Result<MapperFlushAll, FlagUpdateError>
Set the flags of an existing page table level 2 entry Read more
Return the frame that the specified page is mapped to. Read more
unsafe fn map_to<A: ?Sized>(
&mut self,
page: Page<S>,
frame: PhysFrame<S>,
flags: PageTableFlags,
frame_allocator: &mut A
) -> Result<MapperFlush<S>, MapToError<S>> where
Self: Sized,
A: FrameAllocator<Size4KiB>,
unsafe fn map_to<A: ?Sized>(
&mut self,
page: Page<S>,
frame: PhysFrame<S>,
flags: PageTableFlags,
frame_allocator: &mut A
) -> Result<MapperFlush<S>, MapToError<S>> where
Self: Sized,
A: FrameAllocator<Size4KiB>,
Creates a new mapping in the page table. Read more
unsafe fn identity_map<A: ?Sized>(
&mut self,
frame: PhysFrame<S>,
flags: PageTableFlags,
frame_allocator: &mut A
) -> Result<MapperFlush<S>, MapToError<S>> where
Self: Sized,
A: FrameAllocator<Size4KiB>,
S: PageSize,
Self: Mapper<S>,
unsafe fn identity_map<A: ?Sized>(
&mut self,
frame: PhysFrame<S>,
flags: PageTableFlags,
frame_allocator: &mut A
) -> Result<MapperFlush<S>, MapToError<S>> where
Self: Sized,
A: FrameAllocator<Size4KiB>,
S: PageSize,
Self: Mapper<S>,
Maps the given frame to the virtual page with the same address. Read more
Return the frame that the given virtual address is mapped to and the offset within that frame. Read more
Auto Trait Implementations
impl<'a> Send for RecursivePageTable<'a>
impl<'a> Sync for RecursivePageTable<'a>
impl<'a> Unpin for RecursivePageTable<'a>