[][src]Struct sunrise_kernel::paging::kernel_memory::KernelMemory

pub struct KernelMemory {
    tables: ActiveHierarchy,
}

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]

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]

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]

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]

Maps a single physical region anywhere.

Panics

Panics if encounters virtual space exhaustion.

pub(super) unsafe fn map_phys_regions(
    &mut self,
    phys: &[PhysicalMemRegion],
    flags: MappingAccessRights
) -> VirtualAddress
[src]

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]

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]

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]

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]

Reads the state of the mapping at a given address.

Panics

If address is not in KernelLand.

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]

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

impl Debug for KernelMemory[src]

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.