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:
@@ -313,6 +313,7 @@
|
||||
# define SYS_VIRCOPY (KERNEL_CALL + 15) /* sys_vircopy() */
|
||||
# define SYS_PHYSCOPY (KERNEL_CALL + 16) /* sys_physcopy() */
|
||||
# define SYS_UMAP_REMOTE (KERNEL_CALL + 17) /* sys_umap_remote() */
|
||||
# define SYS_VUMAP (KERNEL_CALL + 18) /* sys_vumap() */
|
||||
|
||||
# define SYS_IRQCTL (KERNEL_CALL + 19) /* sys_irqctl() */
|
||||
# define SYS_INT86 (KERNEL_CALL + 20) /* sys_int86() */
|
||||
@@ -437,6 +438,16 @@
|
||||
#define CP_DST_ADDR m5_l2 /* address where data go to */
|
||||
#define CP_NR_BYTES m5_l3 /* number of bytes to copy */
|
||||
|
||||
/* Field names for SYS_VUMAP. */
|
||||
#define VUMAP_ENDPT m10_i1 /* grant owner, or SELF for local addresses */
|
||||
#define VUMAP_VADDR m10_l1 /* address of virtual (input) vector */
|
||||
#define VUMAP_VCOUNT m10_i2 /* number of elements in virtual vector */
|
||||
#define VUMAP_OFFSET m10_l2 /* offset into first entry of input vector */
|
||||
#define VUMAP_ACCESS m10_i3 /* access requested for input (VUA_ flags) */
|
||||
#define VUMAP_PADDR m10_l3 /* address of physical (output) vector */
|
||||
#define VUMAP_PMAX m10_i4 /* max number of physical vector elements */
|
||||
#define VUMAP_PCOUNT m10_i1 /* upon return: number of elements filled */
|
||||
|
||||
/* Field names for SYS_GETINFO. */
|
||||
#define I_REQUEST m7_i3 /* what info to get */
|
||||
# define GET_KINFO 0 /* get kernel information structure */
|
||||
|
||||
@@ -46,9 +46,12 @@
|
||||
|
||||
#include <sys/null.h> /* NULL Pointer */
|
||||
|
||||
#define SCPVEC_NR 64 /* max # of entries in a SYS_VSAFECOPY* request */
|
||||
#define NR_IOREQS 64
|
||||
/* maximum number of entries in an iorequest */
|
||||
#define SCPVEC_NR 64 /* max # of entries in a SYS_VSAFECOPY request */
|
||||
#define MAPVEC_NR 64 /* max # of entries in a SYS_VUMAP request */
|
||||
#define NR_IOREQS 64 /* maximum number of entries in an iorequest */
|
||||
|
||||
#define VUA_READ 0x01 /* for SYS_VUMAP: read access */
|
||||
#define VUA_WRITE 0x02 /* for SYS_VUMAP: write access */
|
||||
|
||||
/* Message passing constants. */
|
||||
#define MESS_SIZE (sizeof(message)) /* might need usizeof from FS here */
|
||||
|
||||
@@ -177,6 +177,9 @@ _PROTOTYPE(int sys_umap_data_fb, (endpoint_t proc_ep, vir_bytes vir_addr,
|
||||
vir_bytes bytes, phys_bytes *phys_addr));
|
||||
_PROTOTYPE(int sys_umap_remote, (endpoint_t proc_ep, endpoint_t grantee,
|
||||
int seg, vir_bytes vir_addr, vir_bytes bytes, phys_bytes *phys_addr));
|
||||
_PROTOTYPE(int sys_vumap, (endpoint_t endpt, struct vumap_vir *vvec,
|
||||
int vcount, size_t offset, int access, struct vumap_phys *pvec,
|
||||
int *pcount));
|
||||
|
||||
/* Shorthands for sys_getinfo() system call. */
|
||||
#define sys_getkmessages(dst) sys_getinfo(GET_KMESSAGES, dst, 0,0,0)
|
||||
|
||||
@@ -59,6 +59,23 @@ struct vir_cp_req {
|
||||
phys_bytes count;
|
||||
};
|
||||
|
||||
/* Structures for SYS_VUMAP. */
|
||||
struct vumap_vir {
|
||||
union {
|
||||
cp_grant_id_t u_grant; /* grant identifier, for non-SELF endpoint */
|
||||
vir_bytes u_addr; /* local virtual address, for SELF endpoint */
|
||||
} vv_u;
|
||||
size_t vv_size; /* size in bytes */
|
||||
};
|
||||
#define vv_grant vv_u.u_grant
|
||||
#define vv_addr vv_u.u_addr
|
||||
|
||||
struct vumap_phys {
|
||||
phys_bytes vp_addr; /* physical address */
|
||||
size_t vp_size; /* size in bytes */
|
||||
};
|
||||
|
||||
/* I/O vector structures used in protocols between services. */
|
||||
typedef struct {
|
||||
vir_bytes iov_addr; /* address of an I/O buffer */
|
||||
vir_bytes iov_size; /* sizeof an I/O buffer */
|
||||
|
||||
Reference in New Issue
Block a user