Struct OffsetPageTable
pub struct OffsetPageTable<'a> {
inner: MappedPageTable<'a, PhysOffset>,
}Expand description
A Mapper implementation that requires that the complete physical memory is mapped at some offset in the virtual address space.
Fields§
§inner: MappedPageTable<'a, PhysOffset>Implementations§
§impl<'a> OffsetPageTable<'a>
impl<'a> OffsetPageTable<'a>
pub unsafe fn new(
level_4_table: &'a mut PageTable,
phys_offset: VirtAddr,
) -> OffsetPageTable<'a>
pub unsafe fn new( level_4_table: &'a mut PageTable, phys_offset: VirtAddr, ) -> OffsetPageTable<'a>
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.
pub fn level_4_table(&self) -> &PageTable
pub fn level_4_table(&self) -> &PageTable
Returns an immutable reference to the wrapped level 4 PageTable instance.
pub fn level_4_table_mut(&mut self) -> &mut PageTable
pub fn level_4_table_mut(&mut self) -> &mut PageTable
Returns a mutable reference to the wrapped level 4 PageTable instance.
pub fn phys_offset(&self) -> VirtAddr
pub fn phys_offset(&self) -> VirtAddr
Returns the offset used for converting virtual to physical addresses.
Trait Implementations§
§impl CleanUp for OffsetPageTable<'_>
impl CleanUp for OffsetPageTable<'_>
§unsafe 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>,
§unsafe 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>,
§impl<'a> Debug for OffsetPageTable<'a>
impl<'a> Debug for OffsetPageTable<'a>
§impl Mapper<Size1GiB> for OffsetPageTable<'_>
impl Mapper<Size1GiB> for OffsetPageTable<'_>
§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>>
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>>
§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>
§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>
§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>
§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>
§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>
§fn translate_page(
&self,
page: Page<Size1GiB>,
) -> Result<PhysFrame<Size1GiB>, TranslateError>
fn translate_page( &self, page: Page<Size1GiB>, ) -> Result<PhysFrame<Size1GiB>, TranslateError>
§unsafe fn map_to<A>(
&mut self,
page: Page<S>,
frame: PhysFrame<S>,
flags: PageTableFlags,
frame_allocator: &mut A,
) -> Result<MapperFlush<S>, MapToError<S>>
unsafe fn map_to<A>( &mut self, page: Page<S>, frame: PhysFrame<S>, flags: PageTableFlags, frame_allocator: &mut A, ) -> Result<MapperFlush<S>, MapToError<S>>
§unsafe fn identity_map<A>(
&mut self,
frame: PhysFrame<S>,
flags: PageTableFlags,
frame_allocator: &mut A,
) -> Result<MapperFlush<S>, MapToError<S>>
unsafe fn identity_map<A>( &mut self, frame: PhysFrame<S>, flags: PageTableFlags, frame_allocator: &mut A, ) -> Result<MapperFlush<S>, MapToError<S>>
§impl Mapper<Size2MiB> for OffsetPageTable<'_>
impl Mapper<Size2MiB> for OffsetPageTable<'_>
§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>>
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>>
§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>
§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>
§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>
§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>
§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>
§fn translate_page(
&self,
page: Page<Size2MiB>,
) -> Result<PhysFrame<Size2MiB>, TranslateError>
fn translate_page( &self, page: Page<Size2MiB>, ) -> Result<PhysFrame<Size2MiB>, TranslateError>
§unsafe fn map_to<A>(
&mut self,
page: Page<S>,
frame: PhysFrame<S>,
flags: PageTableFlags,
frame_allocator: &mut A,
) -> Result<MapperFlush<S>, MapToError<S>>
unsafe fn map_to<A>( &mut self, page: Page<S>, frame: PhysFrame<S>, flags: PageTableFlags, frame_allocator: &mut A, ) -> Result<MapperFlush<S>, MapToError<S>>
§unsafe fn identity_map<A>(
&mut self,
frame: PhysFrame<S>,
flags: PageTableFlags,
frame_allocator: &mut A,
) -> Result<MapperFlush<S>, MapToError<S>>
unsafe fn identity_map<A>( &mut self, frame: PhysFrame<S>, flags: PageTableFlags, frame_allocator: &mut A, ) -> Result<MapperFlush<S>, MapToError<S>>
§impl Mapper<Size4KiB> for OffsetPageTable<'_>
impl Mapper<Size4KiB> for OffsetPageTable<'_>
§unsafe fn map_to_with_table_flags<A>(
&mut self,
page: Page,
frame: PhysFrame,
flags: PageTableFlags,
parent_table_flags: PageTableFlags,
allocator: &mut A,
) -> Result<MapperFlush<Size4KiB>, MapToError<Size4KiB>>
unsafe fn map_to_with_table_flags<A>( &mut self, page: Page, frame: PhysFrame, flags: PageTableFlags, parent_table_flags: PageTableFlags, allocator: &mut A, ) -> Result<MapperFlush<Size4KiB>, MapToError<Size4KiB>>
§fn unmap(
&mut self,
page: Page,
) -> Result<(PhysFrame, MapperFlush<Size4KiB>), UnmapError>
fn unmap( &mut self, page: Page, ) -> Result<(PhysFrame, MapperFlush<Size4KiB>), UnmapError>
§unsafe fn update_flags(
&mut self,
page: Page,
flags: PageTableFlags,
) -> Result<MapperFlush<Size4KiB>, FlagUpdateError>
unsafe fn update_flags( &mut self, page: Page, flags: PageTableFlags, ) -> Result<MapperFlush<Size4KiB>, FlagUpdateError>
§unsafe fn set_flags_p4_entry(
&mut self,
page: Page,
flags: PageTableFlags,
) -> Result<MapperFlushAll, FlagUpdateError>
unsafe fn set_flags_p4_entry( &mut self, page: Page, flags: PageTableFlags, ) -> Result<MapperFlushAll, FlagUpdateError>
§unsafe fn set_flags_p3_entry(
&mut self,
page: Page,
flags: PageTableFlags,
) -> Result<MapperFlushAll, FlagUpdateError>
unsafe fn set_flags_p3_entry( &mut self, page: Page, flags: PageTableFlags, ) -> Result<MapperFlushAll, FlagUpdateError>
§unsafe fn set_flags_p2_entry(
&mut self,
page: Page,
flags: PageTableFlags,
) -> Result<MapperFlushAll, FlagUpdateError>
unsafe fn set_flags_p2_entry( &mut self, page: Page, flags: PageTableFlags, ) -> Result<MapperFlushAll, FlagUpdateError>
§fn translate_page(&self, page: Page) -> Result<PhysFrame, TranslateError>
fn translate_page(&self, page: Page) -> Result<PhysFrame, TranslateError>
§unsafe fn map_to<A>(
&mut self,
page: Page<S>,
frame: PhysFrame<S>,
flags: PageTableFlags,
frame_allocator: &mut A,
) -> Result<MapperFlush<S>, MapToError<S>>
unsafe fn map_to<A>( &mut self, page: Page<S>, frame: PhysFrame<S>, flags: PageTableFlags, frame_allocator: &mut A, ) -> Result<MapperFlush<S>, MapToError<S>>
§unsafe fn identity_map<A>(
&mut self,
frame: PhysFrame<S>,
flags: PageTableFlags,
frame_allocator: &mut A,
) -> Result<MapperFlush<S>, MapToError<S>>
unsafe fn identity_map<A>( &mut self, frame: PhysFrame<S>, flags: PageTableFlags, frame_allocator: &mut A, ) -> Result<MapperFlush<S>, MapToError<S>>
§impl Translate for OffsetPageTable<'_>
impl Translate for OffsetPageTable<'_>
§fn translate(&self, addr: VirtAddr) -> TranslateResult
fn translate(&self, addr: VirtAddr) -> TranslateResult
Auto Trait Implementations§
impl<'a> !UnwindSafe for OffsetPageTable<'a>
impl<'a> Freeze for OffsetPageTable<'a>
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> UnsafeUnpin for OffsetPageTable<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more