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:
@@ -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
34
lib/libsys/sys_vumap.c
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user