minix/kernel/system/do_umap.c
Erik van der Kouwe 6e0f3b3bda Split off sys_umap_remote from sys_umap
sys_umap now supports only:
- looking up the physical address of a virtual address in the address space
  of the caller;
- looking up the physical address of a grant for which the caller is the
  grantee.

This is enough for nearly all umap users. The new sys_umap_remote supports
lookups in arbitrary address spaces and grants for arbitrary grantees.
2011-06-10 14:28:20 +00:00

39 lines
1.2 KiB
C
Executable file

/* The kernel call implemented in this file:
* m_type: SYS_UMAP
*
* The parameters for this kernel call are:
* m5_i1: CP_SRC_PROC_NR (process number)
* m5_s1: CP_SRC_SPACE (segment where address is: T, D, or S)
* m5_l1: CP_SRC_ADDR (virtual address)
* m5_l2: CP_DST_ADDR (returns physical address)
* m5_l3: CP_NR_BYTES (size of datastructure)
*/
#include "kernel/system.h"
#include <minix/endpoint.h>
#if USE_UMAP
#if ! USE_UMAP_REMOTE
#undef do_umap_remote
#endif
/*==========================================================================*
* do_umap *
*==========================================================================*/
PUBLIC int do_umap(struct proc * caller, message * m_ptr)
{
int seg_index = m_ptr->CP_SRC_SPACE & SEGMENT_INDEX;
int endpt = (int) m_ptr->CP_SRC_ENDPT;
/* This call is a subset of umap_remote, it allows mapping virtual addresses
* in the caller's address space and grants where the caller is specified as
* grantee; after the security check we simply invoke do_umap_remote
*/
if (seg_index != MEM_GRANT && endpt != SELF) return EPERM;
m_ptr->CP_DST_ENDPT = SELF;
return do_umap_remote(caller, m_ptr);
}
#endif /* USE_UMAP */