1 /* The kernel call implemented in this file:
4 * The parameters for this kernel call are:
5 * m5_i1: CP_SRC_PROC_NR (process number)
6 * m5_c1: CP_SRC_SPACE (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 "../system.h"
16 /*==========================================================================*
18 *==========================================================================*/
19 PUBLIC
int do_umap(m_ptr
)
20 register message
*m_ptr
; /* pointer to request message */
22 /* Map virtual address to physical, for non-kernel processes. */
23 int seg_type
= m_ptr
->CP_SRC_SPACE
& SEGMENT_TYPE
;
24 int seg_index
= m_ptr
->CP_SRC_SPACE
& SEGMENT_INDEX
;
25 vir_bytes offset
= m_ptr
->CP_SRC_ADDR
;
26 int count
= m_ptr
->CP_NR_BYTES
;
27 int endpt
= (int) m_ptr
->CP_SRC_ENDPT
;
31 /* Verify process number. */
35 if (! isokendpt(endpt
, &proc_nr
))
38 /* See which mapping should be made. */
41 phys_addr
= umap_local(proc_addr(proc_nr
), seg_index
, offset
, count
);
44 phys_addr
= umap_remote(proc_addr(proc_nr
), seg_index
, offset
, count
);
46 #if _MINIX_CHIP == _CHIP_INTEL
48 phys_addr
= umap_bios(proc_addr(proc_nr
), offset
, count
);
52 phys_addr
= umap_grant(proc_addr(proc_nr
), offset
, count
);
57 m_ptr
->CP_DST_ADDR
= phys_addr
;
58 return (phys_addr
== 0) ? EFAULT
: OK
;