Message type for SYS_VUMAP

Change-Id: I9accdf887c119566429ab0803436b068729bcd85
This commit is contained in:
Lionel Sambuc 2014-05-22 10:05:44 +02:00
parent dc823abec2
commit f1dff35292
4 changed files with 46 additions and 34 deletions

View file

@ -312,16 +312,6 @@
#define CP_FLAG_TRY 0x01 /* do not transparently map */
/* 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 */

View file

@ -791,6 +791,26 @@ typedef struct {
} mess_lsys_krn_sys_vdevio;
_ASSERT_MSG_SIZE(mess_lsys_krn_sys_vdevio);
typedef struct {
endpoint_t endpt;
vir_bytes vaddr; /* struct vumap_vir * */
int vcount;
vir_bytes paddr; /* struct vumap_phys * */
int pmax;
int access;
size_t offset;
uint8_t padding[28];
} mess_lsys_krn_sys_vumap;
_ASSERT_MSG_SIZE(mess_lsys_krn_sys_vumap);
typedef struct {
int pcount;
uint8_t padding[52];
} mess_krn_lsys_sys_vumap;
_ASSERT_MSG_SIZE(mess_krn_lsys_sys_vumap);
typedef struct {
phys_bytes base;
phys_bytes count;
@ -1450,6 +1470,7 @@ typedef struct {
mess_krn_lsys_schedule m_krn_lsys_schedule;
mess_krn_lsys_sys_irqctl m_krn_lsys_sys_irqctl;
mess_krn_lsys_sys_umap m_krn_lsys_sys_umap;
mess_krn_lsys_sys_vumap m_krn_lsys_sys_vumap;
mess_fs_vfs_breadwrite m_fs_vfs_breadwrite;
mess_fs_vfs_chmod m_fs_vfs_chmod;
@ -1535,6 +1556,7 @@ typedef struct {
mess_lsys_krn_sys_setalarm m_lsys_krn_sys_setalarm;
mess_lsys_krn_sys_umap m_lsys_krn_sys_umap;
mess_lsys_krn_sys_vdevio m_lsys_krn_sys_vdevio;
mess_lsys_krn_sys_vumap m_lsys_krn_sys_vumap;
mess_lsys_pci_busc_get_bar m_lsys_pci_busc_get_bar;

View file

@ -2,14 +2,14 @@
* m_type: SYS_VUMAP
*
* The parameters for this kernel call are:
* m10_i1: VUMAP_ENDPT (grant owner, or SELF for local addresses)
* m10_l1: VUMAP_VADDR (address of virtual (input) vector)
* m10_i2: VUMAP_VCOUNT (number of elements in virtual vector)
* m10_l2: VUMAP_OFFSET (offset into first entry of input vector)
* m10_i3: VUMAP_ACCESS (safecopy access requested for input)
* m10_l3: VUMAP_PADDR (address of physical (output) vector)
* m10_i4: VUMAP_PMAX (maximum number of physical vector elements)
* m10_i1: VUMAP_PCOUNT (upon return: number of elements filled)
* m_lsys_krn_sys_vumap.endpt (grant owner, or SELF for local addresses)
* m_lsys_krn_sys_vumap.vaddr (address of virtual (input) vector)
* m_lsys_krn_sys_vumap.vcount (number of elements in virtual vector)
* m_lsys_krn_sys_vumap.offset (offset into first entry of input vector)
* m_lsys_krn_sys_vumap.access (safecopy access requested for input)
* m_lsys_krn_sys_vumap.paddr (address of physical (output) vector)
* m_lsys_krn_sys_vumap.pmax (maximum number of physical vector elements)
* m_krn_lsys_sys_vumap.pcount (upon return: number of elements filled)
*/
#include "kernel/system.h"
@ -37,13 +37,13 @@ int do_vumap(struct proc *caller, message *m_ptr)
endpt = caller->p_endpoint;
/* Retrieve and check input parameters. */
source = m_ptr->VUMAP_ENDPT;
vaddr = (vir_bytes) m_ptr->VUMAP_VADDR;
vcount = m_ptr->VUMAP_VCOUNT;
offset = m_ptr->VUMAP_OFFSET;
access = m_ptr->VUMAP_ACCESS;
paddr = (vir_bytes) m_ptr->VUMAP_PADDR;
pmax = m_ptr->VUMAP_PMAX;
source = m_ptr->m_lsys_krn_sys_vumap.endpt;
vaddr = m_ptr->m_lsys_krn_sys_vumap.vaddr;
vcount = m_ptr->m_lsys_krn_sys_vumap.vcount;
offset = m_ptr->m_lsys_krn_sys_vumap.offset;
access = m_ptr->m_lsys_krn_sys_vumap.access;
paddr = m_ptr->m_lsys_krn_sys_vumap.paddr;
pmax = m_ptr->m_lsys_krn_sys_vumap.pmax;
if (vcount <= 0 || pmax <= 0)
return EINVAL;
@ -125,7 +125,7 @@ int do_vumap(struct proc *caller, message *m_ptr)
r = data_copy_vmcheck(caller, KERNEL, (vir_bytes) pvec, endpt, paddr, size);
if (r == OK)
m_ptr->VUMAP_PCOUNT = pcount;
m_ptr->m_krn_lsys_sys_vumap.pcount = pcount;
return r;
}

View file

@ -16,19 +16,19 @@ int sys_vumap(
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;
m.m_lsys_krn_sys_vumap.endpt = endpt;
m.m_lsys_krn_sys_vumap.vaddr = (vir_bytes) vvec;
m.m_lsys_krn_sys_vumap.vcount = vcount;
m.m_lsys_krn_sys_vumap.offset = offset;
m.m_lsys_krn_sys_vumap.access = access;
m.m_lsys_krn_sys_vumap.paddr = (vir_bytes) pvec;
m.m_lsys_krn_sys_vumap.pmax = *pcount;
r = _kernel_call(SYS_VUMAP, &m);
if (r != OK)
return r;
*pcount = m.VUMAP_PCOUNT;
*pcount = m.m_krn_lsys_sys_vumap.pcount;
return OK;
}