Struct x86_64::structures::paging::mapper::OffsetPageTable
source · [−]pub struct OffsetPageTable<'a> { /* private fields */ }
Expand description
A Mapper implementation that requires that the complete physically memory is mapped at some offset in the virtual address space.
Implementations
sourceimpl<'a> OffsetPageTable<'a>
impl<'a> OffsetPageTable<'a>
sourcepub unsafe fn new(
level_4_table: &'a mut PageTable,
phys_offset: VirtAddr
) -> Self
pub unsafe fn new(
level_4_table: &'a mut PageTable,
phys_offset: VirtAddr
) -> Self
Creates a new OffsetPageTable
that uses the given offset for converting virtual
to physical addresses.
The complete physical memory must be mapped in the virtual address space starting at
address phys_offset
. This means that for example physical address 0x5000
can be
accessed through virtual address phys_offset + 0x5000
. This mapping is required because
the mapper needs to access page tables, which are not mapped into the virtual address
space by default.
Safety
This function is unsafe because the caller must guarantee that the passed phys_offset
is correct. Also, the passed level_4_table
must point to the level 4 page table
of a valid page table hierarchy. Otherwise this function might break memory safety, e.g.
by writing to an illegal memory location.
sourcepub fn level_4_table(&mut self) -> &mut PageTable
pub fn level_4_table(&mut self) -> &mut PageTable
Returns a mutable reference to the wrapped level 4 PageTable
instance.
Trait Implementations
sourceimpl<'a> CleanUp for OffsetPageTable<'a>
impl<'a> CleanUp for OffsetPageTable<'a>
sourceunsafe fn clean_up<D>(&mut self, frame_deallocator: &mut D) where
D: FrameDeallocator<Size4KiB>,
unsafe fn clean_up<D>(&mut self, frame_deallocator: &mut D) where
D: FrameDeallocator<Size4KiB>,
Remove all empty P1-P3 tables Read more
sourceunsafe fn clean_up_addr_range<D>(
&mut self,
range: PageRangeInclusive,
frame_deallocator: &mut D
) where
D: FrameDeallocator<Size4KiB>,
unsafe fn clean_up_addr_range<D>(
&mut self,
range: PageRangeInclusive,
frame_deallocator: &mut D
) where
D: FrameDeallocator<Size4KiB>,
Remove all empty P1-P3 tables in a certain range Read more
sourceimpl<'a> Debug for OffsetPageTable<'a>
impl<'a> Debug for OffsetPageTable<'a>
sourceimpl<'a> Mapper<Size1GiB> for OffsetPageTable<'a>
impl<'a> Mapper<Size1GiB> for OffsetPageTable<'a>
sourceunsafe fn map_to_with_table_flags<A>(
&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> + ?Sized,
unsafe fn map_to_with_table_flags<A>(
&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> + ?Sized,
Creates a new mapping in the page table. Read more
sourcefn 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
sourceunsafe 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
sourceunsafe 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
sourceunsafe 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
sourceunsafe 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
sourcefn translate_page(
&self,
page: Page<Size1GiB>
) -> Result<PhysFrame<Size1GiB>, TranslateError>
fn translate_page(
&self,
page: Page<Size1GiB>
) -> Result<PhysFrame<Size1GiB>, TranslateError>
Return the frame that the specified page is mapped to. Read more
sourceunsafe fn map_to<A>(
&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> + ?Sized,
unsafe fn map_to<A>(
&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> + ?Sized,
Creates a new mapping in the page table. Read more
sourceunsafe fn identity_map<A>(
&mut self,
frame: PhysFrame<S>,
flags: PageTableFlags,
frame_allocator: &mut A
) -> Result<MapperFlush<S>, MapToError<S>> where
Self: Sized,
A: FrameAllocator<Size4KiB> + ?Sized,
S: PageSize,
Self: Mapper<S>,
unsafe fn identity_map<A>(
&mut self,
frame: PhysFrame<S>,
flags: PageTableFlags,
frame_allocator: &mut A
) -> Result<MapperFlush<S>, MapToError<S>> where
Self: Sized,
A: FrameAllocator<Size4KiB> + ?Sized,
S: PageSize,
Self: Mapper<S>,
Maps the given frame to the virtual page with the same address. Read more
sourceimpl<'a> Mapper<Size2MiB> for OffsetPageTable<'a>
impl<'a> Mapper<Size2MiB> for OffsetPageTable<'a>
sourceunsafe fn map_to_with_table_flags<A>(
&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> + ?Sized,
unsafe fn map_to_with_table_flags<A>(
&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> + ?Sized,
Creates a new mapping in the page table. Read more
sourcefn 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
sourceunsafe 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
sourceunsafe 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
sourceunsafe 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
sourceunsafe 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
sourcefn translate_page(
&self,
page: Page<Size2MiB>
) -> Result<PhysFrame<Size2MiB>, TranslateError>
fn translate_page(
&self,
page: Page<Size2MiB>
) -> Result<PhysFrame<Size2MiB>, TranslateError>
Return the frame that the specified page is mapped to. Read more
sourceunsafe fn map_to<A>(
&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> + ?Sized,
unsafe fn map_to<A>(
&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> + ?Sized,
Creates a new mapping in the page table. Read more
sourceunsafe fn identity_map<A>(
&mut self,
frame: PhysFrame<S>,
flags: PageTableFlags,
frame_allocator: &mut A
) -> Result<MapperFlush<S>, MapToError<S>> where
Self: Sized,
A: FrameAllocator<Size4KiB> + ?Sized,
S: PageSize,
Self: Mapper<S>,
unsafe fn identity_map<A>(
&mut self,
frame: PhysFrame<S>,
flags: PageTableFlags,
frame_allocator: &mut A
) -> Result<MapperFlush<S>, MapToError<S>> where
Self: Sized,
A: FrameAllocator<Size4KiB> + ?Sized,
S: PageSize,
Self: Mapper<S>,
Maps the given frame to the virtual page with the same address. Read more
sourceimpl<'a> Mapper<Size4KiB> for OffsetPageTable<'a>
impl<'a> Mapper<Size4KiB> for OffsetPageTable<'a>
sourceunsafe fn map_to_with_table_flags<A>(
&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> + ?Sized,
unsafe fn map_to_with_table_flags<A>(
&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> + ?Sized,
Creates a new mapping in the page table. Read more
sourcefn 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
sourceunsafe 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
sourceunsafe 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
sourceunsafe 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
sourceunsafe 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
sourcefn translate_page(
&self,
page: Page<Size4KiB>
) -> Result<PhysFrame<Size4KiB>, TranslateError>
fn translate_page(
&self,
page: Page<Size4KiB>
) -> Result<PhysFrame<Size4KiB>, TranslateError>
Return the frame that the specified page is mapped to. Read more
sourceunsafe fn map_to<A>(
&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> + ?Sized,
unsafe fn map_to<A>(
&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> + ?Sized,
Creates a new mapping in the page table. Read more
sourceunsafe fn identity_map<A>(
&mut self,
frame: PhysFrame<S>,
flags: PageTableFlags,
frame_allocator: &mut A
) -> Result<MapperFlush<S>, MapToError<S>> where
Self: Sized,
A: FrameAllocator<Size4KiB> + ?Sized,
S: PageSize,
Self: Mapper<S>,
unsafe fn identity_map<A>(
&mut self,
frame: PhysFrame<S>,
flags: PageTableFlags,
frame_allocator: &mut A
) -> Result<MapperFlush<S>, MapToError<S>> where
Self: Sized,
A: FrameAllocator<Size4KiB> + ?Sized,
S: PageSize,
Self: Mapper<S>,
Maps the given frame to the virtual page with the same address. Read more
sourceimpl<'a> Translate for OffsetPageTable<'a>
impl<'a> Translate for OffsetPageTable<'a>
sourcefn translate(&self, addr: VirtAddr) -> TranslateResult
fn translate(&self, addr: VirtAddr) -> TranslateResult
Return the frame that the given virtual address is mapped to and the offset within that frame. Read more
Auto Trait Implementations
impl<'a> RefUnwindSafe for OffsetPageTable<'a>
impl<'a> Send for OffsetPageTable<'a>
impl<'a> Sync for OffsetPageTable<'a>
impl<'a> Unpin for OffsetPageTable<'a>
impl<'a> !UnwindSafe for OffsetPageTable<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more