1 /* The kernel call implemented in this file: 2 * m_type: SYS_UMAP 3 * 4 * The parameters for this kernel call are: 5 * m_lsys_krn_sys_umap.src_endpt (process number) 6 * m_lsys_krn_sys_umap.segment (segment where address is: T, D, or S) 7 * m_lsys_krn_sys_umap.src_addr (virtual address) 8 * m_krn_lsys_sys_umap.dst_addr (returns physical address) 9 * m_lsys_krn_sys_umap.nr_bytes (size of datastructure) 10 */ 11 12 #include "kernel/system.h" 13 14 #include <minix/endpoint.h> 15 16 #if USE_UMAP 17 18 #if ! USE_UMAP_REMOTE 19 #undef do_umap_remote 20 #endif 21 22 /*==========================================================================* 23 * do_umap * 24 *==========================================================================*/ 25 int do_umap(struct proc * caller, message * m_ptr) 26 { 27 int seg_index = m_ptr->m_lsys_krn_sys_umap.segment & SEGMENT_INDEX; 28 int endpt = m_ptr->m_lsys_krn_sys_umap.src_endpt; 29 30 /* This call is a subset of umap_remote, it allows mapping virtual addresses 31 * in the caller's address space and grants where the caller is specified as 32 * grantee; after the security check we simply invoke do_umap_remote 33 */ 34 if (seg_index != MEM_GRANT && endpt != SELF) return EPERM; 35 m_ptr->m_lsys_krn_sys_umap.dst_endpt = SELF; 36 return do_umap_remote(caller, m_ptr); 37 } 38 39 #endif /* USE_UMAP */ 40