MCPcopy Create free account
hub / github.com/bendudson/EuraliOS / special_memory_chunk

Function special_memory_chunk

kernel/src/process.rs:841–861  ·  view source on GitHub ↗

A memory chunk which maps a specific range of physical memory No frame allocation, so assumes that the physical memory is ok to use. # Arguments `thread` - The thread which will have the new chunk mapped `num_pages` - Number of 4k pages `start_physaddr` - Starting physical address. Must be page aligned

(
    thread: &Thread,
    num_pages: u64,
    start_physaddr: u64
)

Source from the content-addressed store, hash-verified

839/// Must be page aligned
840///
841pub fn special_memory_chunk(
842 thread: &Thread,
843 num_pages: u64,
844 start_physaddr: u64
845) -> Result<(VirtAddr, PhysAddr), usize> {
846 // Virtual address of the available page chunk
847 let start_virtaddr = match memory::find_available_page_chunk(
848 thread.page_table_physaddr) {
849 Some(value) => value,
850 None => return Err(syscalls::SYSCALL_ERROR_MEMORY)
851 };
852
853 match memory::create_physical_range_pages(
854 thread.page_table_physaddr,
855 start_virtaddr,
856 num_pages,
857 PhysAddr::new(start_physaddr)) {
858 Ok(physaddr) => Ok((start_virtaddr, physaddr)),
859 Err(_) => Err(syscalls::SYSCALL_ERROR_MEMORY)
860 }
861}
862
863/// Free a memory chunk previously allocated with new_memory_chunk
864pub fn free_memory_chunk(

Callers 1

kernel_thread_mainFunction · 0.85

Calls 2

Tested by

no test coverage detected