Add sys_vumap() kernel call

This new call is a vectored version of sys_umap(). It supports batch
lookups, non-contiguous memory, faulting in memory, and basic access
checks.
This commit is contained in:
David van Moolenbroek
2012-03-21 23:51:18 +01:00
parent 2a395dd8b4
commit 70abb127cc
12 changed files with 216 additions and 3 deletions

View File

@@ -109,6 +109,7 @@ SRCS= \
sys_voutw.c \
sys_vsafecopy.c \
sys_vtimer.c \
sys_vumap.c \
taskcall.c \
tickdelay.c \
timers.c \

34
lib/libsys/sys_vumap.c Normal file
View File

@@ -0,0 +1,34 @@
#include "syslib.h"
/*===========================================================================*
* sys_vumap *
*===========================================================================*/
PUBLIC int sys_vumap(
endpoint_t endpt, /* source process endpoint, or SELF */
struct vumap_vir *vvec, /* virtual (input) vector */
int vcount, /* number of elements in vvec */
size_t offset, /* offset into first vvec element */
int access, /* requested safecopy access flags */
struct vumap_phys *pvec, /* physical (output) vector */
int *pcount /* (max, returned) nr of els in pvec */
)
{
message m;
int r;
m.VUMAP_ENDPT = endpt;
m.VUMAP_VADDR = (vir_bytes) vvec;
m.VUMAP_VCOUNT = vcount;
m.VUMAP_OFFSET = offset;
m.VUMAP_ACCESS = access;
m.VUMAP_PADDR = (vir_bytes) pvec;
m.VUMAP_PMAX = *pcount;
r = _kernel_call(SYS_VUMAP, &m);
if (r != OK)
return r;
*pcount = m.VUMAP_PCOUNT;
return OK;
}