1 /* Test for sys_vumap() - by D.C. van Moolenbroek */
2 #include <minix/drivers.h>
7 static int do_request(message
*m
)
9 struct vumap_vir vvec
[MAPVEC_NR
+ 3];
10 struct vumap_phys pvec
[MAPVEC_NR
+ 3];
11 int r
, r2
, access
, vcount
, pcount
;
14 assert(m
->m_type
== VTR_RELAY
);
16 vcount
= m
->VTR_VCOUNT
;
17 pcount
= m
->VTR_PCOUNT
;
18 offset
= m
->VTR_OFFSET
;
19 access
= m
->VTR_ACCESS
;
21 r2
= sys_safecopyfrom(m
->m_source
, m
->VTR_VGRANT
, 0, (vir_bytes
) vvec
,
22 sizeof(vvec
[0]) * vcount
);
25 r
= sys_vumap(m
->m_source
, vvec
, vcount
, offset
, access
, pvec
,
28 if (pcount
>= 1 && pcount
<= MAPVEC_NR
+ 3) {
29 r2
= sys_safecopyto(m
->m_source
, m
->VTR_PGRANT
, 0,
30 (vir_bytes
) pvec
, sizeof(pvec
[0]) * pcount
);
34 m
->VTR_PCOUNT
= pcount
;
39 static int sef_cb_init_fresh(int UNUSED(type
), sef_init_info_t
*UNUSED(info
))
44 static void sef_cb_signal_handler(int sig
)
50 static void sef_local_startup(void)
52 sef_setcb_init_fresh(sef_cb_init_fresh
);
53 sef_setcb_signal_handler(sef_cb_signal_handler
);
58 int main(int argc
, char **argv
)
63 env_setargs(argc
, argv
);
68 if ((r
= sef_receive(ANY
, &m
)) != OK
)
69 panic("sef_receive failed (%d)\n", r
);
71 m
.m_type
= do_request(&m
);