xref: /minix3/minix/lib/libsys/arch/i386/sys_umap_remote.c (revision 433d6423c39e34ec4b79c950597bb2d236f886be)
1*433d6423SLionel Sambuc #include "syslib.h"
2*433d6423SLionel Sambuc 
3*433d6423SLionel Sambuc /*===========================================================================*
4*433d6423SLionel Sambuc  *                                sys_umap_remote			     *
5*433d6423SLionel Sambuc  *===========================================================================*/
sys_umap_remote(proc_ep,grantee,seg,vir_addr,bytes,phys_addr)6*433d6423SLionel Sambuc int sys_umap_remote(proc_ep, grantee, seg, vir_addr, bytes, phys_addr)
7*433d6423SLionel Sambuc endpoint_t proc_ep;			/* process number to do umap for */
8*433d6423SLionel Sambuc endpoint_t grantee;			/* process nr to check as grantee */
9*433d6423SLionel Sambuc int seg;				/* T, D, or S segment */
10*433d6423SLionel Sambuc vir_bytes vir_addr;			/* address in bytes with segment*/
11*433d6423SLionel Sambuc vir_bytes bytes;			/* number of bytes to be copied */
12*433d6423SLionel Sambuc phys_bytes *phys_addr;			/* placeholder for result */
13*433d6423SLionel Sambuc {
14*433d6423SLionel Sambuc     message m;
15*433d6423SLionel Sambuc     int result;
16*433d6423SLionel Sambuc 
17*433d6423SLionel Sambuc     /* Note about the grantee parameter:
18*433d6423SLionel Sambuc      * - Is ignored for non-grant umap calls, but should be SELF to
19*433d6423SLionel Sambuc      *   pass the sanity check in that case;
20*433d6423SLionel Sambuc      * - May be SELF to get the same behaviour as sys_umap, namely that the
21*433d6423SLionel Sambuc      *   caller must be the grantee;
22*433d6423SLionel Sambuc      * - In all other cases, should be a valid endpoint (neither ANY nor NONE).
23*433d6423SLionel Sambuc      */
24*433d6423SLionel Sambuc 
25*433d6423SLionel Sambuc     m.m_lsys_krn_sys_umap.src_endpt = proc_ep;
26*433d6423SLionel Sambuc     m.m_lsys_krn_sys_umap.dst_endpt = grantee;
27*433d6423SLionel Sambuc     m.m_lsys_krn_sys_umap.segment = seg;
28*433d6423SLionel Sambuc     m.m_lsys_krn_sys_umap.src_addr = vir_addr;
29*433d6423SLionel Sambuc     m.m_lsys_krn_sys_umap.nr_bytes = bytes;
30*433d6423SLionel Sambuc 
31*433d6423SLionel Sambuc     result = _kernel_call(SYS_UMAP_REMOTE, &m);
32*433d6423SLionel Sambuc     *phys_addr = m.m_krn_lsys_sys_umap.dst_addr;
33*433d6423SLionel Sambuc     return(result);
34*433d6423SLionel Sambuc }
35*433d6423SLionel Sambuc 
36