More correctly use cp_grant_id_t.

More correctly use vir_bytes.
More correctly use endpoint_t.
This commit is contained in:
Kees van Reeuwijk
2010-03-02 23:12:13 +00:00
parent f3c98fdca2
commit bf7397b64e
9 changed files with 53 additions and 43 deletions

View File

@@ -67,7 +67,7 @@ PUBLIC int do_sdevio(struct proc * caller, message *m_ptr)
if((m_ptr->DIO_REQUEST & _DIO_SAFEMASK) == _DIO_SAFE) {
/* Map grant address to physical address. */
if(verify_grant(proc_nr_e, caller->p_endpoint,
(vir_bytes) m_ptr->DIO_VEC_ADDR,
(cp_grant_id_t) m_ptr->DIO_VEC_ADDR,
count,
req_dir == _DIO_INPUT ? CPF_WRITE : CPF_READ,
(vir_bytes) m_ptr->DIO_OFFSET,

View File

@@ -401,7 +401,7 @@ vir_bytes bytes; /* # of bytes to be copied */
u32_t phys = 0;
if(seg == MEM_GRANT) {
return umap_grant(rp, vir_addr, bytes);
return umap_grant(rp, (cp_grant_id_t) vir_addr, bytes);
}
if(!(linear = umap_local(rp, seg, vir_addr, bytes))) {

View File

@@ -53,9 +53,14 @@ endpoint_t *e_granter; /* new granter (magic grants) */
/* Get granter process slot (if valid), and check range of
* grant id.
*/
if(!isokendpt(granter, &proc_nr) || !GRANT_VALID(grant)) {
if(!isokendpt(granter, &proc_nr) ) {
kprintf(
"grant verify failed: invalid granter or grant\n");
"grant verify failed: invalid granter %d\n", (int) granter);
return(EINVAL);
}
if(!GRANT_VALID(grant)) {
kprintf(
"grant verify failed: invalid grant %d\n", (int) grant);
return(EINVAL);
}
granter_proc = proc_addr(proc_nr);
@@ -348,8 +353,9 @@ PUBLIC int do_safecopy(struct proc * caller, message * m_ptr)
} else minix_panic("Impossible system call nr. ", m_ptr->m_type);
return safecopy(caller, m_ptr->SCP_FROM_TO, caller->p_endpoint,
m_ptr->SCP_GID, src_seg, dst_seg, m_ptr->SCP_BYTES,
m_ptr->SCP_OFFSET, (vir_bytes) m_ptr->SCP_ADDRESS, access);
(cp_grant_id_t) m_ptr->SCP_GID, src_seg, dst_seg,
m_ptr->SCP_BYTES, m_ptr->SCP_OFFSET,
(vir_bytes) m_ptr->SCP_ADDRESS, access);
}
/*===========================================================================*

View File

@@ -22,7 +22,7 @@ struct map_info_s {
/* Grantor. */
endpoint_t grantor;
int gid;
cp_grant_id_t gid;
vir_bytes offset;
vir_bytes address_Dseg; /* seg always is D */
@@ -41,7 +41,7 @@ static struct map_info_s map_info[MAX_MAP_INFO];
/*===========================================================================*
* add_info *
*===========================================================================*/
static int add_info(endpoint_t grantor, endpoint_t grantee, int gid,
static int add_info(endpoint_t grantor, endpoint_t grantee, cp_grant_id_t gid,
vir_bytes offset, vir_bytes address_Dseg,
int seg, vir_bytes address, vir_bytes bytes)
{
@@ -105,11 +105,9 @@ static struct map_info_s *get_unmap_info(endpoint_t grantee, int seg,
/*===========================================================================*
* clear_info *
*===========================================================================*/
static int clear_info(struct map_info_s *p)
static void clear_info(struct map_info_s *p)
{
p->flag = 0;
return 0;
}
/*===========================================================================*
@@ -173,7 +171,7 @@ PUBLIC int map_invoke_vm(struct proc * caller,
PUBLIC int do_safemap(struct proc * caller, message * m_ptr)
{
endpoint_t grantor = m_ptr->SMAP_EP;
cp_grant_id_t gid = m_ptr->SMAP_GID;
cp_grant_id_t gid = (cp_grant_id_t) m_ptr->SMAP_GID;
vir_bytes offset = (vir_bytes) m_ptr->SMAP_OFFSET;
int seg = (int) m_ptr->SMAP_SEG;
vir_bytes address = (vir_bytes) m_ptr->SMAP_ADDRESS;
@@ -267,7 +265,7 @@ PUBLIC int do_saferevmap(struct proc * caller, message * m_ptr)
*===========================================================================*/
PUBLIC int do_safeunmap(struct proc * caller, message * m_ptr)
{
vir_bytes address = m_ptr->SMAP_ADDRESS;
vir_bytes address = (vir_bytes) m_ptr->SMAP_ADDRESS;
int seg = (int)m_ptr->SMAP_SEG;
struct map_info_s *p;
int r;

View File

@@ -56,10 +56,12 @@ PUBLIC int do_umap(struct proc * caller, message * m_ptr)
vir_bytes newoffset;
endpoint_t newep;
int new_proc_nr;
cp_grant_id_t grant = (cp_grant_id_t) offset;
if(verify_grant(targetpr->p_endpoint, ANY, offset, count, 0, 0,
if(verify_grant(targetpr->p_endpoint, ANY, grant, count, 0, 0,
&newoffset, &newep) != OK) {
kprintf("SYSTEM: do_umap: verify_grant in %s, grant %d, bytes 0x%lx, failed, caller %s\n", targetpr->p_name, offset, count, caller->p_name);
kprintf("SYSTEM: do_umap: verify_grant in %s, grant %d, bytes 0x%lx, failed, caller %s\n",
targetpr->p_name, (int) grant, count, caller->p_name);
proc_stacktrace(caller);
return EFAULT;
}