custom message types for safecopy calls
This commit is contained in:
parent
c24f718bb4
commit
9961d3d3e5
5 changed files with 48 additions and 40 deletions
|
@ -358,13 +358,6 @@
|
|||
/* Field names for SYS_INT86 */
|
||||
#define INT86_REG86 m1_p1 /* pointer to registers */
|
||||
|
||||
/* Field names for SYS_SAFECOPY* */
|
||||
#define SCP_FROM_TO m2_i1 /* from/to whom? */
|
||||
#define SCP_GID m2_i3 /* grant id */
|
||||
#define SCP_OFFSET m2_l1 /* offset within grant */
|
||||
#define SCP_ADDRESS m2_p1 /* my own address */
|
||||
#define SCP_BYTES m2_l2 /* bytes from offset */
|
||||
|
||||
/* SYS_SAFEMEMSET */
|
||||
#define SMS_DST m2_i1 /* dst endpoint */
|
||||
#define SMS_GID m2_i3 /* grant id */
|
||||
|
@ -372,10 +365,6 @@
|
|||
#define SMS_BYTES m2_l2 /* bytes from offset */
|
||||
#define SMS_PATTERN m2_i2 /* memset() pattern */
|
||||
|
||||
/* Field names for SYS_VSAFECOPY* */
|
||||
#define VSCP_VEC_ADDR m2_p1 /* start of vector */
|
||||
#define VSCP_VEC_SIZE m2_l2 /* elements in vector */
|
||||
|
||||
/* Field names for SYS_SPROF, _CPROF, _PROFBUF. */
|
||||
#define PROF_ACTION m7_i1 /* start/stop/reset/get */
|
||||
#define PROF_MEM_SIZE m7_i2 /* available memory for data */
|
||||
|
|
|
@ -1863,6 +1863,23 @@ typedef struct {
|
|||
} mess_lsys_vm_unmap_phys;
|
||||
_ASSERT_MSG_SIZE(mess_lsys_vm_unmap_phys);
|
||||
|
||||
typedef struct {
|
||||
endpoint_t from_to;
|
||||
cp_grant_id_t gid;
|
||||
size_t offset;
|
||||
void *address;
|
||||
size_t bytes;
|
||||
uint8_t padding[36];
|
||||
} mess_lsys_kern_safecopy;
|
||||
_ASSERT_MSG_SIZE(mess_lsys_kern_safecopy);
|
||||
|
||||
typedef struct {
|
||||
void *vec_addr;
|
||||
int vec_size;
|
||||
uint8_t padding[48];
|
||||
} mess_lsys_kern_vsafecopy;
|
||||
_ASSERT_MSG_SIZE(mess_lsys_kern_vsafecopy);
|
||||
|
||||
typedef struct {
|
||||
endpoint_t m_source; /* who sent the message */
|
||||
int m_type; /* what kind of message is it */
|
||||
|
@ -2101,6 +2118,8 @@ typedef struct {
|
|||
mess_lc_vm_brk m_lc_vm_brk;
|
||||
mess_lsys_vm_map_phys m_lsys_vm_map_phys;
|
||||
mess_lsys_vm_unmap_phys m_lsys_vm_unmap_phys;
|
||||
mess_lsys_kern_safecopy m_lsys_kern_safecopy;
|
||||
mess_lsys_kern_vsafecopy m_lsys_kern_vsafecopy;
|
||||
|
||||
mess_vfs_lchardriver_cancel m_vfs_lchardriver_cancel;
|
||||
mess_vfs_lchardriver_openclose m_vfs_lchardriver_openclose;
|
||||
|
|
|
@ -2,15 +2,15 @@
|
|||
* m_type: SYS_SAFECOPYFROM or SYS_SAFECOPYTO or SYS_VSAFECOPY
|
||||
*
|
||||
* The parameters for this kernel call are:
|
||||
* SCP_FROM_TO other endpoint
|
||||
* SCP_GID grant id
|
||||
* SCP_OFFSET offset within granted space
|
||||
* SCP_ADDRESS address in own address space
|
||||
* SCP_BYTES bytes to be copied
|
||||
* m_lsys_kern_safecopy.from_to other endpoint
|
||||
* m_lsys_kern_safecopy.gid grant id
|
||||
* m_lsys_kern_safecopy.offset offset within granted space
|
||||
* m_lsys_kern_safecopy.address address in own address space
|
||||
* m_lsys_kern_safecopy.bytes bytes to be copied
|
||||
*
|
||||
* For the vectored variant (do_vsafecopy):
|
||||
* VSCP_VEC_ADDR address of vector
|
||||
* VSCP_VEC_SIZE number of significant elements in vector
|
||||
* m_lsys_kern_vsafecopy.vec_addr address of vector
|
||||
* m_lsys_kern_vsafecopy.vec_size number of significant elements in vector
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -318,10 +318,10 @@ int access; /* CPF_READ for a copy from granter to grantee, CPF_WRITE
|
|||
*===========================================================================*/
|
||||
int do_safecopy_to(struct proc * caller, message * m_ptr)
|
||||
{
|
||||
return safecopy(caller, m_ptr->SCP_FROM_TO, caller->p_endpoint,
|
||||
(cp_grant_id_t) m_ptr->SCP_GID,
|
||||
m_ptr->SCP_BYTES, m_ptr->SCP_OFFSET,
|
||||
(vir_bytes) m_ptr->SCP_ADDRESS, CPF_WRITE);
|
||||
return safecopy(caller, m_ptr->m_lsys_kern_safecopy.from_to, caller->p_endpoint,
|
||||
(cp_grant_id_t) m_ptr->m_lsys_kern_safecopy.gid,
|
||||
m_ptr->m_lsys_kern_safecopy.bytes, m_ptr->m_lsys_kern_safecopy.offset,
|
||||
(vir_bytes) m_ptr->m_lsys_kern_safecopy.address, CPF_WRITE);
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
|
@ -329,10 +329,10 @@ int do_safecopy_to(struct proc * caller, message * m_ptr)
|
|||
*===========================================================================*/
|
||||
int do_safecopy_from(struct proc * caller, message * m_ptr)
|
||||
{
|
||||
return safecopy(caller, m_ptr->SCP_FROM_TO, caller->p_endpoint,
|
||||
(cp_grant_id_t) m_ptr->SCP_GID,
|
||||
m_ptr->SCP_BYTES, m_ptr->SCP_OFFSET,
|
||||
(vir_bytes) m_ptr->SCP_ADDRESS, CPF_READ);
|
||||
return safecopy(caller, m_ptr->m_lsys_kern_safecopy.from_to, caller->p_endpoint,
|
||||
(cp_grant_id_t) m_ptr->m_lsys_kern_safecopy.gid,
|
||||
m_ptr->m_lsys_kern_safecopy.bytes, m_ptr->m_lsys_kern_safecopy.offset,
|
||||
(vir_bytes) m_ptr->m_lsys_kern_safecopy.address, CPF_READ);
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
|
@ -348,12 +348,12 @@ int do_vsafecopy(struct proc * caller, message * m_ptr)
|
|||
/* Set vector copy parameters. */
|
||||
src.proc_nr_e = caller->p_endpoint;
|
||||
assert(src.proc_nr_e != NONE);
|
||||
src.offset = (vir_bytes) m_ptr->VSCP_VEC_ADDR;
|
||||
src.offset = (vir_bytes) m_ptr->m_lsys_kern_vsafecopy.vec_addr;
|
||||
dst.proc_nr_e = KERNEL;
|
||||
dst.offset = (vir_bytes) vec;
|
||||
|
||||
/* No. of vector elements. */
|
||||
els = m_ptr->VSCP_VEC_SIZE;
|
||||
els = m_ptr->m_lsys_kern_vsafecopy.vec_size;
|
||||
bytes = els * sizeof(struct vscp_vec);
|
||||
|
||||
/* Obtain vector of copies. */
|
||||
|
|
|
@ -13,11 +13,11 @@ int sys_safecopyfrom(endpoint_t src_e,
|
|||
|
||||
message copy_mess;
|
||||
|
||||
copy_mess.SCP_FROM_TO = src_e;
|
||||
copy_mess.SCP_GID = gr_id;
|
||||
copy_mess.SCP_OFFSET = (long) offset;
|
||||
copy_mess.SCP_ADDRESS = (char *) address;
|
||||
copy_mess.SCP_BYTES = (long) bytes;
|
||||
copy_mess.m_lsys_kern_safecopy.from_to = src_e;
|
||||
copy_mess.m_lsys_kern_safecopy.gid = gr_id;
|
||||
copy_mess.m_lsys_kern_safecopy.offset = offset;
|
||||
copy_mess.m_lsys_kern_safecopy.address = address;
|
||||
copy_mess.m_lsys_kern_safecopy.bytes = bytes;
|
||||
|
||||
return(_kernel_call(SYS_SAFECOPYFROM, ©_mess));
|
||||
|
||||
|
@ -33,11 +33,11 @@ int sys_safecopyto(endpoint_t dst_e,
|
|||
|
||||
message copy_mess;
|
||||
|
||||
copy_mess.SCP_FROM_TO = dst_e;
|
||||
copy_mess.SCP_GID = gr_id;
|
||||
copy_mess.SCP_OFFSET = (long) offset;
|
||||
copy_mess.SCP_ADDRESS = (char *) address;
|
||||
copy_mess.SCP_BYTES = (long) bytes;
|
||||
copy_mess.m_lsys_kern_safecopy.from_to = dst_e;
|
||||
copy_mess.m_lsys_kern_safecopy.gid = gr_id;
|
||||
copy_mess.m_lsys_kern_safecopy.offset = offset;
|
||||
copy_mess.m_lsys_kern_safecopy.address = address;
|
||||
copy_mess.m_lsys_kern_safecopy.bytes = bytes;
|
||||
|
||||
return(_kernel_call(SYS_SAFECOPYTO, ©_mess));
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@ int sys_vsafecopy(struct vscp_vec *vec, int els)
|
|||
|
||||
message copy_mess;
|
||||
|
||||
copy_mess.VSCP_VEC_ADDR = (char *) vec;
|
||||
copy_mess.VSCP_VEC_SIZE = els;
|
||||
copy_mess.m_lsys_kern_vsafecopy.vec_addr = vec;
|
||||
copy_mess.m_lsys_kern_vsafecopy.vec_size = els;
|
||||
|
||||
return(_kernel_call(SYS_VSAFECOPY, ©_mess));
|
||||
|
||||
|
|
Loading…
Reference in a new issue