[−][src]Function sunrise_libuser::syscalls::unmap_process_memory
pub unsafe fn unmap_process_memory(
dstaddr: usize,
proc_handle: &Process,
srcaddr: usize,
size: usize
) -> Result<(), KernelError>
Unmaps a memory range mapped with map_process_memory(). dst_addr
is an
address in the current address space, while src_addr
is the address in the
remote address space that was previously mapped.
It is possible to partially unmap a ProcessMemory.
Safety
This function unmaps the memory, invalidating any pointer to the given region. The user must take care that no pointers point to this region before calling this function.
Errors
InvalidAddress
- src_addr or dst_addr is not aligned to 0x1000.
InvalidSize
- size is 0
- size is not aligned to 0x1000.
InvalidMemState
src_addr + size
overflowsdst_addr + size
overflows- The src region is outside of the UserLand address space.
- The dst region is outside of the UserLand address space, or within the heap or map memory region.
- The src memory pages does not have the MAP_PROCESS state.
- The src memory pages is not of the ProcessMemory type.
InvalidMemRange
- The given source range does not map the same pages as the given dst range.
InvalidHandle
- The handle passed as an argument does not exist or is not a Process handle.