coverity appeasement
[minix.git] / kernel / system / do_umap.c
blob32c1ff3a8b6fb1e30fa3adffc2fc6a8ae0896ba9
1 /* The kernel call implemented in this file:
2 * m_type: SYS_UMAP
4 * The parameters for this kernel call are:
5 * m5_i1: CP_SRC_PROC_NR (process number)
6 * m5_s1: UMAP_SEG (segment where address is: T, D, or S)
7 * m5_l1: CP_SRC_ADDR (virtual address)
8 * m5_l2: CP_DST_ADDR (returns physical address)
9 * m5_l3: CP_NR_BYTES (size of datastructure)
12 #include "kernel/system.h"
14 #include <minix/endpoint.h>
16 #if USE_UMAP
18 #if ! USE_UMAP_REMOTE
19 #undef do_umap_remote
20 #endif
22 /*==========================================================================*
23 * do_umap *
24 *==========================================================================*/
25 int do_umap(struct proc * caller, message * m_ptr)
27 int seg_index = m_ptr->UMAP_SEG & SEGMENT_INDEX;
28 int endpt = (int) m_ptr->CP_SRC_ENDPT;
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
34 if (seg_index != MEM_GRANT && endpt != SELF) return EPERM;
35 m_ptr->CP_DST_ENDPT = SELF;
36 return do_umap_remote(caller, m_ptr);
39 #endif /* USE_UMAP */