[−][src]Struct sunrise_kernel::paging::kernel_memory::KernelMemory
A struct that acts on KernelLand and RecursiveTablesLand.
Always modifies the ACTIVE_PAGE_TABLES. When switching to a new set of page tables in a process switch, the modifications will be copied to the set just before switching to it.
Because of this mechanism we do not permit modifying KernelLand in other tables than the currently active ones.
Fields
tables: ActiveHierarchy
The currently active page tables.
Implementations
impl KernelMemory
[src]
pub fn find_virtual_space_aligned(
&mut self,
length: usize,
alignment: usize
) -> Result<VirtualAddress, KernelError>
[src]
&mut self,
length: usize,
alignment: usize
) -> Result<VirtualAddress, KernelError>
Finds a hole in the virtual space at least 'length' long, and respecting alignment.
pub fn find_virtual_space(
&mut self,
length: usize
) -> Result<VirtualAddress, KernelError>
[src]
&mut self,
length: usize
) -> Result<VirtualAddress, KernelError>
Finds a hole in the virtual space at least 'length' long.
pub fn map_phys_region_to(
&mut self,
phys: PhysicalMemRegion,
address: VirtualAddress,
flags: MappingAccessRights
)
[src]
&mut self,
phys: PhysicalMemRegion,
address: VirtualAddress,
flags: MappingAccessRights
)
Maps a single physical regions to a given virtual address.
Panics
Panics if virtual region is not in KernelLand.
pub fn map_phys_region(
&mut self,
phys: PhysicalMemRegion,
flags: MappingAccessRights
) -> VirtualAddress
[src]
&mut self,
phys: PhysicalMemRegion,
flags: MappingAccessRights
) -> VirtualAddress
pub(super) unsafe fn map_phys_regions(
&mut self,
phys: &[PhysicalMemRegion],
flags: MappingAccessRights
) -> VirtualAddress
[src]
&mut self,
phys: &[PhysicalMemRegion],
flags: MappingAccessRights
) -> VirtualAddress
Maps a list of physical region anywhere.
Unsafe
This function cannot ensure that the frames won't be dropped while still mapped.
Panics
Panics if encounters virtual space exhaustion.
pub(super) unsafe fn map_frame_iterator_to<I>(
&mut self,
iterator: I,
address: VirtualAddress,
flags: MappingAccessRights
) where
I: Iterator<Item = PhysicalAddress> + Clone,
[src]
&mut self,
iterator: I,
address: VirtualAddress,
flags: MappingAccessRights
) where
I: Iterator<Item = PhysicalAddress> + Clone,
Maps a list of physical region yielded by an iterator.
Unsafe
This function cannot ensure that the frames won't be dropped while still mapped.
Panics
Panics if virtual region is not in KernelLand. Panics if encounters virtual space exhaustion.
pub(super) unsafe fn map_frame_iterator<I>(
&mut self,
iterator: I,
flags: MappingAccessRights
) -> VirtualAddress where
I: Iterator<Item = PhysicalAddress> + Clone,
[src]
&mut self,
iterator: I,
flags: MappingAccessRights
) -> VirtualAddress where
I: Iterator<Item = PhysicalAddress> + Clone,
Maps a list of physical region yielded by the iterator. Chooses the address.
Unsafe
This function cannot ensure that the frames won't be dropped while still mapped.
Panics
Panics if encounters virtual space exhaustion.
pub fn get_page(&mut self) -> VirtualAddress
[src]
Allocates and maps a single page, choosing a spot in VMEM for it.
Panics
Panics if encounters physical memory exhaustion. Panics if encounters virtual space exhaustion.
pub fn map_allocate_to(
&mut self,
va: VirtualAddress,
length: usize,
flags: MappingAccessRights
)
[src]
&mut self,
va: VirtualAddress,
length: usize,
flags: MappingAccessRights
)
Allocates non-contiguous frames, and map them at the given address.
Panics
Panics if encounters physical memory exhaustion.
Panics if encounters virtual space exhaustion.
Panics if destination was already mapped.
Panics if length
is not a multiple of PAGE_SIZE.
pub fn get_pages(&mut self, length: usize) -> VirtualAddress
[src]
Allocates and maps the given length, chosing a spot in VMEM for it.
Panics
Panics if encounters physical memory exhaustion.
Panics if encounters virtual space exhaustion.
Panics if length
is not a multiple of PAGE_SIZE.
pub fn guard(&mut self, address: VirtualAddress, length: usize)
[src]
Guards a range of addresses.
Panics
Panics if destination was already mapped.
Panics if length
is not a multiple of PAGE_SIZE.
pub fn mapping_state(
&mut self,
addr: VirtualAddress
) -> PageState<PhysicalAddress>
[src]
&mut self,
addr: VirtualAddress
) -> PageState<PhysicalAddress>
pub fn unmap(&mut self, address: VirtualAddress, length: usize)
[src]
Deletes a mapping in the page tables. This functions assumes the frames were not tracked anywhere else, and drops them.
Panics
Panics if encounters any entry that was not mapped.
Panics if virtual region is not in KernelLand.
Panics if length
is not page aligned.
pub fn unmap_no_dealloc(&mut self, address: VirtualAddress, length: usize)
[src]
Deletes a mapping in the page tables, but does not free the underlying physical memory.
Panics
Panics if encounters any entry that was not mapped.
Panics if virtual region is not in KernelLand.
Panics if length
is not page aligned.
pub fn reserve_kernel_land_frames(&mut self)
[src]
Marks all frames mapped in KernelLand as reserve This is used at startup to reserve frames mapped by the bootstrap
Panic
Panics if it tries to overwrite an existing reservation
pub(super) fn get_hierarchy(
&mut self
) -> &mut ActiveHierarchy
[src]
&mut self
) -> &mut ActiveHierarchy
Safe access to the active page tables.
pub fn dump_kernelland_state(&mut self)
[src]
Prints the state of the KernelLand by parsing the page tables. Used for debugging purposes.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for KernelMemory
impl Send for KernelMemory
impl Sync for KernelMemory
impl Unpin for KernelMemory
impl UnwindSafe for KernelMemory
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,