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
)
| 839 | /// Must be page aligned |
| 840 | /// |
| 841 | pub 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 |
| 864 | pub fn free_memory_chunk( |
no test coverage detected