sys_memory_map

Function sys_memory_map 

Source
pub fn sys_memory_map(trapframe: &mut Trapframe) -> usize
Expand description

System call for memory mapping a KernelObject with MemoryMappingOps capability or creating anonymous mappings

§Arguments

  • handle: Handle to the KernelObject (must support MemoryMappingOps) - ignored for ANONYMOUS
  • vaddr: Virtual address where to map (0 means kernel chooses)
  • length: Length of the mapping in bytes
  • prot: Protection flags (PROT_READ, PROT_WRITE, PROT_EXEC)
  • flags: Mapping flags (MAP_SHARED, MAP_PRIVATE, MAP_FIXED, MAP_ANONYMOUS, etc.)
  • offset: Offset within the object to start mapping from (ignored for ANONYMOUS)

§Returns

  • On success: virtual address of the mapping
  • On error: usize::MAX

§Design

  • ANONYMOUS mappings are handled entirely within this syscall
  • All other mappings (including FIXED) are delegated to the KernelObject’s MemoryMappingOps