drop from segments physcopy/vircopy invocations
. sys_vircopy always uses D for both src and dst . sys_physcopy uses PHYS_SEG if and only if corresponding endpoint is NONE, so we can derive the mode (PHYS_SEG or D) from the endpoint arg in the kernel, dropping the seg args . fields in msg still filled in for backwards compatability, using same NONE-logic in the library
This commit is contained in:
parent
0e35eb0c6b
commit
0fb2f83da9
17 changed files with 62 additions and 64 deletions
|
@ -432,14 +432,18 @@
|
||||||
#define IOP_ENDPT m2_l1 /* target endpoint */
|
#define IOP_ENDPT m2_l1 /* target endpoint */
|
||||||
|
|
||||||
/* Field names for _UMAP, _VIRCOPY, _PHYSCOPY. */
|
/* Field names for _UMAP, _VIRCOPY, _PHYSCOPY. */
|
||||||
#define CP_SRC_SPACE m5_s1 /* T or D space (stack is also D) */
|
|
||||||
#define CP_SRC_ENDPT m5_i1 /* process to copy from */
|
#define CP_SRC_ENDPT m5_i1 /* process to copy from */
|
||||||
#define CP_SRC_ADDR m5_l1 /* address where data come from */
|
#define CP_SRC_ADDR m5_l1 /* address where data come from */
|
||||||
#define CP_DST_SPACE m5_s2 /* T or D space (stack is also D) */
|
|
||||||
#define CP_DST_ENDPT m5_i2 /* process to copy to */
|
#define CP_DST_ENDPT m5_i2 /* process to copy to */
|
||||||
#define CP_DST_ADDR m5_l2 /* address where data go to */
|
#define CP_DST_ADDR m5_l2 /* address where data go to */
|
||||||
#define CP_NR_BYTES m5_l3 /* number of bytes to copy */
|
#define CP_NR_BYTES m5_l3 /* number of bytes to copy */
|
||||||
|
|
||||||
|
#define UMAP_SEG m5_s1
|
||||||
|
|
||||||
|
/* only used for backwards compatability */
|
||||||
|
#define CP_SRC_SPACE_OBSOLETE m5_s1 /* T or D space (stack is also D) */
|
||||||
|
#define CP_DST_SPACE_OBSOLETE m5_s2 /* T or D space (stack is also D) */
|
||||||
|
|
||||||
/* Field names for SYS_VUMAP. */
|
/* Field names for SYS_VUMAP. */
|
||||||
#define VUMAP_ENDPT m10_i1 /* grant owner, or SELF for local addresses */
|
#define VUMAP_ENDPT m10_i1 /* grant owner, or SELF for local addresses */
|
||||||
#define VUMAP_VADDR m10_l1 /* address of virtual (input) vector */
|
#define VUMAP_VADDR m10_l1 /* address of virtual (input) vector */
|
||||||
|
|
|
@ -131,19 +131,14 @@ int sys_vtimer(endpoint_t proc_nr, int which, clock_t *newval, clock_t
|
||||||
int sys_irqctl(int request, int irq_vec, int policy, int *irq_hook_id);
|
int sys_irqctl(int request, int irq_vec, int policy, int *irq_hook_id);
|
||||||
|
|
||||||
/* Shorthands for sys_vircopy() and sys_physcopy() system calls. */
|
/* Shorthands for sys_vircopy() and sys_physcopy() system calls. */
|
||||||
#define sys_datacopy(src_proc, src_vir, dst_proc, dst_vir, bytes) \
|
#define sys_datacopy sys_vircopy
|
||||||
sys_vircopy(src_proc, D, src_vir, dst_proc, D, dst_vir, bytes)
|
int sys_vircopy(endpoint_t src_proc, vir_bytes src_v,
|
||||||
#define sys_textcopy(src_proc, src_vir, dst_proc, dst_vir, bytes) \
|
endpoint_t dst_proc, vir_bytes dst_vir, phys_bytes bytes);
|
||||||
sys_vircopy(src_proc, T, src_vir, dst_proc, T, dst_vir, bytes)
|
|
||||||
#define sys_stackcopy(src_proc, src_vir, dst_proc, dst_vir, bytes) \
|
|
||||||
sys_vircopy(src_proc, S, src_vir, dst_proc, S, dst_vir, bytes)
|
|
||||||
int sys_vircopy(endpoint_t src_proc, int src_s, vir_bytes src_v,
|
|
||||||
endpoint_t dst_proc, int dst_seg, vir_bytes dst_vir, phys_bytes bytes);
|
|
||||||
|
|
||||||
#define sys_abscopy(src_phys, dst_phys, bytes) \
|
#define sys_abscopy(src_phys, dst_phys, bytes) \
|
||||||
sys_physcopy(NONE, PHYS_SEG, src_phys, NONE, PHYS_SEG, dst_phys, bytes)
|
sys_physcopy(NONE, src_phys, NONE, dst_phys, bytes)
|
||||||
int sys_physcopy(endpoint_t src_proc, int src_seg, vir_bytes src_vir,
|
int sys_physcopy(endpoint_t src_proc, vir_bytes src_vir,
|
||||||
endpoint_t dst_proc, int dst_seg, vir_bytes dst_vir, phys_bytes bytes);
|
endpoint_t dst_proc, vir_bytes dst_vir, phys_bytes bytes);
|
||||||
|
|
||||||
|
|
||||||
/* Grant-based copy functions. */
|
/* Grant-based copy functions. */
|
||||||
|
|
|
@ -2,10 +2,8 @@
|
||||||
* m_type: SYS_VIRCOPY, SYS_PHYSCOPY
|
* m_type: SYS_VIRCOPY, SYS_PHYSCOPY
|
||||||
*
|
*
|
||||||
* The parameters for this kernel call are:
|
* The parameters for this kernel call are:
|
||||||
* m5_s1: CP_SRC_SPACE source virtual segment
|
|
||||||
* m5_l1: CP_SRC_ADDR source offset within segment
|
* m5_l1: CP_SRC_ADDR source offset within segment
|
||||||
* m5_i1: CP_SRC_ENDPT source process number
|
* m5_i1: CP_SRC_ENDPT source process number
|
||||||
* m5_s2: CP_DST_SPACE destination virtual segment
|
|
||||||
* m5_l2: CP_DST_ADDR destination offset within segment
|
* m5_l2: CP_DST_ADDR destination offset within segment
|
||||||
* m5_i2: CP_DST_ENDPT destination process number
|
* m5_i2: CP_DST_ENDPT destination process number
|
||||||
* m5_l3: CP_NR_BYTES number of bytes to copy
|
* m5_l3: CP_NR_BYTES number of bytes to copy
|
||||||
|
@ -28,6 +26,7 @@ int do_copy(struct proc * caller, message * m_ptr)
|
||||||
struct vir_addr vir_addr[2]; /* virtual source and destination address */
|
struct vir_addr vir_addr[2]; /* virtual source and destination address */
|
||||||
phys_bytes bytes; /* number of bytes to copy */
|
phys_bytes bytes; /* number of bytes to copy */
|
||||||
int i;
|
int i;
|
||||||
|
endpoint_t pe;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (caller->p_endpoint != PM_PROC_NR && caller->p_endpoint != VFS_PROC_NR &&
|
if (caller->p_endpoint != PM_PROC_NR && caller->p_endpoint != VFS_PROC_NR &&
|
||||||
|
@ -39,22 +38,20 @@ int do_copy(struct proc * caller, message * m_ptr)
|
||||||
{
|
{
|
||||||
first= 0;
|
first= 0;
|
||||||
printf(
|
printf(
|
||||||
"do_copy: got request from %d (source %d, seg %d, destination %d, seg %d)\n",
|
"do_copy: got request from %d (source %d, destination %d)\n",
|
||||||
caller->p_endpoint,
|
caller->p_endpoint,
|
||||||
m_ptr->CP_SRC_ENDPT,
|
m_ptr->CP_SRC_ENDPT,
|
||||||
m_ptr->CP_SRC_SPACE,
|
m_ptr->CP_DST_ENDPT);
|
||||||
m_ptr->CP_DST_ENDPT,
|
|
||||||
m_ptr->CP_DST_SPACE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Dismember the command message. */
|
/* Dismember the command message. */
|
||||||
vir_addr[_SRC_].proc_nr_e = m_ptr->CP_SRC_ENDPT;
|
pe = vir_addr[_SRC_].proc_nr_e = m_ptr->CP_SRC_ENDPT;
|
||||||
vir_addr[_SRC_].segment = m_ptr->CP_SRC_SPACE;
|
vir_addr[_SRC_].segment = (pe == NONE ? PHYS_SEG : D);
|
||||||
vir_addr[_SRC_].offset = (vir_bytes) m_ptr->CP_SRC_ADDR;
|
vir_addr[_SRC_].offset = (vir_bytes) m_ptr->CP_SRC_ADDR;
|
||||||
vir_addr[_DST_].proc_nr_e = m_ptr->CP_DST_ENDPT;
|
pe = vir_addr[_DST_].proc_nr_e = m_ptr->CP_DST_ENDPT;
|
||||||
vir_addr[_DST_].segment = m_ptr->CP_DST_SPACE;
|
vir_addr[_DST_].segment = (pe == NONE ? PHYS_SEG : D);
|
||||||
vir_addr[_DST_].offset = (vir_bytes) m_ptr->CP_DST_ADDR;
|
vir_addr[_DST_].offset = (vir_bytes) m_ptr->CP_DST_ADDR;
|
||||||
bytes = (phys_bytes) m_ptr->CP_NR_BYTES;
|
bytes = (phys_bytes) m_ptr->CP_NR_BYTES;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* The parameters for this kernel call are:
|
* The parameters for this kernel call are:
|
||||||
* m5_i1: CP_SRC_PROC_NR (process number)
|
* m5_i1: CP_SRC_PROC_NR (process number)
|
||||||
* m5_s1: CP_SRC_SPACE (segment where address is: T, D, or S)
|
* m5_s1: UMAP_SEG (segment where address is: T, D, or S)
|
||||||
* m5_l1: CP_SRC_ADDR (virtual address)
|
* m5_l1: CP_SRC_ADDR (virtual address)
|
||||||
* m5_l2: CP_DST_ADDR (returns physical address)
|
* m5_l2: CP_DST_ADDR (returns physical address)
|
||||||
* m5_l3: CP_NR_BYTES (size of datastructure)
|
* m5_l3: CP_NR_BYTES (size of datastructure)
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
*==========================================================================*/
|
*==========================================================================*/
|
||||||
int do_umap(struct proc * caller, message * m_ptr)
|
int do_umap(struct proc * caller, message * m_ptr)
|
||||||
{
|
{
|
||||||
int seg_index = m_ptr->CP_SRC_SPACE & SEGMENT_INDEX;
|
int seg_index = m_ptr->UMAP_SEG & SEGMENT_INDEX;
|
||||||
int endpt = (int) m_ptr->CP_SRC_ENDPT;
|
int endpt = (int) m_ptr->CP_SRC_ENDPT;
|
||||||
|
|
||||||
/* This call is a subset of umap_remote, it allows mapping virtual addresses
|
/* This call is a subset of umap_remote, it allows mapping virtual addresses
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* The parameters for this kernel call are:
|
* The parameters for this kernel call are:
|
||||||
* m5_i1: CP_SRC_PROC_NR (process number)
|
* m5_i1: CP_SRC_PROC_NR (process number)
|
||||||
* m5_s1: CP_SRC_SPACE (segment where address is: T, D, or S)
|
* m5_s1: UMAP_SEG (segment where address is: T, D, or S)
|
||||||
* m5_l1: CP_SRC_ADDR (virtual address)
|
* m5_l1: CP_SRC_ADDR (virtual address)
|
||||||
* m5_i2: CP_DST_ENDPT (process number of grantee to check access for)
|
* m5_i2: CP_DST_ENDPT (process number of grantee to check access for)
|
||||||
* m5_l2: CP_DST_ADDR (returns physical address)
|
* m5_l2: CP_DST_ADDR (returns physical address)
|
||||||
|
@ -26,8 +26,8 @@
|
||||||
int do_umap_remote(struct proc * caller, message * m_ptr)
|
int do_umap_remote(struct proc * caller, message * m_ptr)
|
||||||
{
|
{
|
||||||
/* Map virtual address to physical, for non-kernel processes. */
|
/* Map virtual address to physical, for non-kernel processes. */
|
||||||
int seg_type = m_ptr->CP_SRC_SPACE & SEGMENT_TYPE;
|
int seg_type = m_ptr->UMAP_SEG & SEGMENT_TYPE;
|
||||||
int seg_index = m_ptr->CP_SRC_SPACE & SEGMENT_INDEX;
|
int seg_index = m_ptr->UMAP_SEG & SEGMENT_INDEX;
|
||||||
vir_bytes offset = m_ptr->CP_SRC_ADDR;
|
vir_bytes offset = m_ptr->CP_SRC_ADDR;
|
||||||
int count = m_ptr->CP_NR_BYTES;
|
int count = m_ptr->CP_NR_BYTES;
|
||||||
int endpt = (int) m_ptr->CP_SRC_ENDPT;
|
int endpt = (int) m_ptr->CP_SRC_ENDPT;
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
#include "syslib.h"
|
#include "syslib.h"
|
||||||
|
|
||||||
int sys_physcopy(src_proc, src_seg, src_vir,
|
int sys_physcopy(src_proc, src_vir, dst_proc, dst_vir, bytes)
|
||||||
dst_proc, dst_seg, dst_vir, bytes)
|
|
||||||
endpoint_t src_proc; /* source process */
|
endpoint_t src_proc; /* source process */
|
||||||
int src_seg; /* source memory segment */
|
|
||||||
vir_bytes src_vir; /* source virtual address */
|
vir_bytes src_vir; /* source virtual address */
|
||||||
endpoint_t dst_proc; /* destination process */
|
endpoint_t dst_proc; /* destination process */
|
||||||
int dst_seg; /* destination memory segment */
|
|
||||||
vir_bytes dst_vir; /* destination virtual address */
|
vir_bytes dst_vir; /* destination virtual address */
|
||||||
phys_bytes bytes; /* how many bytes */
|
phys_bytes bytes; /* how many bytes */
|
||||||
{
|
{
|
||||||
|
@ -20,11 +17,16 @@ phys_bytes bytes; /* how many bytes */
|
||||||
|
|
||||||
if (bytes == 0L) return(OK);
|
if (bytes == 0L) return(OK);
|
||||||
copy_mess.CP_SRC_ENDPT = src_proc;
|
copy_mess.CP_SRC_ENDPT = src_proc;
|
||||||
copy_mess.CP_SRC_SPACE = src_seg;
|
|
||||||
copy_mess.CP_SRC_ADDR = (long) src_vir;
|
copy_mess.CP_SRC_ADDR = (long) src_vir;
|
||||||
copy_mess.CP_DST_ENDPT = dst_proc;
|
copy_mess.CP_DST_ENDPT = dst_proc;
|
||||||
copy_mess.CP_DST_SPACE = dst_seg;
|
|
||||||
copy_mess.CP_DST_ADDR = (long) dst_vir;
|
copy_mess.CP_DST_ADDR = (long) dst_vir;
|
||||||
copy_mess.CP_NR_BYTES = (long) bytes;
|
copy_mess.CP_NR_BYTES = (long) bytes;
|
||||||
|
|
||||||
|
/* provide backwards compatability arguments to old
|
||||||
|
* kernels based on process id's; NONE <=> physical
|
||||||
|
*/
|
||||||
|
copy_mess.CP_DST_SPACE_OBSOLETE = (dst_proc == NONE ? PHYS_SEG : D);
|
||||||
|
copy_mess.CP_SRC_SPACE_OBSOLETE = (src_proc == NONE ? PHYS_SEG : D);
|
||||||
|
|
||||||
return(_kernel_call(SYS_PHYSCOPY, ©_mess));
|
return(_kernel_call(SYS_PHYSCOPY, ©_mess));
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ phys_bytes *phys_addr; /* placeholder for result */
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
m.CP_SRC_ENDPT = proc_ep;
|
m.CP_SRC_ENDPT = proc_ep;
|
||||||
m.CP_SRC_SPACE = seg;
|
m.UMAP_SEG = seg;
|
||||||
m.CP_SRC_ADDR = vir_addr;
|
m.CP_SRC_ADDR = vir_addr;
|
||||||
m.CP_NR_BYTES = bytes;
|
m.CP_NR_BYTES = bytes;
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ phys_bytes *phys_addr; /* placeholder for result */
|
||||||
|
|
||||||
m.CP_SRC_ENDPT = proc_ep;
|
m.CP_SRC_ENDPT = proc_ep;
|
||||||
m.CP_DST_ENDPT = grantee;
|
m.CP_DST_ENDPT = grantee;
|
||||||
m.CP_SRC_SPACE = seg;
|
m.UMAP_SEG = seg;
|
||||||
m.CP_SRC_ADDR = vir_addr;
|
m.CP_SRC_ADDR = vir_addr;
|
||||||
m.CP_NR_BYTES = bytes;
|
m.CP_NR_BYTES = bytes;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
#include "syslib.h"
|
#include "syslib.h"
|
||||||
|
|
||||||
int sys_vircopy(src_proc, src_seg, src_vir,
|
int sys_vircopy(src_proc, src_vir,
|
||||||
dst_proc, dst_seg, dst_vir, bytes)
|
dst_proc, dst_vir, bytes)
|
||||||
endpoint_t src_proc; /* source process */
|
endpoint_t src_proc; /* source process */
|
||||||
int src_seg; /* source memory segment */
|
|
||||||
vir_bytes src_vir; /* source virtual address */
|
vir_bytes src_vir; /* source virtual address */
|
||||||
endpoint_t dst_proc; /* destination process */
|
endpoint_t dst_proc; /* destination process */
|
||||||
int dst_seg; /* destination memory segment */
|
|
||||||
vir_bytes dst_vir; /* destination virtual address */
|
vir_bytes dst_vir; /* destination virtual address */
|
||||||
phys_bytes bytes; /* how many bytes */
|
phys_bytes bytes; /* how many bytes */
|
||||||
{
|
{
|
||||||
|
@ -19,11 +17,14 @@ phys_bytes bytes; /* how many bytes */
|
||||||
|
|
||||||
if (bytes == 0L) return(OK);
|
if (bytes == 0L) return(OK);
|
||||||
copy_mess.CP_SRC_ENDPT = src_proc;
|
copy_mess.CP_SRC_ENDPT = src_proc;
|
||||||
copy_mess.CP_SRC_SPACE = src_seg;
|
|
||||||
copy_mess.CP_SRC_ADDR = (long) src_vir;
|
copy_mess.CP_SRC_ADDR = (long) src_vir;
|
||||||
copy_mess.CP_DST_ENDPT = dst_proc;
|
copy_mess.CP_DST_ENDPT = dst_proc;
|
||||||
copy_mess.CP_DST_SPACE = dst_seg;
|
|
||||||
copy_mess.CP_DST_ADDR = (long) dst_vir;
|
copy_mess.CP_DST_ADDR = (long) dst_vir;
|
||||||
copy_mess.CP_NR_BYTES = (long) bytes;
|
copy_mess.CP_NR_BYTES = (long) bytes;
|
||||||
|
|
||||||
|
/* backwards compatability D segs */
|
||||||
|
copy_mess.CP_DST_SPACE_OBSOLETE = D;
|
||||||
|
copy_mess.CP_SRC_SPACE_OBSOLETE = D;
|
||||||
|
|
||||||
return(_kernel_call(SYS_VIRCOPY, ©_mess));
|
return(_kernel_call(SYS_VIRCOPY, ©_mess));
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,8 +94,8 @@ int do_sysuname()
|
||||||
/* Copy an uname string to the user. */
|
/* Copy an uname string to the user. */
|
||||||
n = strlen(string) + 1;
|
n = strlen(string) + 1;
|
||||||
if (n > m_in.sysuname_len) n = m_in.sysuname_len;
|
if (n > m_in.sysuname_len) n = m_in.sysuname_len;
|
||||||
r = sys_vircopy(SELF, D, (phys_bytes) string,
|
r = sys_vircopy(SELF, (phys_bytes) string,
|
||||||
mp->mp_endpoint, D, (phys_bytes) m_in.sysuname_value,
|
mp->mp_endpoint, (phys_bytes) m_in.sysuname_value,
|
||||||
(phys_bytes) n);
|
(phys_bytes) n);
|
||||||
if (r < 0) return(r);
|
if (r < 0) return(r);
|
||||||
break;
|
break;
|
||||||
|
@ -107,8 +107,8 @@ int do_sysuname()
|
||||||
if (mp->mp_effuid != 0 || len == 0) return(EPERM);
|
if (mp->mp_effuid != 0 || len == 0) return(EPERM);
|
||||||
n = len < m_in.sysuname_len ? len : m_in.sysuname_len;
|
n = len < m_in.sysuname_len ? len : m_in.sysuname_len;
|
||||||
if (n <= 0) return(EINVAL);
|
if (n <= 0) return(EINVAL);
|
||||||
r = sys_vircopy(mp->mp_endpoint, D, (phys_bytes) m_in.sysuname_value,
|
r = sys_vircopy(mp->mp_endpoint, (phys_bytes) m_in.sysuname_value,
|
||||||
SELF, D, (phys_bytes) tmp, (phys_bytes) n);
|
SELF, (phys_bytes) tmp, (phys_bytes) n);
|
||||||
if (r < 0) return(r);
|
if (r < 0) return(r);
|
||||||
tmp[n-1] = 0;
|
tmp[n-1] = 0;
|
||||||
strcpy(string, tmp);
|
strcpy(string, tmp);
|
||||||
|
|
|
@ -41,7 +41,7 @@ int do_trace()
|
||||||
{
|
{
|
||||||
register struct mproc *child;
|
register struct mproc *child;
|
||||||
struct ptrace_range pr;
|
struct ptrace_range pr;
|
||||||
int i, r, seg, req;
|
int i, r, req;
|
||||||
message m;
|
message m;
|
||||||
|
|
||||||
req = m_in.request;
|
req = m_in.request;
|
||||||
|
@ -190,14 +190,13 @@ int do_trace()
|
||||||
if (pr.pr_space != TS_INS && pr.pr_space != TS_DATA) return(EINVAL);
|
if (pr.pr_space != TS_INS && pr.pr_space != TS_DATA) return(EINVAL);
|
||||||
if (pr.pr_size == 0 || pr.pr_size > LONG_MAX) return(EINVAL);
|
if (pr.pr_size == 0 || pr.pr_size > LONG_MAX) return(EINVAL);
|
||||||
|
|
||||||
seg = (pr.pr_space == TS_INS) ? T : D;
|
|
||||||
if (req == T_GETRANGE)
|
if (req == T_GETRANGE)
|
||||||
r = sys_vircopy(child->mp_endpoint, seg, (vir_bytes) pr.pr_addr,
|
r = sys_vircopy(child->mp_endpoint, (vir_bytes) pr.pr_addr,
|
||||||
who_e, D, (vir_bytes) pr.pr_ptr,
|
who_e, (vir_bytes) pr.pr_ptr,
|
||||||
(phys_bytes) pr.pr_size);
|
(phys_bytes) pr.pr_size);
|
||||||
else
|
else
|
||||||
r = sys_vircopy(who_e, D, (vir_bytes) pr.pr_ptr,
|
r = sys_vircopy(who_e, (vir_bytes) pr.pr_ptr,
|
||||||
child->mp_endpoint, seg, (vir_bytes) pr.pr_addr,
|
child->mp_endpoint, (vir_bytes) pr.pr_addr,
|
||||||
(phys_bytes) pr.pr_size);
|
(phys_bytes) pr.pr_size);
|
||||||
|
|
||||||
if (r != OK) return(r);
|
if (r != OK) return(r);
|
||||||
|
|
|
@ -202,8 +202,8 @@ size_t seg_bytes /* how much is to be transferred? */
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if (off+seg_bytes > execi->hdr_len) return ENOEXEC;
|
if (off+seg_bytes > execi->hdr_len) return ENOEXEC;
|
||||||
if((r= sys_vircopy(SELF, D, ((vir_bytes)execi->hdr)+off,
|
if((r= sys_vircopy(SELF, ((vir_bytes)execi->hdr)+off,
|
||||||
execi->proc_e, D, seg_addr, seg_bytes)) != OK) {
|
execi->proc_e, seg_addr, seg_bytes)) != OK) {
|
||||||
printf("RS: exec read_seg: copy 0x%x bytes into %d at 0x%lx failed: %d\n",
|
printf("RS: exec read_seg: copy 0x%x bytes into %d at 0x%lx failed: %d\n",
|
||||||
seg_bytes, execi->proc_e, seg_addr, r);
|
seg_bytes, execi->proc_e, seg_addr, r);
|
||||||
}
|
}
|
||||||
|
|
|
@ -918,8 +918,8 @@ message *m_ptr;
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((r=sys_vircopy(m_ptr->m_source, D, (vir_bytes) m_ptr->RS_NAME,
|
if((r=sys_vircopy(m_ptr->m_source, (vir_bytes) m_ptr->RS_NAME,
|
||||||
SELF, D, (vir_bytes) namebuf, len)) != OK) {
|
SELF, (vir_bytes) namebuf, len)) != OK) {
|
||||||
printf("RS: name copy failed\n");
|
printf("RS: name copy failed\n");
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
|
|
@ -304,9 +304,9 @@ static void dump_segments(struct filp *f, Elf_Phdr phdrs[], int phnum)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (off = 0; off < (off_t) len; off += CLICK_SIZE) {
|
for (off = 0; off < (off_t) len; off += CLICK_SIZE) {
|
||||||
r = sys_vircopy(fp->fp_endpoint, D,
|
r = sys_vircopy(fp->fp_endpoint,
|
||||||
(vir_bytes) (seg_off + off),
|
(vir_bytes) (seg_off + off),
|
||||||
SELF, D, (vir_bytes) buf,
|
SELF, (vir_bytes) buf,
|
||||||
(phys_bytes) CLICK_SIZE);
|
(phys_bytes) CLICK_SIZE);
|
||||||
|
|
||||||
write_buf(f, (char *) buf, (off + CLICK_SIZE <= (off_t) len) ?
|
write_buf(f, (char *) buf, (off + CLICK_SIZE <= (off_t) len) ?
|
||||||
|
|
|
@ -55,7 +55,7 @@ int do_mapdriver()
|
||||||
printf("VFS: do_mapdriver: label too long\n");
|
printf("VFS: do_mapdriver: label too long\n");
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
}
|
}
|
||||||
r = sys_vircopy(who_e, D, label_vir, SELF, D, (vir_bytes) label, label_len);
|
r = sys_vircopy(who_e, label_vir, SELF, (vir_bytes) label, label_len);
|
||||||
if (r != OK) {
|
if (r != OK) {
|
||||||
printf("VFS: do_mapdriver: sys_vircopy failed: %d\n", r);
|
printf("VFS: do_mapdriver: sys_vircopy failed: %d\n", r);
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
|
|
|
@ -985,7 +985,7 @@ int req_stat(endpoint_t fs_e, ino_t inode_nr, endpoint_t proc_e, vir_bytes buf,
|
||||||
old_sb.st_ctime = sb.st_ctime;
|
old_sb.st_ctime = sb.st_ctime;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
r = sys_vircopy(SELF, D, (vir_bytes) &old_sb, proc_e, D, buf,
|
r = sys_vircopy(SELF, (vir_bytes) &old_sb, proc_e, buf,
|
||||||
sizeof(struct minix_prev_stat));
|
sizeof(struct minix_prev_stat));
|
||||||
|
|
||||||
return(r);
|
return(r);
|
||||||
|
|
|
@ -123,7 +123,7 @@ int do_select(void)
|
||||||
/* Did the process set a timeout value? If so, retrieve it. */
|
/* Did the process set a timeout value? If so, retrieve it. */
|
||||||
if (vtimeout != 0) {
|
if (vtimeout != 0) {
|
||||||
do_timeout = 1;
|
do_timeout = 1;
|
||||||
r = sys_vircopy(who_e, D, (vir_bytes) vtimeout, SELF, D,
|
r = sys_vircopy(who_e, (vir_bytes) vtimeout, SELF,
|
||||||
(vir_bytes) &timeout, sizeof(timeout));
|
(vir_bytes) &timeout, sizeof(timeout));
|
||||||
if (r != OK) return(r);
|
if (r != OK) return(r);
|
||||||
}
|
}
|
||||||
|
@ -546,7 +546,7 @@ static int copy_fdsets(struct selectentry *se, int nfds, int direction)
|
||||||
src_fds = (direction == FROM_PROC) ? se->vir_readfds : &se->ready_readfds;
|
src_fds = (direction == FROM_PROC) ? se->vir_readfds : &se->ready_readfds;
|
||||||
dst_fds = (direction == FROM_PROC) ? &se->readfds : se->vir_readfds;
|
dst_fds = (direction == FROM_PROC) ? &se->readfds : se->vir_readfds;
|
||||||
if (se->vir_readfds) {
|
if (se->vir_readfds) {
|
||||||
r = sys_vircopy(src_e, D, (vir_bytes) src_fds, dst_e, D,
|
r = sys_vircopy(src_e, (vir_bytes) src_fds, dst_e,
|
||||||
(vir_bytes) dst_fds, fd_setsize);
|
(vir_bytes) dst_fds, fd_setsize);
|
||||||
if (r != OK) return(r);
|
if (r != OK) return(r);
|
||||||
}
|
}
|
||||||
|
@ -555,7 +555,7 @@ static int copy_fdsets(struct selectentry *se, int nfds, int direction)
|
||||||
src_fds = (direction == FROM_PROC) ? se->vir_writefds : &se->ready_writefds;
|
src_fds = (direction == FROM_PROC) ? se->vir_writefds : &se->ready_writefds;
|
||||||
dst_fds = (direction == FROM_PROC) ? &se->writefds : se->vir_writefds;
|
dst_fds = (direction == FROM_PROC) ? &se->writefds : se->vir_writefds;
|
||||||
if (se->vir_writefds) {
|
if (se->vir_writefds) {
|
||||||
r = sys_vircopy(src_e, D, (vir_bytes) src_fds, dst_e, D,
|
r = sys_vircopy(src_e, (vir_bytes) src_fds, dst_e,
|
||||||
(vir_bytes) dst_fds, fd_setsize);
|
(vir_bytes) dst_fds, fd_setsize);
|
||||||
if (r != OK) return(r);
|
if (r != OK) return(r);
|
||||||
}
|
}
|
||||||
|
@ -564,7 +564,7 @@ static int copy_fdsets(struct selectentry *se, int nfds, int direction)
|
||||||
src_fds = (direction == FROM_PROC) ? se->vir_errorfds : &se->ready_errorfds;
|
src_fds = (direction == FROM_PROC) ? se->vir_errorfds : &se->ready_errorfds;
|
||||||
dst_fds = (direction == FROM_PROC) ? &se->errorfds : se->vir_errorfds;
|
dst_fds = (direction == FROM_PROC) ? &se->errorfds : se->vir_errorfds;
|
||||||
if (se->vir_errorfds) {
|
if (se->vir_errorfds) {
|
||||||
r = sys_vircopy(src_e, D, (vir_bytes) src_fds, dst_e, D,
|
r = sys_vircopy(src_e, (vir_bytes) src_fds, dst_e,
|
||||||
(vir_bytes) dst_fds, fd_setsize);
|
(vir_bytes) dst_fds, fd_setsize);
|
||||||
if (r != OK) return(r);
|
if (r != OK) return(r);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue