#define IOP_ENDPT m2_l1 /* target endpoint */
/* 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_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_ADDR m5_l2 /* address where data go to */
#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. */
#define VUMAP_ENDPT m10_i1 /* grant owner, or SELF for local addresses */
#define VUMAP_VADDR m10_l1 /* address of virtual (input) vector */
int sys_irqctl(int request, int irq_vec, int policy, int *irq_hook_id);
/* Shorthands for sys_vircopy() and sys_physcopy() system calls. */
-#define sys_datacopy(src_proc, src_vir, dst_proc, dst_vir, bytes) \
- sys_vircopy(src_proc, D, src_vir, dst_proc, D, dst_vir, bytes)
-#define sys_textcopy(src_proc, src_vir, dst_proc, dst_vir, 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_datacopy sys_vircopy
+int sys_vircopy(endpoint_t src_proc, vir_bytes src_v,
+ endpoint_t dst_proc, vir_bytes dst_vir, phys_bytes bytes);
#define sys_abscopy(src_phys, dst_phys, bytes) \
- sys_physcopy(NONE, PHYS_SEG, src_phys, NONE, PHYS_SEG, dst_phys, bytes)
-int sys_physcopy(endpoint_t src_proc, int src_seg, vir_bytes src_vir,
- endpoint_t dst_proc, int dst_seg, vir_bytes dst_vir, phys_bytes bytes);
+ sys_physcopy(NONE, src_phys, NONE, dst_phys, bytes)
+int sys_physcopy(endpoint_t src_proc, vir_bytes src_vir,
+ endpoint_t dst_proc, vir_bytes dst_vir, phys_bytes bytes);
/* Grant-based copy functions. */
* m_type: SYS_VIRCOPY, SYS_PHYSCOPY
*
* 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_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_i2: CP_DST_ENDPT destination process number
* m5_l3: CP_NR_BYTES number of bytes to copy
struct vir_addr vir_addr[2]; /* virtual source and destination address */
phys_bytes bytes; /* number of bytes to copy */
int i;
+ endpoint_t pe;
#if 0
if (caller->p_endpoint != PM_PROC_NR && caller->p_endpoint != VFS_PROC_NR &&
{
first= 0;
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,
m_ptr->CP_SRC_ENDPT,
- m_ptr->CP_SRC_SPACE,
- m_ptr->CP_DST_ENDPT,
- m_ptr->CP_DST_SPACE);
+ m_ptr->CP_DST_ENDPT);
}
}
#endif
/* Dismember the command message. */
- vir_addr[_SRC_].proc_nr_e = m_ptr->CP_SRC_ENDPT;
- vir_addr[_SRC_].segment = m_ptr->CP_SRC_SPACE;
+ pe = vir_addr[_SRC_].proc_nr_e = m_ptr->CP_SRC_ENDPT;
+ vir_addr[_SRC_].segment = (pe == NONE ? PHYS_SEG : D);
vir_addr[_SRC_].offset = (vir_bytes) m_ptr->CP_SRC_ADDR;
- vir_addr[_DST_].proc_nr_e = m_ptr->CP_DST_ENDPT;
- vir_addr[_DST_].segment = m_ptr->CP_DST_SPACE;
+ pe = vir_addr[_DST_].proc_nr_e = m_ptr->CP_DST_ENDPT;
+ vir_addr[_DST_].segment = (pe == NONE ? PHYS_SEG : D);
vir_addr[_DST_].offset = (vir_bytes) m_ptr->CP_DST_ADDR;
bytes = (phys_bytes) m_ptr->CP_NR_BYTES;
*
* The parameters for this kernel call are:
* 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_l2: CP_DST_ADDR (returns physical address)
* m5_l3: CP_NR_BYTES (size of datastructure)
*==========================================================================*/
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;
/* This call is a subset of umap_remote, it allows mapping virtual addresses
*
* The parameters for this kernel call are:
* 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_i2: CP_DST_ENDPT (process number of grantee to check access for)
* m5_l2: CP_DST_ADDR (returns physical address)
int do_umap_remote(struct proc * caller, message * m_ptr)
{
/* Map virtual address to physical, for non-kernel processes. */
- int seg_type = m_ptr->CP_SRC_SPACE & SEGMENT_TYPE;
- int seg_index = m_ptr->CP_SRC_SPACE & SEGMENT_INDEX;
+ int seg_type = m_ptr->UMAP_SEG & SEGMENT_TYPE;
+ int seg_index = m_ptr->UMAP_SEG & SEGMENT_INDEX;
vir_bytes offset = m_ptr->CP_SRC_ADDR;
int count = m_ptr->CP_NR_BYTES;
int endpt = (int) m_ptr->CP_SRC_ENDPT;
#include "syslib.h"
-int sys_physcopy(src_proc, src_seg, src_vir,
- dst_proc, dst_seg, dst_vir, bytes)
+int sys_physcopy(src_proc, src_vir, dst_proc, dst_vir, bytes)
endpoint_t src_proc; /* source process */
-int src_seg; /* source memory segment */
vir_bytes src_vir; /* source virtual address */
endpoint_t dst_proc; /* destination process */
-int dst_seg; /* destination memory segment */
vir_bytes dst_vir; /* destination virtual address */
phys_bytes bytes; /* how many bytes */
{
if (bytes == 0L) return(OK);
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_DST_ENDPT = dst_proc;
- copy_mess.CP_DST_SPACE = dst_seg;
copy_mess.CP_DST_ADDR = (long) dst_vir;
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));
}
int result;
m.CP_SRC_ENDPT = proc_ep;
- m.CP_SRC_SPACE = seg;
+ m.UMAP_SEG = seg;
m.CP_SRC_ADDR = vir_addr;
m.CP_NR_BYTES = bytes;
m.CP_SRC_ENDPT = proc_ep;
m.CP_DST_ENDPT = grantee;
- m.CP_SRC_SPACE = seg;
+ m.UMAP_SEG = seg;
m.CP_SRC_ADDR = vir_addr;
m.CP_NR_BYTES = bytes;
#include "syslib.h"
-int sys_vircopy(src_proc, src_seg, src_vir,
- dst_proc, dst_seg, dst_vir, bytes)
+int sys_vircopy(src_proc, src_vir,
+ dst_proc, dst_vir, bytes)
endpoint_t src_proc; /* source process */
-int src_seg; /* source memory segment */
vir_bytes src_vir; /* source virtual address */
endpoint_t dst_proc; /* destination process */
-int dst_seg; /* destination memory segment */
vir_bytes dst_vir; /* destination virtual address */
phys_bytes bytes; /* how many bytes */
{
if (bytes == 0L) return(OK);
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_DST_ENDPT = dst_proc;
- copy_mess.CP_DST_SPACE = dst_seg;
copy_mess.CP_DST_ADDR = (long) dst_vir;
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));
}
/* Copy an uname string to the user. */
n = strlen(string) + 1;
if (n > m_in.sysuname_len) n = m_in.sysuname_len;
- r = sys_vircopy(SELF, D, (phys_bytes) string,
- mp->mp_endpoint, D, (phys_bytes) m_in.sysuname_value,
+ r = sys_vircopy(SELF, (phys_bytes) string,
+ mp->mp_endpoint, (phys_bytes) m_in.sysuname_value,
(phys_bytes) n);
if (r < 0) return(r);
break;
if (mp->mp_effuid != 0 || len == 0) return(EPERM);
n = len < m_in.sysuname_len ? len : m_in.sysuname_len;
if (n <= 0) return(EINVAL);
- r = sys_vircopy(mp->mp_endpoint, D, (phys_bytes) m_in.sysuname_value,
- SELF, D, (phys_bytes) tmp, (phys_bytes) n);
+ r = sys_vircopy(mp->mp_endpoint, (phys_bytes) m_in.sysuname_value,
+ SELF, (phys_bytes) tmp, (phys_bytes) n);
if (r < 0) return(r);
tmp[n-1] = 0;
strcpy(string, tmp);
{
register struct mproc *child;
struct ptrace_range pr;
- int i, r, seg, req;
+ int i, r, req;
message m;
req = m_in.request;
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);
- seg = (pr.pr_space == TS_INS) ? T : D;
if (req == T_GETRANGE)
- r = sys_vircopy(child->mp_endpoint, seg, (vir_bytes) pr.pr_addr,
- who_e, D, (vir_bytes) pr.pr_ptr,
+ r = sys_vircopy(child->mp_endpoint, (vir_bytes) pr.pr_addr,
+ who_e, (vir_bytes) pr.pr_ptr,
(phys_bytes) pr.pr_size);
else
- r = sys_vircopy(who_e, D, (vir_bytes) pr.pr_ptr,
- child->mp_endpoint, seg, (vir_bytes) pr.pr_addr,
+ r = sys_vircopy(who_e, (vir_bytes) pr.pr_ptr,
+ child->mp_endpoint, (vir_bytes) pr.pr_addr,
(phys_bytes) pr.pr_size);
if (r != OK) return(r);
int r;
if (off+seg_bytes > execi->hdr_len) return ENOEXEC;
- if((r= sys_vircopy(SELF, D, ((vir_bytes)execi->hdr)+off,
- execi->proc_e, D, seg_addr, seg_bytes)) != OK) {
+ if((r= sys_vircopy(SELF, ((vir_bytes)execi->hdr)+off,
+ 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",
seg_bytes, execi->proc_e, seg_addr, r);
}
return EINVAL;
}
- if((r=sys_vircopy(m_ptr->m_source, D, (vir_bytes) m_ptr->RS_NAME,
- SELF, D, (vir_bytes) namebuf, len)) != OK) {
+ if((r=sys_vircopy(m_ptr->m_source, (vir_bytes) m_ptr->RS_NAME,
+ SELF, (vir_bytes) namebuf, len)) != OK) {
printf("RS: name copy failed\n");
return r;
}
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),
- SELF, D, (vir_bytes) buf,
+ SELF, (vir_bytes) buf,
(phys_bytes) CLICK_SIZE);
write_buf(f, (char *) buf, (off + CLICK_SIZE <= (off_t) len) ?
printf("VFS: do_mapdriver: label too long\n");
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) {
printf("VFS: do_mapdriver: sys_vircopy failed: %d\n", r);
return(EINVAL);
old_sb.st_ctime = sb.st_ctime;
#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));
return(r);
/* Did the process set a timeout value? If so, retrieve it. */
if (vtimeout != 0) {
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));
if (r != OK) return(r);
}
src_fds = (direction == FROM_PROC) ? se->vir_readfds : &se->ready_readfds;
dst_fds = (direction == FROM_PROC) ? &se->readfds : 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);
if (r != OK) return(r);
}
src_fds = (direction == FROM_PROC) ? se->vir_writefds : &se->ready_writefds;
dst_fds = (direction == FROM_PROC) ? &se->writefds : 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);
if (r != OK) return(r);
}
src_fds = (direction == FROM_PROC) ? se->vir_errorfds : &se->ready_errorfds;
dst_fds = (direction == FROM_PROC) ? &se->errorfds : 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);
if (r != OK) return(r);
}