2005-10-14 10:58:59 +02:00
|
|
|
/* The kernel call implemented in this file:
|
2005-07-14 17:12:12 +02:00
|
|
|
* m_type: SYS_UMAP
|
|
|
|
*
|
2005-10-14 10:58:59 +02:00
|
|
|
* The parameters for this kernel call are:
|
2014-05-21 17:54:35 +02:00
|
|
|
* m_lsys_krn_sys_umap.src_endpt (process number)
|
|
|
|
* m_lsys_krn_sys_umap.segment (segment where address is: T, D, or S)
|
|
|
|
* m_lsys_krn_sys_umap.src_addr (virtual address)
|
|
|
|
* m_krn_lsys_sys_umap.dst_addr (returns physical address)
|
|
|
|
* m_lsys_krn_sys_umap.nr_bytes (size of datastructure)
|
2005-07-14 17:12:12 +02:00
|
|
|
*/
|
|
|
|
|
2010-04-02 00:22:33 +02:00
|
|
|
#include "kernel/system.h"
|
2005-07-14 17:12:12 +02:00
|
|
|
|
2010-02-03 10:04:48 +01:00
|
|
|
#include <minix/endpoint.h>
|
|
|
|
|
2005-07-14 17:12:12 +02:00
|
|
|
#if USE_UMAP
|
|
|
|
|
2011-06-10 16:28:20 +02:00
|
|
|
#if ! USE_UMAP_REMOTE
|
|
|
|
#undef do_umap_remote
|
|
|
|
#endif
|
|
|
|
|
2005-07-14 17:12:12 +02:00
|
|
|
/*==========================================================================*
|
|
|
|
* do_umap *
|
|
|
|
*==========================================================================*/
|
2012-03-25 20:25:53 +02:00
|
|
|
int do_umap(struct proc * caller, message * m_ptr)
|
2005-07-14 17:12:12 +02:00
|
|
|
{
|
2014-05-21 17:54:35 +02:00
|
|
|
int seg_index = m_ptr->m_lsys_krn_sys_umap.segment & SEGMENT_INDEX;
|
|
|
|
int endpt = m_ptr->m_lsys_krn_sys_umap.src_endpt;
|
2008-11-19 13:26:10 +01:00
|
|
|
|
2011-06-10 16:28:20 +02:00
|
|
|
/* 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;
|
2014-05-21 17:54:35 +02:00
|
|
|
m_ptr->m_lsys_krn_sys_umap.dst_endpt = SELF;
|
2011-06-10 16:28:20 +02:00
|
|
|
return do_umap_remote(caller, m_ptr);
|
2005-07-14 17:12:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* USE_UMAP */
|