Server/driver protocols: no longer allow third-party copies.

Before safecopies, the IO_ENDPT and DL_ENDPT message fields were needed
to know which actual process to copy data from/to, as that process may
not always be the caller. Now that we have full safecopy support, these
fields have become useless for that purpose: the owner of the grant is
*always* the caller. Allowing the caller to supply another endpoint is
in fact dangerous, because the callee may then end up using a grant
from a third party. One could call this a variant of the confused
deputy problem.

From now on, safecopy calls should always use the caller's endpoint as
grant owner. This fully obsoletes the DL_ENDPT field in the
inet/ethernet protocol. IO_ENDPT has other uses besides identifying the
grant owner though. This patch renames IO_ENDPT to USER_ENDPT, not only
because that is a more fitting name (it should never be used for I/O
after all), but also in order to intentionally break any old system
source code outside the base system. If this patch breaks your code,
fixing it is fairly simple:

- DL_ENDPT should be replaced with m_source;
- IO_ENDPT should be replaced with m_source when used for safecopies;
- IO_ENDPT should be replaced with USER_ENDPT for any other use, e.g.
  when setting REP_ENDPT, matching requests in CANCEL calls, getting
  DEV_SELECT flags, and retrieving of the real user process's endpoint
  in DEV_OPEN.

The changes in this patch are binary backward compatible.
This commit is contained in:
David van Moolenbroek 2011-04-11 17:35:05 +00:00
parent 4e86b0d53f
commit c51cd5fe91
52 changed files with 351 additions and 343 deletions

View file

@ -55,11 +55,11 @@ typedef struct {
int BufLength; int BufLength;
int RevivePending; /* process waiting for this dev? */ int RevivePending; /* process waiting for this dev? */
int ReviveStatus; /* return val when proc unblocked */ int ReviveStatus; /* return val when proc unblocked */
int ReviveProcNr; /* the process to unblock */ endpoint_t ReviveProcNr; /* the process to unblock */
cp_grant_id_t ReviveGrant; /* grant id associated with io */ cp_grant_id_t ReviveGrant; /* grant id associated with io */
void *UserBuf; /* address of user's data buffer */ void *UserBuf; /* address of user's data buffer */
int ReadyToRevive; /* are we ready to revive process?*/ int ReadyToRevive; /* are we ready to revive process?*/
int NotifyProcNr; /* process to send notify to (FS) */ endpoint_t SourceProcNr; /* process to send notify to (FS) */
u32_t FragSize; /* dma fragment size */ u32_t FragSize; /* dma fragment size */
char *DmaBuf; /* the dma buffer; extra space for char *DmaBuf; /* the dma buffer; extra space for
page alignment */ page alignment */

View file

@ -222,7 +222,7 @@
/* Field names for messages to block and character device drivers. */ /* Field names for messages to block and character device drivers. */
#define DEVICE m2_i1 /* major-minor device */ #define DEVICE m2_i1 /* major-minor device */
#define IO_ENDPT m2_i2 /* which (proc/endpoint) wants I/O? */ #define USER_ENDPT m2_i2 /* which endpoint initiated this call? */
#define COUNT m2_i3 /* how many bytes to transfer */ #define COUNT m2_i3 /* how many bytes to transfer */
#define REQUEST m2_i3 /* ioctl request code */ #define REQUEST m2_i3 /* ioctl request code */
#define POSITION m2_l1 /* file offset (low 4 bytes) */ #define POSITION m2_l1 /* file offset (low 4 bytes) */
@ -286,7 +286,7 @@
#define DL_TASK_REPLY (DL_RS_BASE + 2) #define DL_TASK_REPLY (DL_RS_BASE + 2)
/* Field names for data link layer messages. */ /* Field names for data link layer messages. */
#define DL_ENDPT m2_i2 #define DL_ENDPT_LEGACY m2_i2 /* obsolete; will be removed */
#define DL_COUNT m2_i3 #define DL_COUNT m2_i3
#define DL_MODE m2_l1 #define DL_MODE m2_l1
#define DL_FLAGS m2_l1 #define DL_FLAGS m2_l1
@ -454,6 +454,9 @@
#define ABRT_MON_LEN m1_i3 /* length of monitor params */ #define ABRT_MON_LEN m1_i3 /* length of monitor params */
#define ABRT_MON_ADDR m1_p1 /* virtual address of monitor params */ #define ABRT_MON_ADDR m1_p1 /* virtual address of monitor params */
/* Field names for SYS_IOPENABLE. */
#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_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 */

View file

@ -2404,7 +2404,7 @@ PRIVATE int ahci_other(struct driver *UNUSED(dp), message *m)
return atapi_load_eject(current_port, 0, FALSE /*load*/); return atapi_load_eject(current_port, 0, FALSE /*load*/);
case DIOCOPENCT: case DIOCOPENCT:
return sys_safecopyto(m->IO_ENDPT, (cp_grant_id_t) m->IO_GRANT, return sys_safecopyto(m->m_source, (cp_grant_id_t) m->IO_GRANT,
0, (vir_bytes) &current_port->open_count, 0, (vir_bytes) &current_port->open_count,
sizeof(current_port->open_count), D); sizeof(current_port->open_count), D);
@ -2418,7 +2418,7 @@ PRIVATE int ahci_other(struct driver *UNUSED(dp), message *m)
if (current_port->state != STATE_GOOD_DEV) if (current_port->state != STATE_GOOD_DEV)
return EIO; return EIO;
if ((r = sys_safecopyfrom(m->IO_ENDPT, if ((r = sys_safecopyfrom(m->m_source,
(cp_grant_id_t) m->IO_GRANT, 0, (vir_bytes) &val, (cp_grant_id_t) m->IO_GRANT, 0, (vir_bytes) &val,
sizeof(val), D)) != OK) sizeof(val), D)) != OK)
return r; return r;
@ -2432,7 +2432,7 @@ PRIVATE int ahci_other(struct driver *UNUSED(dp), message *m)
if ((r = gen_get_wcache(current_port, 0, &val)) != OK) if ((r = gen_get_wcache(current_port, 0, &val)) != OK)
return r; return r;
return sys_safecopyto(m->IO_ENDPT, (cp_grant_id_t) m->IO_GRANT, return sys_safecopyto(m->m_source, (cp_grant_id_t) m->IO_GRANT,
0, (vir_bytes) &val, sizeof(val), D); 0, (vir_bytes) &val, sizeof(val), D);
} }

View file

@ -2303,7 +2303,7 @@ message *m;
return EINVAL; return EINVAL;
if (m->REQUEST == DIOCTIMEOUT) { if (m->REQUEST == DIOCTIMEOUT) {
r= sys_safecopyfrom(m->IO_ENDPT, (cp_grant_id_t) m->IO_GRANT, r= sys_safecopyfrom(m->m_source, (cp_grant_id_t) m->IO_GRANT,
0, (vir_bytes)&timeout, sizeof(timeout), D); 0, (vir_bytes)&timeout, sizeof(timeout), D);
if(r != OK) if(r != OK)
@ -2334,7 +2334,7 @@ message *m;
timeout_usecs = timeout; timeout_usecs = timeout;
} }
r= sys_safecopyto(m->IO_ENDPT, r= sys_safecopyto(m->m_source,
(cp_grant_id_t) m->IO_GRANT, (cp_grant_id_t) m->IO_GRANT,
0, (vir_bytes)&prev, sizeof(prev), D); 0, (vir_bytes)&prev, sizeof(prev), D);
@ -2347,7 +2347,7 @@ message *m;
int count; int count;
if (w_prepare(m->DEVICE) == NULL) return ENXIO; if (w_prepare(m->DEVICE) == NULL) return ENXIO;
count = w_wn->open_ct; count = w_wn->open_ct;
r= sys_safecopyto(m->IO_ENDPT, (cp_grant_id_t) m->IO_GRANT, r= sys_safecopyto(m->m_source, (cp_grant_id_t) m->IO_GRANT,
0, (vir_bytes)&count, sizeof(count), D); 0, (vir_bytes)&count, sizeof(count), D);
if(r != OK) if(r != OK)

View file

@ -791,7 +791,7 @@ PRIVATE void atl2_readv(const message *m, int from_int)
/* Copy in the next batch. */ /* Copy in the next batch. */
batch = MIN(m->DL_COUNT - i, NR_IOREQS); batch = MIN(m->DL_COUNT - i, NR_IOREQS);
r = sys_safecopyfrom(m->DL_ENDPT, m->DL_GRANT, off, r = sys_safecopyfrom(m->m_source, m->DL_GRANT, off,
(vir_bytes) iovec, batch * sizeof(iovec[0]), D); (vir_bytes) iovec, batch * sizeof(iovec[0]), D);
if (r != OK) if (r != OK)
panic("vector copy failed: %d", r); panic("vector copy failed: %d", r);
@ -800,7 +800,7 @@ PRIVATE void atl2_readv(const message *m, int from_int)
for (j = 0, iovp = iovec; j < batch && left > 0; j++, iovp++) { for (j = 0, iovp = iovec; j < batch && left > 0; j++, iovp++) {
size = MIN(iovp->iov_size, left); size = MIN(iovp->iov_size, left);
r = sys_safecopyto(m->DL_ENDPT, iovp->iov_grant, 0, r = sys_safecopyto(m->m_source, iovp->iov_grant, 0,
(vir_bytes) pos, size, D); (vir_bytes) pos, size, D);
if (r != OK) if (r != OK)
panic("safe copy failed: %d", r); panic("safe copy failed: %d", r);
@ -888,7 +888,7 @@ PRIVATE void atl2_writev(const message *m, int from_int)
/* Copy in the next batch. */ /* Copy in the next batch. */
batch = MIN(m->DL_COUNT - i, NR_IOREQS); batch = MIN(m->DL_COUNT - i, NR_IOREQS);
r = sys_safecopyfrom(m->DL_ENDPT, m->DL_GRANT, off, r = sys_safecopyfrom(m->m_source, m->DL_GRANT, off,
(vir_bytes) iovec, batch * sizeof(iovec[0]), D); (vir_bytes) iovec, batch * sizeof(iovec[0]), D);
if (r != OK) if (r != OK)
panic("vector copy failed: %d", r); panic("vector copy failed: %d", r);
@ -902,7 +902,7 @@ PRIVATE void atl2_writev(const message *m, int from_int)
skip = 0; skip = 0;
if (size > ATL2_TXD_BUFSIZE - pos) { if (size > ATL2_TXD_BUFSIZE - pos) {
skip = ATL2_TXD_BUFSIZE - pos; skip = ATL2_TXD_BUFSIZE - pos;
r = sys_safecopyfrom(m->DL_ENDPT, r = sys_safecopyfrom(m->m_source,
iovp->iov_grant, 0, iovp->iov_grant, 0,
(vir_bytes) (state.txd_base + pos), (vir_bytes) (state.txd_base + pos),
skip, D); skip, D);
@ -911,7 +911,7 @@ PRIVATE void atl2_writev(const message *m, int from_int)
pos = 0; pos = 0;
} }
r = sys_safecopyfrom(m->DL_ENDPT, iovp->iov_grant, r = sys_safecopyfrom(m->m_source, iovp->iov_grant,
skip, (vir_bytes) (state.txd_base + pos), skip, (vir_bytes) (state.txd_base + pos),
size - skip, D); size - skip, D);
if (r != OK) if (r != OK)
@ -1062,7 +1062,7 @@ PRIVATE void atl2_getstat(message *m)
*/ */
int r; int r;
sys_safecopyto(m->DL_ENDPT, m->DL_GRANT, 0, sys_safecopyto(m->m_source, m->DL_GRANT, 0,
(vir_bytes) &state.stat, sizeof(state.stat), D); (vir_bytes) &state.stat, sizeof(state.stat), D);
m->m_type = DL_STAT_REPLY; m->m_type = DL_STAT_REPLY;

View file

@ -528,7 +528,7 @@ PRIVATE int w_other(struct driver *UNUSED(dr), message *m)
int count; int count;
if (w_prepare(m->DEVICE) == NULL) return ENXIO; if (w_prepare(m->DEVICE) == NULL) return ENXIO;
count = w_wn->open_ct; count = w_wn->open_ct;
r=sys_safecopyto(m->IO_ENDPT, (cp_grant_id_t)m->IO_GRANT, r=sys_safecopyto(m->m_source, (cp_grant_id_t)m->IO_GRANT,
0, (vir_bytes)&count, sizeof(count), D); 0, (vir_bytes)&count, sizeof(count), D);
if(r != OK) if(r != OK)

View file

@ -176,7 +176,7 @@ PRIVATE void do_get_stat_s(message * mp)
dep = &de_state; dep = &de_state;
if ((rc = sys_safecopyto(mp->DL_ENDPT, mp->DL_GRANT, 0UL, if ((rc = sys_safecopyto(mp->m_source, mp->DL_GRANT, 0UL,
(vir_bytes)&dep->de_stat, (vir_bytes)&dep->de_stat,
sizeof(dep->de_stat), 0)) != OK) sizeof(dep->de_stat), 0)) != OK)
panic(str_CopyErrMsg, rc); panic(str_CopyErrMsg, rc);
@ -474,8 +474,8 @@ PRIVATE void do_vread_s(const message * mp, int from_int)
/* Setup the iovec entry to allow copying into /* Setup the iovec entry to allow copying into
client layer client layer
*/ */
dep->de_read_iovec.iod_proc_nr = mp->DL_ENDPT; dep->de_read_iovec.iod_proc_nr = mp->m_source;
de_get_userdata_s(mp->DL_ENDPT, (cp_grant_id_t) mp->DL_GRANT, 0, de_get_userdata_s(mp->m_source, (cp_grant_id_t) mp->DL_GRANT, 0,
mp->DL_COUNT, dep->de_read_iovec.iod_iovec); mp->DL_COUNT, dep->de_read_iovec.iod_iovec);
dep->de_read_iovec.iod_iovec_s = mp->DL_COUNT; dep->de_read_iovec.iod_iovec_s = mp->DL_COUNT;
dep->de_read_iovec.iod_grant = (cp_grant_id_t) mp->DL_GRANT; dep->de_read_iovec.iod_grant = (cp_grant_id_t) mp->DL_GRANT;
@ -827,8 +827,8 @@ PRIVATE void do_vwrite_s(const message * mp, int from_int){
buffer = descr->buf1; buffer = descr->buf1;
iovp = &dep->de_write_iovec; iovp = &dep->de_write_iovec;
iovp->iod_proc_nr = mp->DL_ENDPT; iovp->iod_proc_nr = mp->m_source;
de_get_userdata_s(mp->DL_ENDPT, mp->DL_GRANT, 0, de_get_userdata_s(mp->m_source, mp->DL_GRANT, 0,
mp->DL_COUNT, iovp->iod_iovec); mp->DL_COUNT, iovp->iod_iovec);
iovp->iod_iovec_s = mp->DL_COUNT; iovp->iod_iovec_s = mp->DL_COUNT;
iovp->iod_grant = (cp_grant_id_t) mp->DL_GRANT; iovp->iod_grant = (cp_grant_id_t) mp->DL_GRANT;

View file

@ -39,7 +39,7 @@ Created: 09/01/2009 Nicolas Tittley (first.last @ gmail DOT com)
typedef struct iovec_dat_s { typedef struct iovec_dat_s {
iovec_s_t iod_iovec[IOVEC_NR]; iovec_s_t iod_iovec[IOVEC_NR];
int iod_iovec_s; int iod_iovec_s;
int iod_proc_nr; endpoint_t iod_proc_nr;
cp_grant_id_t iod_grant; cp_grant_id_t iod_grant;
vir_bytes iod_iovec_offset; vir_bytes iod_iovec_offset;
} iovec_dat_s_t; } iovec_dat_s_t;

View file

@ -408,12 +408,12 @@ int from_int;
} }
assert(!(dep->de_flags & DEF_PACK_SEND)); assert(!(dep->de_flags & DEF_PACK_SEND));
get_userdata_s(mp->DL_ENDPT, mp->DL_GRANT, 0, get_userdata_s(mp->m_source, mp->DL_GRANT, 0,
(count > IOVEC_NR ? IOVEC_NR : count) * (count > IOVEC_NR ? IOVEC_NR : count) *
sizeof(dep->de_write_iovec_s.iod_iovec[0]), sizeof(dep->de_write_iovec_s.iod_iovec[0]),
dep->de_write_iovec_s.iod_iovec); dep->de_write_iovec_s.iod_iovec);
dep->de_write_iovec_s.iod_iovec_s = count; dep->de_write_iovec_s.iod_iovec_s = count;
dep->de_write_iovec_s.iod_proc_nr = mp->DL_ENDPT; dep->de_write_iovec_s.iod_proc_nr = mp->m_source;
dep->de_write_iovec_s.iod_grant = mp->DL_GRANT; dep->de_write_iovec_s.iod_grant = mp->DL_GRANT;
dep->de_write_iovec_s.iod_iovec_offset = 0; dep->de_write_iovec_s.iod_iovec_offset = 0;
@ -481,12 +481,12 @@ message *mp;
if(dep->de_flags & DEF_READING) if(dep->de_flags & DEF_READING)
panic("dp8390: read already in progress"); panic("dp8390: read already in progress");
get_userdata_s(mp->DL_ENDPT, mp->DL_GRANT, 0, get_userdata_s(mp->m_source, mp->DL_GRANT, 0,
(count > IOVEC_NR ? IOVEC_NR : count) * (count > IOVEC_NR ? IOVEC_NR : count) *
sizeof(dep->de_read_iovec_s.iod_iovec[0]), sizeof(dep->de_read_iovec_s.iod_iovec[0]),
dep->de_read_iovec_s.iod_iovec); dep->de_read_iovec_s.iod_iovec);
dep->de_read_iovec_s.iod_iovec_s = count; dep->de_read_iovec_s.iod_iovec_s = count;
dep->de_read_iovec_s.iod_proc_nr = mp->DL_ENDPT; dep->de_read_iovec_s.iod_proc_nr = mp->m_source;
dep->de_read_iovec_s.iod_grant = mp->DL_GRANT; dep->de_read_iovec_s.iod_grant = mp->DL_GRANT;
dep->de_read_iovec_s.iod_iovec_offset = 0; dep->de_read_iovec_s.iod_iovec_offset = 0;
@ -595,7 +595,7 @@ message *mp;
if (dep->de_mode == DEM_SINK) if (dep->de_mode == DEM_SINK)
{ {
put_userdata_s(mp->DL_ENDPT, (vir_bytes) mp->DL_GRANT, put_userdata_s(mp->m_source, (vir_bytes) mp->DL_GRANT,
(vir_bytes) sizeof(dep->de_stat), &dep->de_stat); (vir_bytes) sizeof(dep->de_stat), &dep->de_stat);
mp->m_type= DL_STAT_REPLY; mp->m_type= DL_STAT_REPLY;
@ -611,7 +611,7 @@ message *mp;
dep->de_stat.ets_frameAll += inb_reg0(dep, DP_CNTR1); dep->de_stat.ets_frameAll += inb_reg0(dep, DP_CNTR1);
dep->de_stat.ets_missedP += inb_reg0(dep, DP_CNTR2); dep->de_stat.ets_missedP += inb_reg0(dep, DP_CNTR2);
put_userdata_s(mp->DL_ENDPT, mp->DL_GRANT, put_userdata_s(mp->m_source, mp->DL_GRANT,
sizeof(dep->de_stat), &dep->de_stat); sizeof(dep->de_stat), &dep->de_stat);
mp->m_type= DL_STAT_REPLY; mp->m_type= DL_STAT_REPLY;

View file

@ -203,7 +203,7 @@ typedef struct iovec_dat
{ {
iovec_t iod_iovec[IOVEC_NR]; iovec_t iod_iovec[IOVEC_NR];
int iod_iovec_s; int iod_iovec_s;
int iod_proc_nr; endpoint_t iod_proc_nr;
vir_bytes iod_iovec_addr; vir_bytes iod_iovec_addr;
} iovec_dat_t; } iovec_dat_t;

View file

@ -361,8 +361,8 @@ static void do_vwrite_s(const message * mp)
if (dep->de_flags & DEF_SENDING) /* Is sending in progress? */ if (dep->de_flags & DEF_SENDING) /* Is sending in progress? */
panic("send already in progress "); panic("send already in progress ");
dep->de_write_iovec.iod_proc_nr = mp->DL_ENDPT; dep->de_write_iovec.iod_proc_nr = mp->m_source;
get_userdata_s(mp->DL_ENDPT, mp->DL_GRANT, 0, get_userdata_s(mp->m_source, mp->DL_GRANT, 0,
mp->DL_COUNT, dep->de_write_iovec.iod_iovec); mp->DL_COUNT, dep->de_write_iovec.iod_iovec);
dep->de_write_iovec.iod_iovec_s = mp->DL_COUNT; dep->de_write_iovec.iod_iovec_s = mp->DL_COUNT;
dep->de_write_iovec.iod_grant = (cp_grant_id_t) mp->DL_GRANT; dep->de_write_iovec.iod_grant = (cp_grant_id_t) mp->DL_GRANT;
@ -399,8 +399,8 @@ static void do_vread_s(const message * mp)
if (dep->de_flags & DEF_READING) /* Reading in progress */ if (dep->de_flags & DEF_READING) /* Reading in progress */
panic("read already in progress"); panic("read already in progress");
dep->de_read_iovec.iod_proc_nr = mp->DL_ENDPT; dep->de_read_iovec.iod_proc_nr = mp->m_source;
get_userdata_s(mp->DL_ENDPT, (cp_grant_id_t) mp->DL_GRANT, 0, get_userdata_s(mp->m_source, (cp_grant_id_t) mp->DL_GRANT, 0,
mp->DL_COUNT, dep->de_read_iovec.iod_iovec); mp->DL_COUNT, dep->de_read_iovec.iod_iovec);
dep->de_read_iovec.iod_iovec_s = mp->DL_COUNT; dep->de_read_iovec.iod_iovec_s = mp->DL_COUNT;
dep->de_read_iovec.iod_grant = (cp_grant_id_t) mp->DL_GRANT; dep->de_read_iovec.iod_grant = (cp_grant_id_t) mp->DL_GRANT;
@ -434,7 +434,7 @@ static void do_getstat_s(const message * mp)
dep = &de_state; dep = &de_state;
if (dep->de_mode == DEM_ENABLED) (*dep->de_getstatsf) (dep); if (dep->de_mode == DEM_ENABLED) (*dep->de_getstatsf) (dep);
if ((rc = sys_safecopyto(mp->DL_ENDPT, mp->DL_GRANT, 0, if ((rc = sys_safecopyto(mp->m_source, mp->DL_GRANT, 0,
(vir_bytes)&dep->de_stat, (vir_bytes)&dep->de_stat,
(vir_bytes) sizeof(dep->de_stat), 0)) != OK) (vir_bytes) sizeof(dep->de_stat), 0)) != OK)
panic(CopyErrMsg, rc); panic(CopyErrMsg, rc);

View file

@ -86,7 +86,7 @@ typedef void (*dp_getblock_t) (struct dpeth *, u16_t, int, void *);
typedef struct iovec_dat_s { typedef struct iovec_dat_s {
iovec_s_t iod_iovec[IOVEC_NR]; iovec_s_t iod_iovec[IOVEC_NR];
int iod_iovec_s; int iod_iovec_s;
int iod_proc_nr; endpoint_t iod_proc_nr;
cp_grant_id_t iod_grant; cp_grant_id_t iod_grant;
vir_bytes iod_iovec_offset; vir_bytes iod_iovec_offset;
} iovec_dat_s_t; } iovec_dat_s_t;

View file

@ -624,7 +624,7 @@ int from_int;
/* /*
* Copy the I/O vector table. * Copy the I/O vector table.
*/ */
if ((r = sys_safecopyfrom(e->tx_message.DL_ENDPT, if ((r = sys_safecopyfrom(e->tx_message.m_source,
e->tx_message.DL_GRANT, 0, e->tx_message.DL_GRANT, 0,
(vir_bytes) iovec, e->tx_message.DL_COUNT * (vir_bytes) iovec, e->tx_message.DL_COUNT *
sizeof(iovec_s_t), D)) != OK) sizeof(iovec_s_t), D)) != OK)
@ -648,7 +648,7 @@ int from_int;
E1000_DEBUG(4, ("iovec[%d] = %d\n", i, size)); E1000_DEBUG(4, ("iovec[%d] = %d\n", i, size));
/* Copy bytes to TX queue buffers. */ /* Copy bytes to TX queue buffers. */
if ((r = sys_safecopyfrom(e->tx_message.DL_ENDPT, if ((r = sys_safecopyfrom(e->tx_message.m_source,
iovec[i].iov_grant, 0, iovec[i].iov_grant, 0,
(vir_bytes) e->tx_buffer + (vir_bytes) e->tx_buffer +
(tail * E1000_IOBUF_SIZE), (tail * E1000_IOBUF_SIZE),
@ -715,7 +715,7 @@ int from_int;
/* /*
* Copy the I/O vector table first. * Copy the I/O vector table first.
*/ */
if ((r = sys_safecopyfrom(e->rx_message.DL_ENDPT, if ((r = sys_safecopyfrom(e->rx_message.m_source,
e->rx_message.DL_GRANT, 0, e->rx_message.DL_GRANT, 0,
(vir_bytes) iovec, e->rx_message.DL_COUNT * (vir_bytes) iovec, e->rx_message.DL_COUNT *
sizeof(iovec_s_t), D)) != OK) sizeof(iovec_s_t), D)) != OK)
@ -750,7 +750,7 @@ int from_int;
E1000_DEBUG(4, ("iovec[%d] = %lu[%d]\n", E1000_DEBUG(4, ("iovec[%d] = %lu[%d]\n",
i, iovec[i].iov_size, size)); i, iovec[i].iov_size, size));
if ((r = sys_safecopyto(e->rx_message.DL_ENDPT, iovec[i].iov_grant, if ((r = sys_safecopyto(e->rx_message.m_source, iovec[i].iov_grant,
0, (vir_bytes) e->rx_buffer + bytes + 0, (vir_bytes) e->rx_buffer + bytes +
(cur * E1000_IOBUF_SIZE), (cur * E1000_IOBUF_SIZE),
size, D)) != OK) size, D)) != OK)
@ -802,7 +802,7 @@ message *mp;
stats.ets_CDheartbeat = 0; stats.ets_CDheartbeat = 0;
stats.ets_OWC = 0; stats.ets_OWC = 0;
sys_safecopyto(mp->DL_ENDPT, mp->DL_GRANT, 0, (vir_bytes)&stats, sys_safecopyto(mp->m_source, mp->DL_GRANT, 0, (vir_bytes)&stats,
sizeof(stats), D); sizeof(stats), D);
mp->m_type = DL_STAT_REPLY; mp->m_type = DL_STAT_REPLY;
if((r=send(mp->m_source, mp)) != OK) if((r=send(mp->m_source, mp)) != OK)

View file

@ -31,7 +31,7 @@ static int driver_open(int which)
msg.m_type = DEV_OPEN; msg.m_type = DEV_OPEN;
msg.DEVICE = driver[which].minor; msg.DEVICE = driver[which].minor;
msg.IO_ENDPT = self_ep; msg.USER_ENDPT = self_ep;
r = sendrec(driver[which].endpt, &msg); r = sendrec(driver[which].endpt, &msg);
if (r != OK) { if (r != OK) {
@ -57,7 +57,7 @@ static int driver_open(int which)
msg.m_type = DEV_IOCTL_S; msg.m_type = DEV_IOCTL_S;
msg.REQUEST = DIOCGETP; msg.REQUEST = DIOCGETP;
msg.DEVICE = driver[which].minor; msg.DEVICE = driver[which].minor;
msg.IO_ENDPT = self_ep; msg.USER_ENDPT = self_ep;
msg.IO_GRANT = (char *) gid; msg.IO_GRANT = (char *) gid;
r = sendrec(driver[which].endpt, &msg); r = sendrec(driver[which].endpt, &msg);
@ -107,7 +107,7 @@ static int driver_close(int which)
msg.m_type = DEV_CLOSE; msg.m_type = DEV_CLOSE;
msg.DEVICE = driver[which].minor; msg.DEVICE = driver[which].minor;
msg.IO_ENDPT = self_ep; msg.USER_ENDPT = self_ep;
r = sendrec(driver[which].endpt, &msg); r = sendrec(driver[which].endpt, &msg);
if (r != OK) { if (r != OK) {
@ -521,7 +521,7 @@ static int flt_senda(message *mess, int which)
/* Fill in the last bits of the message. */ /* Fill in the last bits of the message. */
mess->DEVICE = driver[which].minor; mess->DEVICE = driver[which].minor;
mess->IO_ENDPT = self_ep; mess->USER_ENDPT = self_ep;
/* Send the message asynchronously. */ /* Send the message asynchronously. */
amp = &amsgtable[which]; amp = &amsgtable[which];

View file

@ -67,7 +67,7 @@ PRIVATE struct optset optset_table[] = {
/* Request message. */ /* Request message. */
static message m_in; static message m_in;
static endpoint_t who_e; /* m_source */ static endpoint_t who_e; /* m_source */
static endpoint_t proc_e; /* IO_ENDPT */ static endpoint_t proc_e; /* USER_ENDPT */
static cp_grant_id_t grant_id; /* IO_GRANT */ static cp_grant_id_t grant_id; /* IO_GRANT */
/* Data buffers. */ /* Data buffers. */
@ -87,10 +87,10 @@ static int carry(size_t size, int flag_rw)
*/ */
if (flag_rw == FLT_WRITE) if (flag_rw == FLT_WRITE)
return sys_safecopyfrom(proc_e, grant_id, 0, return sys_safecopyfrom(who_e, grant_id, 0,
(vir_bytes) buffer, size, D); (vir_bytes) buffer, size, D);
else else
return sys_safecopyto(proc_e, grant_id, 0, return sys_safecopyto(who_e, grant_id, 0,
(vir_bytes) buffer, size, D); (vir_bytes) buffer, size, D);
} }
@ -110,11 +110,11 @@ static int vcarry(int grants, iovec_t *iov, int flag_rw, size_t size)
bytes = MIN(size, iov[i].iov_size); bytes = MIN(size, iov[i].iov_size);
if (flag_rw == FLT_WRITE) if (flag_rw == FLT_WRITE)
r = sys_safecopyfrom(proc_e, r = sys_safecopyfrom(who_e,
(vir_bytes) iov[i].iov_addr, 0, (vir_bytes) iov[i].iov_addr, 0,
(vir_bytes) bufp, bytes, D); (vir_bytes) bufp, bytes, D);
else else
r = sys_safecopyto(proc_e, r = sys_safecopyto(who_e,
(vir_bytes) iov[i].iov_addr, 0, (vir_bytes) iov[i].iov_addr, 0,
(vir_bytes) bufp, bytes, D); (vir_bytes) bufp, bytes, D);
@ -268,7 +268,7 @@ static int do_ioctl(message *m)
*/ */
sizepart.size = convert(get_raw_size()); sizepart.size = convert(get_raw_size());
if(sys_safecopyto(proc_e, (vir_bytes) grant_id, 0, if(sys_safecopyto(who_e, (vir_bytes) grant_id, 0,
(vir_bytes) &sizepart, (vir_bytes) &sizepart,
sizeof(struct partition), D) != OK) { sizeof(struct partition), D) != OK) {
printf("Filter: DIOCGETP safecopyto failed\n"); printf("Filter: DIOCGETP safecopyto failed\n");
@ -397,7 +397,7 @@ int main(int argc, char *argv[])
} }
who_e = m_in.m_source; who_e = m_in.m_source;
proc_e = m_in.IO_ENDPT; proc_e = m_in.USER_ENDPT;
grant_id = (cp_grant_id_t) m_in.IO_GRANT; grant_id = (cp_grant_id_t) m_in.IO_GRANT;
/* Forword the request message to the drivers. */ /* Forword the request message to the drivers. */

View file

@ -1093,7 +1093,7 @@ static void fxp_writev_s(const message *mp, int from_int)
assert(!(fp->fxp_flags & FF_SEND_AVAIL)); assert(!(fp->fxp_flags & FF_SEND_AVAIL));
assert(!(fp->fxp_flags & FF_PACK_SENT)); assert(!(fp->fxp_flags & FF_PACK_SENT));
iov_endpt= mp->DL_ENDPT; iov_endpt= mp->m_source;
iov_grant= mp->DL_GRANT; iov_grant= mp->DL_GRANT;
size= 0; size= 0;
@ -1228,7 +1228,7 @@ int from_int;
packlen= rfd_res & RFDSZ_SIZE; packlen= rfd_res & RFDSZ_SIZE;
iov_endpt = mp->DL_ENDPT; iov_endpt = mp->m_source;
iov_grant = mp->DL_GRANT; iov_grant = mp->DL_GRANT;
size= 0; size= 0;
@ -1541,7 +1541,7 @@ static void fxp_getstat_s(message *mp)
stats.ets_CDheartbeat= 0; stats.ets_CDheartbeat= 0;
stats.ets_OWC= fp->fxp_stat.sc_tx_latecol; stats.ets_OWC= fp->fxp_stat.sc_tx_latecol;
r= sys_safecopyto(mp->DL_ENDPT, mp->DL_GRANT, 0, (vir_bytes)&stats, r= sys_safecopyto(mp->m_source, mp->DL_GRANT, 0, (vir_bytes)&stats,
sizeof(stats), D); sizeof(stats), D);
if (r != OK) if (r != OK)
panic("fxp_getstat_s: sys_safecopyto failed: %d", r); panic("fxp_getstat_s: sys_safecopyto failed: %d", r);

View file

@ -6,18 +6,18 @@
* *
* The valid messages and their parameters are: * The valid messages and their parameters are:
* *
* m_type DL_ENDPT DL_COUNT DL_MODE DL_GRANT * m_type DL_COUNT DL_MODE DL_GRANT
* |--------------+---------+----------+---------+---------| * |--------------+----------+---------+---------|
* | DL_WRITEV_S | endpt | count | | grant | * | DL_WRITEV_S | count | | grant |
* |--------------|---------|----------|---------|---------| * |--------------|----------|---------|---------|
* | DL_READV_S | endpt | count | | grant | * | DL_READV_S | count | | grant |
* |--------------|---------|----------|---------|---------| * |--------------|----------|---------|---------|
* | DL_CONF | | | mode | | * | DL_CONF | | mode | |
* |--------------|---------|----------|---------|---------| * |--------------|----------|---------|---------|
* | DL_GETSTAT_S | endpt | | | grant | * | DL_GETSTAT_S | | | grant |
* |--------------|---------|----------|---------|---------| * |--------------|----------|---------|---------|
* | hardware int | | | | | * | hardware int | | | |
* |--------------|---------|----------|---------|---------| * |--------------|----------|---------|---------|
* *
* The messages sent are: * The messages sent are:
* *
@ -1023,14 +1023,14 @@ static void do_vread_s(const message *mp)
ec->client= mp->m_source; ec->client= mp->m_source;
count = mp->DL_COUNT; count = mp->DL_COUNT;
r = sys_safecopyfrom(mp->DL_ENDPT, mp->DL_GRANT, 0, r = sys_safecopyfrom(mp->m_source, mp->DL_GRANT, 0,
(vir_bytes)ec->read_iovec.iod_iovec, (vir_bytes)ec->read_iovec.iod_iovec,
(count > IOVEC_NR ? IOVEC_NR : count) * (count > IOVEC_NR ? IOVEC_NR : count) *
sizeof(iovec_s_t), D); sizeof(iovec_s_t), D);
if (r != OK) if (r != OK)
panic("do_vread_s: sys_safecopyfrom failed: %d", r); panic("do_vread_s: sys_safecopyfrom failed: %d", r);
ec->read_iovec.iod_iovec_s = count; ec->read_iovec.iod_iovec_s = count;
ec->read_iovec.iod_proc_nr = mp->DL_ENDPT; ec->read_iovec.iod_proc_nr = mp->m_source;
ec->read_iovec.iod_grant = (cp_grant_id_t) mp->DL_GRANT; ec->read_iovec.iod_grant = (cp_grant_id_t) mp->DL_GRANT;
ec->read_iovec.iod_iovec_offset = 0; ec->read_iovec.iod_iovec_offset = 0;
@ -1141,14 +1141,14 @@ int from_int;
} }
/* convert the message to write_iovec */ /* convert the message to write_iovec */
r = sys_safecopyfrom(mp->DL_ENDPT, mp->DL_GRANT, 0, r = sys_safecopyfrom(mp->m_source, mp->DL_GRANT, 0,
(vir_bytes)ec->write_iovec.iod_iovec, (vir_bytes)ec->write_iovec.iod_iovec,
(count > IOVEC_NR ? IOVEC_NR : count) * (count > IOVEC_NR ? IOVEC_NR : count) *
sizeof(iovec_s_t), D); sizeof(iovec_s_t), D);
if (r != OK) if (r != OK)
panic("do_vwrite_s: sys_safecopyfrom failed: %d", r); panic("do_vwrite_s: sys_safecopyfrom failed: %d", r);
ec->write_iovec.iod_iovec_s = count; ec->write_iovec.iod_iovec_s = count;
ec->write_iovec.iod_proc_nr = mp->DL_ENDPT; ec->write_iovec.iod_proc_nr = mp->m_source;
ec->write_iovec.iod_grant = mp->DL_GRANT; ec->write_iovec.iod_grant = mp->DL_GRANT;
ec->write_iovec.iod_iovec_offset = 0; ec->write_iovec.iod_iovec_offset = 0;
@ -1326,7 +1326,7 @@ message *mp;
ec= &ec_state; ec= &ec_state;
r = sys_safecopyto(mp->DL_ENDPT, mp->DL_GRANT, 0, r = sys_safecopyto(mp->m_source, mp->DL_GRANT, 0,
(vir_bytes)&ec->eth_stat, sizeof(ec->eth_stat), D); (vir_bytes)&ec->eth_stat, sizeof(ec->eth_stat), D);
if (r != OK) if (r != OK)

View file

@ -51,7 +51,7 @@ typedef struct iovec_dat
{ {
iovec_s_t iod_iovec[IOVEC_NR]; iovec_s_t iod_iovec[IOVEC_NR];
int iod_iovec_s; int iod_iovec_s;
int iod_proc_nr; endpoint_t iod_proc_nr;
cp_grant_id_t iod_grant; cp_grant_id_t iod_grant;
vir_bytes iod_iovec_offset; vir_bytes iod_iovec_offset;
} iovec_dat_t; } iovec_dat_t;

View file

@ -18,7 +18,7 @@ PRIVATE void load_state_info(void)
found_pending = FALSE; found_pending = FALSE;
for (i = 0; i < NR_DEVS && !found_pending; i++) { for (i = 0; i < NR_DEVS && !found_pending; i++) {
log = &logdevices[i]; log = &logdevices[i];
if(log->log_proc_nr) { if(log->log_source != NONE) {
is_read_pending = TRUE; is_read_pending = TRUE;
} }
if(log->log_selected) { if(log->log_selected) {

View file

@ -50,7 +50,7 @@ PRIVATE struct driver log_dtab = {
NULL /* HW int */ NULL /* HW int */
}; };
extern int device_caller; extern int device_endpt;
/* SEF functions and variables. */ /* SEF functions and variables. */
FORWARD _PROTOTYPE( void sef_local_startup, (void) ); FORWARD _PROTOTYPE( void sef_local_startup, (void) );
@ -113,7 +113,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
logdevices[i].log_select_alerted = logdevices[i].log_select_alerted =
logdevices[i].log_selected = logdevices[i].log_selected =
logdevices[i].log_select_ready_ops = 0; logdevices[i].log_select_ready_ops = 0;
logdevices[i].log_proc_nr = 0; logdevices[i].log_source = NONE;
logdevices[i].log_revive_alerted = 0; logdevices[i].log_revive_alerted = 0;
} }
@ -189,12 +189,13 @@ subwrite(struct logdevice *log, int count, int proc_nr,
LOGINC(log->log_read, overflow); LOGINC(log->log_read, overflow);
} }
if(log->log_size > 0 && log->log_proc_nr && !log->log_revive_alerted) { if(log->log_size > 0 && log->log_source != NONE &&
!log->log_revive_alerted) {
/* Someone who was suspended on read can now /* Someone who was suspended on read can now
* be revived. * be revived.
*/ */
log->log_status = subread(log, log->log_iosize, log->log_status = subread(log, log->log_iosize,
log->log_proc_nr, log->log_user_grant, log->log_source, log->log_user_grant,
log->log_user_offset); log->log_user_offset);
m.m_type = DEV_REVIVE; m.m_type = DEV_REVIVE;
@ -207,7 +208,7 @@ subwrite(struct logdevice *log, int count, int proc_nr,
printf("log`subwrite: send to %d failed: %d\n", printf("log`subwrite: send to %d failed: %d\n",
log->log_source, r); log->log_source, r);
} }
log->log_proc_nr = 0; log->log_source = NONE;
} }
if(log->log_size > 0) if(log->log_size > 0)
@ -319,7 +320,7 @@ unsigned nr_req; /* length of request vector */
case MINOR_KLOG: case MINOR_KLOG:
if (opcode == DEV_GATHER_S) { if (opcode == DEV_GATHER_S) {
if (log->log_proc_nr || count < 1) { if (log->log_source != NONE || count < 1) {
/* There's already someone hanging to read, or /* There's already someone hanging to read, or
* no real I/O requested. * no real I/O requested.
*/ */
@ -330,14 +331,14 @@ unsigned nr_req; /* length of request vector */
if(accumulated_read) if(accumulated_read)
return OK; return OK;
/* No data available; let caller block. */ /* No data available; let caller block. */
log->log_proc_nr = proc_nr; log->log_source = proc_nr;
log->log_iosize = count; log->log_iosize = count;
log->log_user_grant = grant; log->log_user_grant = grant;
log->log_user_offset = 0; log->log_user_offset = 0;
log->log_revive_alerted = 0; log->log_revive_alerted = 0;
/* Device_caller is a global in drivers library. */ /* device_endpt is a global in drivers library. */
log->log_source = device_caller; log->log_proc_nr = device_endpt;
#if LOG_DEBUG #if LOG_DEBUG
printf("blocked %d (%d)\n", printf("blocked %d (%d)\n",
log->log_source, log->log_proc_nr); log->log_source, log->log_proc_nr);
@ -402,7 +403,7 @@ message *m_ptr;
d = m_ptr->TTY_LINE; d = m_ptr->TTY_LINE;
if(d < 0 || d >= NR_DEVS) if(d < 0 || d >= NR_DEVS)
return EINVAL; return EINVAL;
logdevices[d].log_proc_nr = 0; logdevices[d].log_proc_nr = NONE;
logdevices[d].log_revive_alerted = 0; logdevices[d].log_revive_alerted = 0;
return(OK); return(OK);
} }
@ -452,10 +453,10 @@ message *m_ptr;
return EINVAL; return EINVAL;
} }
ops = m_ptr->IO_ENDPT & (SEL_RD|SEL_WR|SEL_ERR); ops = m_ptr->USER_ENDPT & (SEL_RD|SEL_WR|SEL_ERR);
/* Read blocks when there is no log. */ /* Read blocks when there is no log. */
if((m_ptr->IO_ENDPT & SEL_RD) && logdevices[d].log_size > 0) { if((m_ptr->USER_ENDPT & SEL_RD) && logdevices[d].log_size > 0) {
#if LOG_DEBUG #if LOG_DEBUG
printf("log can read; size %d\n", logdevices[d].log_size); printf("log can read; size %d\n", logdevices[d].log_size);
#endif #endif
@ -463,13 +464,13 @@ message *m_ptr;
} }
/* Write never blocks. */ /* Write never blocks. */
if(m_ptr->IO_ENDPT & SEL_WR) ready_ops |= SEL_WR; if(m_ptr->USER_ENDPT & SEL_WR) ready_ops |= SEL_WR;
/* Enable select calback if no operations were /* Enable select calback if no operations were
* ready to go, but operations were requested, * ready to go, but operations were requested,
* and notify was enabled. * and notify was enabled.
*/ */
if((m_ptr->IO_ENDPT & SEL_NOTIFY) && ops && !ready_ops) { if((m_ptr->USER_ENDPT & SEL_NOTIFY) && ops && !ready_ops) {
logdevices[d].log_selected |= ops; logdevices[d].log_selected |= ops;
logdevices[d].log_select_proc = m_ptr->m_source; logdevices[d].log_select_proc = m_ptr->m_source;
#if LOG_DEBUG #if LOG_DEBUG

View file

@ -18,11 +18,11 @@ struct logdevice {
log_read, /* read mark */ log_read, /* read mark */
log_write; /* write mark */ log_write; /* write mark */
#if SUSPENDABLE #if SUSPENDABLE
int log_proc_nr, endpoint_t log_proc_nr,
log_source, log_source;
log_iosize, int log_iosize,
log_revive_alerted, log_revive_alerted,
log_status; /* proc that is blocking on read */ log_status;
cp_grant_id_t log_user_grant; cp_grant_id_t log_user_grant;
vir_bytes log_user_offset; vir_bytes log_user_offset;
#endif #endif

View file

@ -356,11 +356,11 @@ message *m_ptr;
if (m_prepare(m_ptr->DEVICE) == NULL) return(ENXIO); if (m_prepare(m_ptr->DEVICE) == NULL) return(ENXIO);
if (m_device == MEM_DEV) if (m_device == MEM_DEV)
{ {
r = sys_enable_iop(m_ptr->IO_ENDPT); r = sys_enable_iop(m_ptr->USER_ENDPT);
if (r != OK) if (r != OK)
{ {
printf("m_do_open: sys_enable_iop failed for %d: %d\n", printf("m_do_open: sys_enable_iop failed for %d: %d\n",
m_ptr->IO_ENDPT, r); m_ptr->USER_ENDPT, r);
return r; return r;
} }
} }
@ -449,7 +449,7 @@ message *m_ptr; /* pointer to control message */
if ((dv = m_prepare(dev)) == NULL) return(ENXIO); if ((dv = m_prepare(dev)) == NULL) return(ENXIO);
/* Get request structure */ /* Get request structure */
s= sys_safecopyfrom(m_ptr->IO_ENDPT, (vir_bytes)m_ptr->IO_GRANT, s= sys_safecopyfrom(m_ptr->m_source, (vir_bytes)m_ptr->IO_GRANT,
0, (vir_bytes)&ramdev_size, sizeof(ramdev_size), D); 0, (vir_bytes)&ramdev_size, sizeof(ramdev_size), D);
if (s != OK) if (s != OK)
return s; return s;

View file

@ -1292,7 +1292,7 @@ static void or_writev_s (message * mp, int from_int) {
if (i + n > count) if (i + n > count)
n = count - i; n = count - i;
cps = sys_safecopyfrom(mp->DL_ENDPT, mp->DL_GRANT, iov_offset, cps = sys_safecopyfrom(mp->m_source, mp->DL_GRANT, iov_offset,
(vir_bytes) orp->or_iovec_s, (vir_bytes) orp->or_iovec_s,
n * sizeof(orp->or_iovec_s[0]), D); n * sizeof(orp->or_iovec_s[0]), D);
if (cps != OK) if (cps != OK)
@ -1304,7 +1304,7 @@ static void or_writev_s (message * mp, int from_int) {
printf("Orinoco: invalid pkt size\n"); printf("Orinoco: invalid pkt size\n");
} }
cps = sys_safecopyfrom(mp->DL_ENDPT, iovp->iov_grant, cps = sys_safecopyfrom(mp->m_source, iovp->iov_grant,
0, (vir_bytes) databuf + o, s, D); 0, (vir_bytes) databuf + o, s, D);
if (cps != OK) if (cps != OK)
printf("orinoco: sys_safecopyfrom failed:%d\n", printf("orinoco: sys_safecopyfrom failed:%d\n",
@ -1683,7 +1683,7 @@ static void or_readv_s (message * mp, int from_int)
if (i + n > count) if (i + n > count)
n = count - i; n = count - i;
cps = sys_safecopyfrom(mp->DL_ENDPT, mp->DL_GRANT, iov_offset, cps = sys_safecopyfrom(mp->m_source, mp->DL_GRANT, iov_offset,
(vir_bytes)orp->or_iovec_s, (vir_bytes)orp->or_iovec_s,
n * sizeof(orp->or_iovec_s[0]), D); n * sizeof(orp->or_iovec_s[0]), D);
if (cps != OK) if (cps != OK)
@ -1695,7 +1695,7 @@ static void or_readv_s (message * mp, int from_int)
assert (length > size); assert (length > size);
s = length - size; s = length - size;
} }
cps = sys_safecopyto(mp->DL_ENDPT, iovp->iov_grant, 0, cps = sys_safecopyto(mp->m_source, iovp->iov_grant, 0,
(vir_bytes) databuf + o, s, D); (vir_bytes) databuf + o, s, D);
if (cps != OK) if (cps != OK)
panic("orinoco: warning: sys_safecopy failed: %d", cps); panic("orinoco: warning: sys_safecopy failed: %d", cps);
@ -1862,7 +1862,7 @@ static void or_getstat_s (message * mp) {
stats = orp->or_stat; stats = orp->or_stat;
r = sys_safecopyto(mp->DL_ENDPT, mp->DL_GRANT, 0, r = sys_safecopyto(mp->m_source, mp->DL_GRANT, 0,
(vir_bytes) &stats, sizeof(stats), D); (vir_bytes) &stats, sizeof(stats), D);
if(r != OK) { if(r != OK) {
panic("or_getstat_s: sys_safecopyto failed: %d", r); panic("or_getstat_s: sys_safecopyto failed: %d", r);

View file

@ -14,7 +14,7 @@
* DEV_WRITE: a process wants to write on a terminal * DEV_WRITE: a process wants to write on a terminal
* CANCEL: terminate a previous incomplete system call immediately * CANCEL: terminate a previous incomplete system call immediately
* *
* m_type TTY_LINE IO_ENDPT COUNT ADDRESS * m_type TTY_LINE USER_ENDPT COUNT ADDRESS
* |-------------+---------+---------+---------+---------| * |-------------+---------+---------+---------+---------|
* | DEV_OPEN | | | | | * | DEV_OPEN | | | | |
* |-------------+---------+---------+---------+---------| * |-------------+---------+---------+---------+---------|
@ -86,7 +86,7 @@
* with the sys_outb() messages exchanged. * with the sys_outb() messages exchanged.
*/ */
PRIVATE int caller; /* process to tell when printing done (FS) */ PRIVATE endpoint_t caller; /* process to tell when printing done (FS) */
PRIVATE int revive_pending; /* set to true if revive is pending */ PRIVATE int revive_pending; /* set to true if revive is pending */
PRIVATE int revive_status; /* revive status */ PRIVATE int revive_status; /* revive status */
PRIVATE int done_status; /* status of last output completion */ PRIVATE int done_status; /* status of last output completion */
@ -95,7 +95,7 @@ PRIVATE unsigned char obuf[128]; /* output buffer */
PRIVATE unsigned const char *optr; /* ptr to next char in obuf to print */ PRIVATE unsigned const char *optr; /* ptr to next char in obuf to print */
PRIVATE int orig_count; /* original byte count */ PRIVATE int orig_count; /* original byte count */
PRIVATE int port_base; /* I/O port for printer */ PRIVATE int port_base; /* I/O port for printer */
PRIVATE int proc_nr; /* user requesting the printing */ PRIVATE endpoint_t proc_nr; /* user requesting the printing */
PRIVATE cp_grant_id_t grant_nr; /* grant on which print happens */ PRIVATE cp_grant_id_t grant_nr; /* grant on which print happens */
PRIVATE int user_left; /* bytes of output left in user buf */ PRIVATE int user_left; /* bytes of output left in user buf */
PRIVATE vir_bytes user_vir_d; /* offset in user buf */ PRIVATE vir_bytes user_vir_d; /* offset in user buf */
@ -143,7 +143,7 @@ PUBLIC int main(int argc, char *argv[])
break; break;
default: default:
reply(TASK_REPLY, pr_mess.m_source, reply(TASK_REPLY, pr_mess.m_source,
pr_mess.IO_ENDPT, EINVAL); pr_mess.USER_ENDPT, EINVAL);
} }
continue; continue;
} }
@ -153,13 +153,14 @@ PUBLIC int main(int argc, char *argv[])
do_initialize(); /* initialize */ do_initialize(); /* initialize */
/* fall through */ /* fall through */
case DEV_CLOSE: case DEV_CLOSE:
reply(TASK_REPLY, pr_mess.m_source, pr_mess.IO_ENDPT, OK); reply(TASK_REPLY, pr_mess.m_source, pr_mess.USER_ENDPT, OK);
break; break;
case DEV_WRITE_S: do_write(&pr_mess); break; case DEV_WRITE_S: do_write(&pr_mess); break;
case DEV_STATUS: do_status(&pr_mess); break; case DEV_STATUS: do_status(&pr_mess); break;
case CANCEL: do_cancel(&pr_mess); break; case CANCEL: do_cancel(&pr_mess); break;
default: default:
reply(TASK_REPLY, pr_mess.m_source, pr_mess.IO_ENDPT, EINVAL); reply(TASK_REPLY, pr_mess.m_source, pr_mess.USER_ENDPT,
EINVAL);
} }
} }
} }
@ -217,14 +218,14 @@ register message *m_ptr; /* pointer to the newly arrived message */
else if (m_ptr->COUNT <= 0) r = EINVAL; else if (m_ptr->COUNT <= 0) r = EINVAL;
/* Reply to FS, no matter what happened, possible SUSPEND caller. */ /* Reply to FS, no matter what happened, possible SUSPEND caller. */
reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, r); reply(TASK_REPLY, m_ptr->m_source, m_ptr->USER_ENDPT, r);
/* If no errors occurred, continue printing with SUSPENDED caller. /* If no errors occurred, continue printing with SUSPENDED caller.
* First wait until the printer is online to prevent stupid errors. * First wait until the printer is online to prevent stupid errors.
*/ */
if (SUSPEND == r) { if (SUSPEND == r) {
caller = m_ptr->m_source; caller = m_ptr->m_source;
proc_nr = m_ptr->IO_ENDPT; proc_nr = m_ptr->USER_ENDPT;
user_left = m_ptr->COUNT; user_left = m_ptr->COUNT;
orig_count = m_ptr->COUNT; orig_count = m_ptr->COUNT;
user_vir_d = 0; /* Offset. */ user_vir_d = 0; /* Offset. */
@ -324,12 +325,12 @@ register message *m_ptr; /* pointer to the newly arrived message */
* but rely on FS to handle the EINTR reply and de-suspension properly. * but rely on FS to handle the EINTR reply and de-suspension properly.
*/ */
if (writing && m_ptr->IO_ENDPT == proc_nr) { if (writing && m_ptr->USER_ENDPT == proc_nr) {
oleft = 0; /* cancel output by interrupt handler */ oleft = 0; /* cancel output by interrupt handler */
writing = FALSE; writing = FALSE;
revive_pending = FALSE; revive_pending = FALSE;
} }
reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, EINTR); reply(TASK_REPLY, m_ptr->m_source, m_ptr->USER_ENDPT, EINTR);
} }
/*===========================================================================* /*===========================================================================*
@ -393,7 +394,7 @@ PRIVATE void prepare_output()
if ( (chunk = user_left) > sizeof obuf) chunk = sizeof obuf; if ( (chunk = user_left) > sizeof obuf) chunk = sizeof obuf;
s=sys_safecopyfrom(proc_nr, grant_nr, user_vir_d, (vir_bytes) obuf, s=sys_safecopyfrom(caller, grant_nr, user_vir_d, (vir_bytes) obuf,
chunk, D); chunk, D);
if(s != OK) { if(s != OK) {

View file

@ -963,7 +963,7 @@ static void rl_readv_s(const message *mp, int from_int)
if (i+n > count) if (i+n > count)
n= count-i; n= count-i;
cps = sys_safecopyfrom(mp->DL_ENDPT, mp->DL_GRANT, iov_offset, cps = sys_safecopyfrom(mp->m_source, mp->DL_GRANT, iov_offset,
(vir_bytes) rep->re_iovec_s, (vir_bytes) rep->re_iovec_s,
n * sizeof(rep->re_iovec_s[0]), D); n * sizeof(rep->re_iovec_s[0]), D);
if (cps != OK) { if (cps != OK) {
@ -981,7 +981,7 @@ static void rl_readv_s(const message *mp, int from_int)
} }
#if 0 #if 0
if (sys_umap(mp->DL_ENDPT, D, iovp->iov_addr, s, &dst_phys) != OK) if (sys_umap(mp->m_source, D, iovp->iov_addr, s, &dst_phys) != OK)
panic("umap_local failed"); panic("umap_local failed");
#endif #endif
@ -996,14 +996,14 @@ static void rl_readv_s(const message *mp, int from_int)
assert(o<RX_BUFSIZE); assert(o<RX_BUFSIZE);
s1= RX_BUFSIZE-o; s1= RX_BUFSIZE-o;
cps = sys_safecopyto(mp->DL_ENDPT, cps = sys_safecopyto(mp->m_source,
iovp->iov_grant, 0, iovp->iov_grant, 0,
(vir_bytes) rep->v_re_rx_buf+o, s1, D); (vir_bytes) rep->v_re_rx_buf+o, s1, D);
if (cps != OK) { if (cps != OK) {
panic("rl_readv_s: sys_safecopyto failed: %d", panic("rl_readv_s: sys_safecopyto failed: %d",
cps); cps);
} }
cps = sys_safecopyto(mp->DL_ENDPT, cps = sys_safecopyto(mp->m_source,
iovp->iov_grant, s1, iovp->iov_grant, s1,
(vir_bytes) rep->v_re_rx_buf, s-s1, S); (vir_bytes) rep->v_re_rx_buf, s-s1, S);
if (cps != OK) { if (cps != OK) {
@ -1012,7 +1012,7 @@ static void rl_readv_s(const message *mp, int from_int)
} }
else else
{ {
cps = sys_safecopyto(mp->DL_ENDPT, cps = sys_safecopyto(mp->m_source,
iovp->iov_grant, 0, iovp->iov_grant, 0,
(vir_bytes) rep->v_re_rx_buf+o, s, D); (vir_bytes) rep->v_re_rx_buf+o, s, D);
if (cps != OK) if (cps != OK)
@ -1127,7 +1127,7 @@ static void rl_writev_s(const message *mp, int from_int)
n= IOVEC_NR; n= IOVEC_NR;
if (i+n > count) if (i+n > count)
n= count-i; n= count-i;
cps = sys_safecopyfrom(mp->DL_ENDPT, mp->DL_GRANT, iov_offset, cps = sys_safecopyfrom(mp->m_source, mp->DL_GRANT, iov_offset,
(vir_bytes) rep->re_iovec_s, (vir_bytes) rep->re_iovec_s,
n * sizeof(rep->re_iovec_s[0]), D); n * sizeof(rep->re_iovec_s[0]), D);
if (cps != OK) { if (cps != OK) {
@ -1140,7 +1140,7 @@ static void rl_writev_s(const message *mp, int from_int)
if (size + s > ETH_MAX_PACK_SIZE_TAGGED) { if (size + s > ETH_MAX_PACK_SIZE_TAGGED) {
panic("invalid packet size"); panic("invalid packet size");
} }
cps = sys_safecopyfrom(mp->DL_ENDPT, iovp->iov_grant, cps = sys_safecopyfrom(mp->m_source, iovp->iov_grant,
0, (vir_bytes) ret, s, D); 0, (vir_bytes) ret, s, D);
if (cps != OK) { if (cps != OK) {
panic("rl_writev_s: sys_safecopyfrom failed: %d", cps); panic("rl_writev_s: sys_safecopyfrom failed: %d", cps);
@ -1624,7 +1624,7 @@ message *mp;
stats= rep->re_stat; stats= rep->re_stat;
r = sys_safecopyto(mp->DL_ENDPT, mp->DL_GRANT, 0, r = sys_safecopyto(mp->m_source, mp->DL_GRANT, 0,
(vir_bytes) &stats, sizeof(stats), D); (vir_bytes) &stats, sizeof(stats), D);
if (r != OK) if (r != OK)
panic("rl_getstat_s: sys_safecopyto failed: %d", r); panic("rl_getstat_s: sys_safecopyto failed: %d", r);

View file

@ -1305,7 +1305,7 @@ readvs_loop:
n = IOVEC_NR; n = IOVEC_NR;
if (i + n > count) if (i + n > count)
n = count-i; n = count-i;
cps = sys_safecopyfrom(mp->DL_ENDPT, mp->DL_GRANT, iov_offset, cps = sys_safecopyfrom(mp->m_source, mp->DL_GRANT, iov_offset,
(vir_bytes) rep->re_iovec_s, (vir_bytes) rep->re_iovec_s,
n * sizeof(rep->re_iovec_s[0]), D); n * sizeof(rep->re_iovec_s[0]), D);
if (cps != OK) { if (cps != OK) {
@ -1319,7 +1319,7 @@ readvs_loop:
s = packlen-size; s = packlen-size;
} }
cps = sys_safecopyto(mp->DL_ENDPT, iovp->iov_grant, 0, cps = sys_safecopyto(mp->m_source, iovp->iov_grant, 0,
(vir_bytes) rep->re_rx[index].v_ret_buf + size, s, D); (vir_bytes) rep->re_rx[index].v_ret_buf + size, s, D);
if (cps != OK) if (cps != OK)
panic("rl_readv_s: sys_safecopyto failed: %d", cps); panic("rl_readv_s: sys_safecopyto failed: %d", cps);
@ -1441,7 +1441,7 @@ static void rl_writev_s(const message *mp, int from_int)
n = IOVEC_NR; n = IOVEC_NR;
if (i + n > count) if (i + n > count)
n = count - i; n = count - i;
cps = sys_safecopyfrom(mp->DL_ENDPT, mp->DL_GRANT, iov_offset, cps = sys_safecopyfrom(mp->m_source, mp->DL_GRANT, iov_offset,
(vir_bytes) rep->re_iovec_s, (vir_bytes) rep->re_iovec_s,
n * sizeof(rep->re_iovec_s[0]), D); n * sizeof(rep->re_iovec_s[0]), D);
if (cps != OK) { if (cps != OK) {
@ -1453,7 +1453,7 @@ static void rl_writev_s(const message *mp, int from_int)
if (size + s > ETH_MAX_PACK_SIZE_TAGGED) if (size + s > ETH_MAX_PACK_SIZE_TAGGED)
panic("invalid packet size"); panic("invalid packet size");
cps = sys_safecopyfrom(mp->DL_ENDPT, iovp->iov_grant, cps = sys_safecopyfrom(mp->m_source, iovp->iov_grant,
0, (vir_bytes) ret, s, D); 0, (vir_bytes) ret, s, D);
if (cps != OK) { if (cps != OK) {
panic("rl_writev_s: sys_safecopyfrom failed: %d", cps); panic("rl_writev_s: sys_safecopyfrom failed: %d", cps);
@ -1604,7 +1604,7 @@ message *mp;
stats = rep->re_stat; stats = rep->re_stat;
r = sys_safecopyto(mp->DL_ENDPT, mp->DL_GRANT, 0, r = sys_safecopyto(mp->m_source, mp->DL_GRANT, 0,
(vir_bytes) &stats, sizeof(stats), D); (vir_bytes) &stats, sizeof(stats), D);
if (r != OK) if (r != OK)
panic("rl_getstat_s: sys_safecopyto failed: %d", r); panic("rl_getstat_s: sys_safecopyto failed: %d", r);

View file

@ -171,7 +171,7 @@ int try;
*/ */
do { do {
if (count > sizeof(buf)) count = sizeof(buf); if (count > sizeof(buf)) count = sizeof(buf);
if ((result = sys_safecopyfrom(tp->tty_outproc, tp->tty_outgrant, if ((result = sys_safecopyfrom(tp->tty_outcaller, tp->tty_outgrant,
tp->tty_outoffset, (vir_bytes) buf, count, D)) != OK) tp->tty_outoffset, (vir_bytes) buf, count, D)) != OK)
break; break;
tp->tty_outoffset += count; tp->tty_outoffset += count;
@ -807,27 +807,27 @@ PUBLIC void do_video(message *m)
do_map= (m->REQUEST == TIOCMAPMEM); /* else unmap */ do_map= (m->REQUEST == TIOCMAPMEM); /* else unmap */
r = sys_safecopyfrom(m->IO_ENDPT, r = sys_safecopyfrom(m->m_source,
(cp_grant_id_t) m->IO_GRANT, 0, (cp_grant_id_t) m->IO_GRANT, 0,
(vir_bytes) &mapreqvm, sizeof(mapreqvm), D); (vir_bytes) &mapreqvm, sizeof(mapreqvm), D);
if (r != OK) if (r != OK)
{ {
printf("tty: sys_safecopyfrom failed\n"); printf("tty: sys_safecopyfrom failed\n");
tty_reply(TASK_REPLY, m->m_source, m->IO_ENDPT, tty_reply(TASK_REPLY, m->m_source,
r); m->USER_ENDPT, r);
return; return;
} }
/* In safe ioctl mode, the POSITION field contains /* In safe ioctl mode, the POSITION field contains
* the endpt number of the original requestor. * the endpt number of the original requestor.
* IO_ENDPT is always FS. * USER_ENDPT is always FS.
*/ */
if(do_map) { if(do_map) {
mapreqvm.vaddr_ret = vm_map_phys(m->POSITION, mapreqvm.vaddr_ret = vm_map_phys(m->POSITION,
(void *) mapreqvm.phys_offset, mapreqvm.size); (void *) mapreqvm.phys_offset, mapreqvm.size);
if((r = sys_safecopyto(m->IO_ENDPT, if((r = sys_safecopyto(m->m_source,
(cp_grant_id_t) m->IO_GRANT, 0, (cp_grant_id_t) m->IO_GRANT, 0,
(vir_bytes) &mapreqvm, (vir_bytes) &mapreqvm,
sizeof(mapreqvm), D)) != OK) { sizeof(mapreqvm), D)) != OK) {
@ -837,7 +837,7 @@ PUBLIC void do_video(message *m)
r = vm_unmap_phys(m->POSITION, r = vm_unmap_phys(m->POSITION,
mapreqvm.vaddr, mapreqvm.size); mapreqvm.vaddr, mapreqvm.size);
} }
tty_reply(TASK_REPLY, m->m_source, m->IO_ENDPT, r); tty_reply(TASK_REPLY, m->m_source, m->USER_ENDPT, r);
return; return;
} }
} }
@ -850,7 +850,7 @@ PUBLIC void do_video(message *m)
m->m_type, m->m_source); m->m_type, m->m_source);
r= EINVAL; r= EINVAL;
} }
tty_reply(TASK_REPLY, m->m_source, m->IO_ENDPT, r); tty_reply(TASK_REPLY, m->m_source, m->USER_ENDPT, r);
} }
@ -1201,9 +1201,9 @@ message *m;
if (!machine.vdu_ega) return(ENOTTY); if (!machine.vdu_ega) return(ENOTTY);
result = ga_program(seq1); /* bring font memory into view */ result = ga_program(seq1); /* bring font memory into view */
if(sys_safecopyfrom(m->IO_ENDPT, (cp_grant_id_t) m->IO_GRANT, 0, if(sys_safecopyfrom(m->m_source, (cp_grant_id_t) m->IO_GRANT, 0,
(vir_bytes) font_memory, GA_FONT_SIZE, D) != OK) { (vir_bytes) font_memory, GA_FONT_SIZE, D) != OK) {
printf("tty: copying from %d failed\n", m->IO_ENDPT); printf("tty: copying from %d failed\n", m->m_source);
return EFAULT; return EFAULT;
} }

View file

@ -248,7 +248,7 @@ message *m;
{ {
/* Should record proc */ /* Should record proc */
kbdp->req_size= m->COUNT; kbdp->req_size= m->COUNT;
kbdp->req_proc= m->IO_ENDPT; kbdp->req_proc= m->USER_ENDPT;
kbdp->req_grant= (cp_grant_id_t) m->IO_GRANT; kbdp->req_grant= (cp_grant_id_t) m->IO_GRANT;
kbdp->req_addr_offset= 0; kbdp->req_addr_offset= 0;
kbdp->incaller= m->m_source; kbdp->incaller= m->m_source;
@ -264,7 +264,7 @@ message *m;
n= KBD_BUFSZ-kbdp->offset; n= KBD_BUFSZ-kbdp->offset;
if (n <= 0) if (n <= 0)
panic("do_kbd(READ): bad n: %d", n); panic("do_kbd(READ): bad n: %d", n);
r= sys_safecopyto(m->IO_ENDPT, (cp_grant_id_t) m->IO_GRANT, 0, r= sys_safecopyto(m->m_source, (cp_grant_id_t) m->IO_GRANT, 0,
(vir_bytes) &kbdp->buf[kbdp->offset], n, D); (vir_bytes) &kbdp->buf[kbdp->offset], n, D);
if (r == OK) if (r == OK)
{ {
@ -291,7 +291,7 @@ message *m;
*/ */
for (i= 0; i<m->COUNT; i++) for (i= 0; i<m->COUNT; i++)
{ {
r= sys_safecopyfrom(m->IO_ENDPT, (cp_grant_id_t) r= sys_safecopyfrom(m->m_source, (cp_grant_id_t)
m->IO_GRANT, i, (vir_bytes) &c, 1, D); m->IO_GRANT, i, (vir_bytes) &c, 1, D);
if (r != OK) if (r != OK)
break; break;
@ -305,8 +305,8 @@ message *m;
r= OK; r= OK;
break; break;
case DEV_SELECT: case DEV_SELECT:
ops = m->IO_ENDPT & (SEL_RD|SEL_WR|SEL_ERR); ops = m->USER_ENDPT & (SEL_RD|SEL_WR|SEL_ERR);
watch = (m->IO_ENDPT & SEL_NOTIFY) ? 1 : 0; watch = (m->USER_ENDPT & SEL_NOTIFY) ? 1 : 0;
r= 0; r= 0;
if (kbdp->avail && (ops & SEL_RD)) if (kbdp->avail && (ops & SEL_RD))
@ -328,7 +328,7 @@ message *m;
unsigned char b; unsigned char b;
r= sys_safecopyfrom(m->IO_ENDPT, (cp_grant_id_t) r= sys_safecopyfrom(m->m_source, (cp_grant_id_t)
m->IO_GRANT, 0, (vir_bytes) &leds, m->IO_GRANT, 0, (vir_bytes) &leds,
sizeof(leds), D); sizeof(leds), D);
if (r != OK) if (r != OK)
@ -363,7 +363,7 @@ message *m;
kio_bell_t bell; kio_bell_t bell;
clock_t ticks; clock_t ticks;
r = sys_safecopyfrom(m->IO_ENDPT, (cp_grant_id_t) r = sys_safecopyfrom(m->m_source, (cp_grant_id_t)
m->IO_GRANT, 0, (vir_bytes) &bell, m->IO_GRANT, 0, (vir_bytes) &bell,
sizeof(bell), D); sizeof(bell), D);
if (r != OK) if (r != OK)
@ -386,7 +386,7 @@ message *m;
m->m_type, m->m_source); m->m_type, m->m_source);
r= EINVAL; r= EINVAL;
} }
tty_reply(TASK_REPLY, m->m_source, m->IO_ENDPT, r); tty_reply(TASK_REPLY, m->m_source, m->USER_ENDPT, r);
} }
@ -410,7 +410,7 @@ message *m;
if (n <= 0) if (n <= 0)
panic("kbd_status: bad n: %d", n); panic("kbd_status: bad n: %d", n);
kbdp->req_size= 0; kbdp->req_size= 0;
r= sys_safecopyto(kbdp->req_proc, kbdp->req_grant, 0, r= sys_safecopyto(kbdp->incaller, kbdp->req_grant, 0,
(vir_bytes)&kbdp->buf[kbdp->offset], n, D); (vir_bytes)&kbdp->buf[kbdp->offset], n, D);
if (r == OK) if (r == OK)
{ {
@ -1060,7 +1060,7 @@ PUBLIC int kbd_loadmap(m)
message *m; message *m;
{ {
/* Load a new keymap. */ /* Load a new keymap. */
return sys_safecopyfrom(m->IO_ENDPT, (cp_grant_id_t) m->IO_GRANT, return sys_safecopyfrom(m->m_source, (cp_grant_id_t) m->IO_GRANT,
0, (vir_bytes) keymap, (vir_bytes) sizeof(keymap), D); 0, (vir_bytes) keymap, (vir_bytes) sizeof(keymap), D);
} }

View file

@ -103,7 +103,7 @@ PUBLIC void do_pty(tty_t *tp, message *m_ptr)
} }
pp->rdsendreply = TRUE; pp->rdsendreply = TRUE;
pp->rdcaller = m_ptr->m_source; pp->rdcaller = m_ptr->m_source;
pp->rdproc = m_ptr->IO_ENDPT; pp->rdproc = m_ptr->USER_ENDPT;
pp->rdgrant = (cp_grant_id_t) m_ptr->IO_GRANT; pp->rdgrant = (cp_grant_id_t) m_ptr->IO_GRANT;
pp->rdoffset = 0; pp->rdoffset = 0;
pp->rdleft = m_ptr->COUNT; pp->rdleft = m_ptr->COUNT;
@ -135,7 +135,7 @@ PUBLIC void do_pty(tty_t *tp, message *m_ptr)
} }
pp->wrsendreply = TRUE; pp->wrsendreply = TRUE;
pp->wrcaller = m_ptr->m_source; pp->wrcaller = m_ptr->m_source;
pp->wrproc = m_ptr->IO_ENDPT; pp->wrproc = m_ptr->USER_ENDPT;
pp->wrgrant = (cp_grant_id_t) m_ptr->IO_GRANT; pp->wrgrant = (cp_grant_id_t) m_ptr->IO_GRANT;
pp->wroffset = 0; pp->wroffset = 0;
pp->wrleft = m_ptr->COUNT; pp->wrleft = m_ptr->COUNT;
@ -173,12 +173,12 @@ PUBLIC void do_pty(tty_t *tp, message *m_ptr)
case CANCEL: case CANCEL:
r = EINTR; r = EINTR;
if (m_ptr->IO_ENDPT == pp->rdproc) { if (m_ptr->USER_ENDPT == pp->rdproc) {
/* Cancel a read from a PTY. */ /* Cancel a read from a PTY. */
r = pp->rdcum > 0 ? pp->rdcum : EAGAIN; r = pp->rdcum > 0 ? pp->rdcum : EAGAIN;
pp->rdleft = pp->rdcum = 0; pp->rdleft = pp->rdcum = 0;
} }
if (m_ptr->IO_ENDPT == pp->wrproc) { if (m_ptr->USER_ENDPT == pp->wrproc) {
/* Cancel a write to a PTY. */ /* Cancel a write to a PTY. */
r = pp->wrcum > 0 ? pp->wrcum : EAGAIN; r = pp->wrcum > 0 ? pp->wrcum : EAGAIN;
pp->wrleft = pp->wrcum = 0; pp->wrleft = pp->wrcum = 0;
@ -188,7 +188,7 @@ PUBLIC void do_pty(tty_t *tp, message *m_ptr)
default: default:
r = EINVAL; r = EINVAL;
} }
tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, r); tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->USER_ENDPT, r);
} }
/*===========================================================================* /*===========================================================================*
@ -230,7 +230,7 @@ PRIVATE int pty_write(tty_t *tp, int try)
break; break;
/* Copy from user space to the PTY output buffer. */ /* Copy from user space to the PTY output buffer. */
if ((s = sys_safecopyfrom(tp->tty_outproc, tp->tty_outgrant, if ((s = sys_safecopyfrom(tp->tty_outcaller, tp->tty_outgrant,
tp->tty_outoffset, (vir_bytes) pp->ohead, count, D))!=OK) { tp->tty_outoffset, (vir_bytes) pp->ohead, count, D))!=OK) {
break; break;
} }
@ -307,7 +307,7 @@ PRIVATE void pty_start(pty_t *pp)
if (count == 0) break; if (count == 0) break;
/* Copy from the output buffer to the readers address space. */ /* Copy from the output buffer to the readers address space. */
if((s = sys_safecopyto(pp->rdproc, pp->rdgrant, if((s = sys_safecopyto(pp->rdcaller, pp->rdgrant,
pp->rdoffset, (vir_bytes) pp->otail, count, D)) != OK) { pp->rdoffset, (vir_bytes) pp->otail, count, D)) != OK) {
break; break;
} }
@ -376,7 +376,7 @@ PRIVATE int pty_read(tty_t *tp, int try)
int s; int s;
/* Transfer one character to 'c'. */ /* Transfer one character to 'c'. */
if ((s = sys_safecopyfrom(pp->wrproc, pp->wrgrant, pp->wroffset, if ((s = sys_safecopyfrom(pp->wrcaller, pp->wrgrant, pp->wroffset,
(vir_bytes) &c, 1, D)) != OK) { (vir_bytes) &c, 1, D)) != OK) {
printf("pty: safecopy failed (error %d)\n", s); printf("pty: safecopy failed (error %d)\n", s);
break; break;
@ -587,8 +587,8 @@ PRIVATE int pty_select(tty_t *tp, message *m)
pty_t *pp = tp->tty_priv; pty_t *pp = tp->tty_priv;
int ops, ready_ops = 0, watch; int ops, ready_ops = 0, watch;
ops = m->IO_ENDPT & (SEL_RD|SEL_WR|SEL_ERR); ops = m->USER_ENDPT & (SEL_RD|SEL_WR|SEL_ERR);
watch = (m->IO_ENDPT & SEL_NOTIFY) ? 1 : 0; watch = (m->USER_ENDPT & SEL_NOTIFY) ? 1 : 0;
ready_ops = select_try_pty(tp, ops); ready_ops = select_try_pty(tp, ops);

View file

@ -248,7 +248,7 @@ PRIVATE int rs_write(register tty_t *tp, int try)
if (try) return 1; if (try) return 1;
/* Copy from user space to the RS232 output buffer. */ /* Copy from user space to the RS232 output buffer. */
sys_safecopyfrom(tp->tty_outproc, tp->tty_outgrant, sys_safecopyfrom(tp->tty_outcaller, tp->tty_outgrant,
tp->tty_outoffset, (vir_bytes) rs->ohead, count, D); tp->tty_outoffset, (vir_bytes) rs->ohead, count, D);
/* Perform output processing on the output buffer. */ /* Perform output processing on the output buffer. */

View file

@ -30,7 +30,7 @@
* DEV_STATUS: FS wants to know status for SELECT or REVIVE * DEV_STATUS: FS wants to know status for SELECT or REVIVE
* CANCEL: terminate a previous incomplete system call immediately * CANCEL: terminate a previous incomplete system call immediately
* *
* m_type TTY_LINE IO_ENDPT COUNT TTY_SPEKS IO_GRANT * m_type TTY_LINE USER_ENDPT COUNT TTY_SPEKS IO_GRANT
* ----------------------------------------------------------------- * -----------------------------------------------------------------
* | HARD_INT | | | | | | * | HARD_INT | | | | | |
* |-------------+---------+---------+---------+---------+---------| * |-------------+---------+---------+---------+---------+---------|
@ -263,7 +263,7 @@ PUBLIC int main(void)
if (tty_mess.m_source != LOG_PROC_NR) if (tty_mess.m_source != LOG_PROC_NR)
{ {
tty_reply(TASK_REPLY, tty_mess.m_source, tty_reply(TASK_REPLY, tty_mess.m_source,
tty_mess.IO_ENDPT, ENXIO); tty_mess.USER_ENDPT, ENXIO);
} }
continue; continue;
} }
@ -281,7 +281,7 @@ PUBLIC int main(void)
printf("Warning, TTY got unexpected request %d from %d\n", printf("Warning, TTY got unexpected request %d from %d\n",
tty_mess.m_type, tty_mess.m_source); tty_mess.m_type, tty_mess.m_source);
tty_reply(TASK_REPLY, tty_mess.m_source, tty_reply(TASK_REPLY, tty_mess.m_source,
tty_mess.IO_ENDPT, EINVAL); tty_mess.USER_ENDPT, EINVAL);
} }
} }
@ -455,7 +455,7 @@ register message *m_ptr; /* pointer to message sent to the task */
/* Copy information from the message to the tty struct. */ /* Copy information from the message to the tty struct. */
tp->tty_inrepcode = TASK_REPLY; tp->tty_inrepcode = TASK_REPLY;
tp->tty_incaller = m_ptr->m_source; tp->tty_incaller = m_ptr->m_source;
tp->tty_inproc = m_ptr->IO_ENDPT; tp->tty_inproc = m_ptr->USER_ENDPT;
tp->tty_ingrant = (cp_grant_id_t) m_ptr->IO_GRANT; tp->tty_ingrant = (cp_grant_id_t) m_ptr->IO_GRANT;
tp->tty_inoffset = 0; tp->tty_inoffset = 0;
tp->tty_inleft = m_ptr->COUNT; tp->tty_inleft = m_ptr->COUNT;
@ -495,7 +495,7 @@ register message *m_ptr; /* pointer to message sent to the task */
r = SUSPEND; /* suspend the caller */ r = SUSPEND; /* suspend the caller */
tp->tty_inrepcode = TTY_REVIVE; tp->tty_inrepcode = TTY_REVIVE;
} }
tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, r); tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->USER_ENDPT, r);
if (tp->tty_select_ops) if (tp->tty_select_ops)
select_retry(tp); select_retry(tp);
} }
@ -522,7 +522,7 @@ register message *m_ptr; /* pointer to message sent to the task */
/* Copy message parameters to the tty structure. */ /* Copy message parameters to the tty structure. */
tp->tty_outrepcode = TASK_REPLY; tp->tty_outrepcode = TASK_REPLY;
tp->tty_outcaller = m_ptr->m_source; tp->tty_outcaller = m_ptr->m_source;
tp->tty_outproc = m_ptr->IO_ENDPT; tp->tty_outproc = m_ptr->USER_ENDPT;
tp->tty_outgrant = (cp_grant_id_t) m_ptr->IO_GRANT; tp->tty_outgrant = (cp_grant_id_t) m_ptr->IO_GRANT;
tp->tty_outoffset = 0; tp->tty_outoffset = 0;
tp->tty_outleft = m_ptr->COUNT; tp->tty_outleft = m_ptr->COUNT;
@ -538,7 +538,7 @@ register message *m_ptr; /* pointer to message sent to the task */
r = SUSPEND; /* suspend the caller */ r = SUSPEND; /* suspend the caller */
tp->tty_outrepcode = TTY_REVIVE; tp->tty_outrepcode = TTY_REVIVE;
} }
tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, r); tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->USER_ENDPT, r);
} }
/*===========================================================================* /*===========================================================================*
@ -598,7 +598,7 @@ message *m_ptr; /* pointer to message sent to task */
switch (m_ptr->TTY_REQUEST) { switch (m_ptr->TTY_REQUEST) {
case TCGETS: case TCGETS:
/* Get the termios attributes. */ /* Get the termios attributes. */
r = sys_safecopyto(m_ptr->IO_ENDPT, (cp_grant_id_t) m_ptr->IO_GRANT, 0, r = sys_safecopyto(m_ptr->m_source, (cp_grant_id_t) m_ptr->IO_GRANT, 0,
(vir_bytes) &tp->tty_termios, (vir_bytes) size, D); (vir_bytes) &tp->tty_termios, (vir_bytes) size, D);
break; break;
@ -608,7 +608,7 @@ message *m_ptr; /* pointer to message sent to task */
if (tp->tty_outleft > 0) { if (tp->tty_outleft > 0) {
/* Wait for all ongoing output processing to finish. */ /* Wait for all ongoing output processing to finish. */
tp->tty_iocaller = m_ptr->m_source; tp->tty_iocaller = m_ptr->m_source;
tp->tty_ioproc = m_ptr->IO_ENDPT; tp->tty_ioproc = m_ptr->USER_ENDPT;
tp->tty_ioreq = m_ptr->REQUEST; tp->tty_ioreq = m_ptr->REQUEST;
tp->tty_iogrant = (cp_grant_id_t) m_ptr->IO_GRANT; tp->tty_iogrant = (cp_grant_id_t) m_ptr->IO_GRANT;
r = SUSPEND; r = SUSPEND;
@ -619,14 +619,14 @@ message *m_ptr; /* pointer to message sent to task */
/*FALL THROUGH*/ /*FALL THROUGH*/
case TCSETS: case TCSETS:
/* Set the termios attributes. */ /* Set the termios attributes. */
r = sys_safecopyfrom(m_ptr->IO_ENDPT, (cp_grant_id_t) m_ptr->IO_GRANT, r = sys_safecopyfrom(m_ptr->m_source, (cp_grant_id_t) m_ptr->IO_GRANT,
0, (vir_bytes) &tp->tty_termios, (vir_bytes) size, D); 0, (vir_bytes) &tp->tty_termios, (vir_bytes) size, D);
if (r != OK) break; if (r != OK) break;
setattr(tp); setattr(tp);
break; break;
case TCFLSH: case TCFLSH:
r = sys_safecopyfrom(m_ptr->IO_ENDPT, (cp_grant_id_t) m_ptr->IO_GRANT, r = sys_safecopyfrom(m_ptr->m_source, (cp_grant_id_t) m_ptr->IO_GRANT,
0, (vir_bytes) &param.i, (vir_bytes) size, D); 0, (vir_bytes) &param.i, (vir_bytes) size, D);
if (r != OK) break; if (r != OK) break;
switch (param.i) { switch (param.i) {
@ -638,7 +638,7 @@ message *m_ptr; /* pointer to message sent to task */
break; break;
case TCFLOW: case TCFLOW:
r = sys_safecopyfrom(m_ptr->IO_ENDPT, (cp_grant_id_t) m_ptr->IO_GRANT, r = sys_safecopyfrom(m_ptr->m_source, (cp_grant_id_t) m_ptr->IO_GRANT,
0, (vir_bytes) &param.i, (vir_bytes) size, D); 0, (vir_bytes) &param.i, (vir_bytes) size, D);
if (r != OK) break; if (r != OK) break;
switch (param.i) { switch (param.i) {
@ -663,12 +663,12 @@ message *m_ptr; /* pointer to message sent to task */
break; break;
case TIOCGWINSZ: case TIOCGWINSZ:
r = sys_safecopyto(m_ptr->IO_ENDPT, (cp_grant_id_t) m_ptr->IO_GRANT, 0, r = sys_safecopyto(m_ptr->m_source, (cp_grant_id_t) m_ptr->IO_GRANT, 0,
(vir_bytes) &tp->tty_winsize, (vir_bytes) size, D); (vir_bytes) &tp->tty_winsize, (vir_bytes) size, D);
break; break;
case TIOCSWINSZ: case TIOCSWINSZ:
r = sys_safecopyfrom(m_ptr->IO_ENDPT, (cp_grant_id_t) m_ptr->IO_GRANT, r = sys_safecopyfrom(m_ptr->m_source, (cp_grant_id_t) m_ptr->IO_GRANT,
0, (vir_bytes) &tp->tty_winsize, (vir_bytes) size, D); 0, (vir_bytes) &tp->tty_winsize, (vir_bytes) size, D);
sigchar(tp, SIGWINCH, 0); sigchar(tp, SIGWINCH, 0);
break; break;
@ -698,7 +698,7 @@ message *m_ptr; /* pointer to message sent to task */
} }
/* Send the reply. */ /* Send the reply. */
tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, r); tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->USER_ENDPT, r);
} }
/*===========================================================================* /*===========================================================================*
@ -719,12 +719,12 @@ message *m_ptr; /* pointer to message sent to task */
if (m_ptr->COUNT & R_BIT) r = EACCES; if (m_ptr->COUNT & R_BIT) r = EACCES;
} else { } else {
if (!(m_ptr->COUNT & O_NOCTTY)) { if (!(m_ptr->COUNT & O_NOCTTY)) {
tp->tty_pgrp = m_ptr->IO_ENDPT; tp->tty_pgrp = m_ptr->USER_ENDPT;
r = 1; r = 1;
} }
tp->tty_openct++; tp->tty_openct++;
} }
tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, r); tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->USER_ENDPT, r);
} }
/*===========================================================================* /*===========================================================================*
@ -745,7 +745,7 @@ message *m_ptr; /* pointer to message sent to task */
tp->tty_winsize = winsize_defaults; tp->tty_winsize = winsize_defaults;
setattr(tp); setattr(tp);
} }
tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, OK); tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->USER_ENDPT, OK);
} }
/*===========================================================================* /*===========================================================================*
@ -764,7 +764,7 @@ message *m_ptr; /* pointer to message sent to task */
int r = EINTR; int r = EINTR;
/* Check the parameters carefully, to avoid cancelling twice. */ /* Check the parameters carefully, to avoid cancelling twice. */
proc_nr = m_ptr->IO_ENDPT; proc_nr = m_ptr->USER_ENDPT;
mode = m_ptr->COUNT; mode = m_ptr->COUNT;
if ((mode & R_BIT) && tp->tty_inleft != 0 && proc_nr == tp->tty_inproc && if ((mode & R_BIT) && tp->tty_inleft != 0 && proc_nr == tp->tty_inproc &&
tp->tty_ingrant == (cp_grant_id_t) m_ptr->IO_GRANT) { tp->tty_ingrant == (cp_grant_id_t) m_ptr->IO_GRANT) {
@ -913,7 +913,7 @@ register tty_t *tp; /* pointer to terminal to read from */
tp->tty_inleft--; tp->tty_inleft--;
if (++bp == bufend(buf)) { if (++bp == bufend(buf)) {
/* Temp buffer full, copy to user space. */ /* Temp buffer full, copy to user space. */
sys_safecopyto(tp->tty_inproc, sys_safecopyto(tp->tty_incaller,
tp->tty_ingrant, tp->tty_inoffset, tp->tty_ingrant, tp->tty_inoffset,
(vir_bytes) buf, (vir_bytes) buf,
(vir_bytes) buflen(buf), D); (vir_bytes) buflen(buf), D);
@ -937,7 +937,7 @@ register tty_t *tp; /* pointer to terminal to read from */
if (bp > buf) { if (bp > buf) {
/* Leftover characters in the buffer. */ /* Leftover characters in the buffer. */
count = bp - buf; count = bp - buf;
sys_safecopyto(tp->tty_inproc, sys_safecopyto(tp->tty_incaller,
tp->tty_ingrant, tp->tty_inoffset, tp->tty_ingrant, tp->tty_inoffset,
(vir_bytes) buf, (vir_bytes) count, D); (vir_bytes) buf, (vir_bytes) count, D);
tp->tty_inoffset += count; tp->tty_inoffset += count;
@ -1377,7 +1377,7 @@ tty_t *tp;
if (tp->tty_ioreq != TCDRAIN) { if (tp->tty_ioreq != TCDRAIN) {
if (tp->tty_ioreq == TCSETSF) tty_icancel(tp); if (tp->tty_ioreq == TCSETSF) tty_icancel(tp);
result = sys_safecopyfrom(tp->tty_ioproc, tp->tty_iogrant, 0, result = sys_safecopyfrom(tp->tty_iocaller, tp->tty_iogrant, 0,
(vir_bytes) &tp->tty_termios, (vir_bytes) &tp->tty_termios,
(vir_bytes) sizeof(tp->tty_termios), D); (vir_bytes) sizeof(tp->tty_termios), D);
if (result == OK) setattr(tp); if (result == OK) setattr(tp);
@ -1614,8 +1614,8 @@ register message *m_ptr; /* pointer to message sent to the task */
{ {
int ops, ready_ops = 0, watch; int ops, ready_ops = 0, watch;
ops = m_ptr->IO_ENDPT & (SEL_RD|SEL_WR|SEL_ERR); ops = m_ptr->USER_ENDPT & (SEL_RD|SEL_WR|SEL_ERR);
watch = (m_ptr->IO_ENDPT & SEL_NOTIFY) ? 1 : 0; watch = (m_ptr->USER_ENDPT & SEL_NOTIFY) ? 1 : 0;
ready_ops = select_try(tp, ops); ready_ops = select_try(tp, ops);
@ -1624,7 +1624,7 @@ register message *m_ptr; /* pointer to message sent to the task */
tp->tty_select_proc = m_ptr->m_source; tp->tty_select_proc = m_ptr->m_source;
} }
tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, ready_ops); tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->USER_ENDPT, ready_ops);
return; return;
} }

View file

@ -58,36 +58,36 @@ typedef struct tty {
char tty_reprint; /* 1 when echoed input messed up, else 0 */ char tty_reprint; /* 1 when echoed input messed up, else 0 */
char tty_escaped; /* 1 when LNEXT (^V) just seen, else 0 */ char tty_escaped; /* 1 when LNEXT (^V) just seen, else 0 */
char tty_inhibited; /* 1 when STOP (^S) just seen (stops output) */ char tty_inhibited; /* 1 when STOP (^S) just seen (stops output) */
int tty_pgrp; /* slot number of controlling process */ endpoint_t tty_pgrp; /* endpoint of controlling process */
char tty_openct; /* count of number of opens of this tty */ char tty_openct; /* count of number of opens of this tty */
/* Information about incomplete I/O requests is stored here. */ /* Information about incomplete I/O requests is stored here. */
int tty_inrepcode; /* reply code, TASK_REPLY or REVIVE */ int tty_inrepcode; /* reply code, TASK_REPLY or REVIVE */
char tty_inrevived; /* set to 1 if revive callback is pending */ char tty_inrevived; /* set to 1 if revive callback is pending */
int tty_incaller; /* process that made the call (usually FS) */ endpoint_t tty_incaller; /* process that made the call (usually VFS) */
int tty_inproc; /* process that wants to read from tty */ endpoint_t tty_inproc; /* process that wants to read from tty */
cp_grant_id_t tty_ingrant; /* grant where data is to go */ cp_grant_id_t tty_ingrant; /* grant where data is to go */
vir_bytes tty_inoffset; /* offset into grant */ vir_bytes tty_inoffset; /* offset into grant */
int tty_inleft; /* how many chars are still needed */ int tty_inleft; /* how many chars are still needed */
int tty_incum; /* # chars input so far */ int tty_incum; /* # chars input so far */
int tty_outrepcode; /* reply code, TASK_REPLY or REVIVE */ int tty_outrepcode; /* reply code, TASK_REPLY or REVIVE */
int tty_outrevived; /* set to 1 if revive callback is pending */ int tty_outrevived; /* set to 1 if revive callback is pending */
int tty_outcaller; /* process that made the call (usually FS) */ endpoint_t tty_outcaller; /* process that made the call (usually VFS) */
int tty_outproc; /* process that wants to write to tty */ endpoint_t tty_outproc; /* process that wants to write to tty */
cp_grant_id_t tty_outgrant; /* grant where data comes from */ cp_grant_id_t tty_outgrant; /* grant where data comes from */
vir_bytes tty_outoffset; /* offset into grant */ vir_bytes tty_outoffset; /* offset into grant */
int tty_outleft; /* # chars yet to be output */ int tty_outleft; /* # chars yet to be output */
int tty_outcum; /* # chars output so far */ int tty_outcum; /* # chars output so far */
int tty_iocaller; /* process that made the call (usually FS) */ endpoint_t tty_iocaller; /* process that made the call (usually VFS) */
int tty_iorevived; /* set to 1 if revive callback is pending */ int tty_iorevived; /* set to 1 if revive callback is pending */
int tty_ioproc; /* process that wants to do an ioctl */ endpoint_t tty_ioproc; /* process that wants to do an ioctl */
int tty_iostatus; /* result */ int tty_iostatus; /* result */
int tty_ioreq; /* ioctl request code */ int tty_ioreq; /* ioctl request code */
cp_grant_id_t tty_iogrant; /* virtual address of ioctl buffer or grant */ cp_grant_id_t tty_iogrant; /* virtual address of ioctl buffer or grant */
/* select() data */ /* select() data */
int tty_select_ops; /* which operations are interesting */ int tty_select_ops; /* which operations are interesting */
int tty_select_proc; /* which process wants notification */ endpoint_t tty_select_proc; /* which process wants notification */
/* Miscellaneous. */ /* Miscellaneous. */
devfun_t tty_ioctl; /* set line speed, etc. at the device level */ devfun_t tty_ioctl; /* set line speed, etc. at the device level */

View file

@ -2,7 +2,7 @@
* m_type: SYS_IOPENABLE * m_type: SYS_IOPENABLE
* *
* The parameters for this system call are: * The parameters for this system call are:
* m2_i2: IO_ENDPT (process to give I/O Protection Level bits) * m2_i2: IOP_ENDPT (process to give I/O Protection Level bits)
* *
* Author: * Author:
* Jorrit N. Herder <jnherder@cs.vu.nl> * Jorrit N. Herder <jnherder@cs.vu.nl>
@ -22,9 +22,9 @@ PUBLIC int do_iopenable(struct proc * caller, message * m_ptr)
int proc_nr; int proc_nr;
#if 1 /* ENABLE_USERPRIV && ENABLE_USERIOPL */ #if 1 /* ENABLE_USERPRIV && ENABLE_USERIOPL */
if (m_ptr->IO_ENDPT == SELF) { if (m_ptr->IOP_ENDPT == SELF) {
proc_nr = _ENDPOINT_P(caller->p_endpoint); proc_nr = _ENDPOINT_P(caller->p_endpoint);
} else if(!isokendpt(m_ptr->IO_ENDPT, &proc_nr)) } else if(!isokendpt(m_ptr->IOP_ENDPT, &proc_nr))
return(EINVAL); return(EINVAL);
enable_iop(proc_addr(proc_nr)); enable_iop(proc_addr(proc_nr));
return(OK); return(OK);

View file

@ -8,7 +8,7 @@
* *
* The driver supports the following operations: * The driver supports the following operations:
* *
* m_type DEVICE IO_ENDPT COUNT POSITION ADRRESS * m_type DEVICE USER_ENDPT COUNT POSITION ADRRESS
* ----------------------------------------------------------------- * -----------------------------------------------------------------
* | DEV_OPEN | device | proc nr | | | | * | DEV_OPEN | device | proc nr | | | |
* |-------------+---------+---------+---------+---------+---------| * |-------------+---------+---------+---------+---------+---------|
@ -122,7 +122,7 @@ PUBLIC int main(int argc, char *argv[])
/* open the special file ( = parameter) */ /* open the special file ( = parameter) */
r = msg_open(mess.DEVICE); r = msg_open(mess.DEVICE);
repl_mess.m_type = DEV_REVIVE; repl_mess.m_type = DEV_REVIVE;
repl_mess.REP_ENDPT = mess.IO_ENDPT; repl_mess.REP_ENDPT = mess.USER_ENDPT;
repl_mess.REP_STATUS = r; repl_mess.REP_STATUS = r;
send(caller, &repl_mess); send(caller, &repl_mess);
@ -132,7 +132,7 @@ PUBLIC int main(int argc, char *argv[])
/* close the special file ( = parameter) */ /* close the special file ( = parameter) */
r = msg_close(mess.DEVICE); r = msg_close(mess.DEVICE);
repl_mess.m_type = DEV_CLOSE_REPL; repl_mess.m_type = DEV_CLOSE_REPL;
repl_mess.REP_ENDPT = mess.IO_ENDPT; repl_mess.REP_ENDPT = mess.USER_ENDPT;
repl_mess.REP_STATUS = r; repl_mess.REP_STATUS = r;
send(caller, &repl_mess); send(caller, &repl_mess);
@ -144,7 +144,7 @@ PUBLIC int main(int argc, char *argv[])
if (r != SUSPEND) if (r != SUSPEND)
{ {
repl_mess.m_type = DEV_REVIVE; repl_mess.m_type = DEV_REVIVE;
repl_mess.REP_ENDPT = mess.IO_ENDPT; repl_mess.REP_ENDPT = mess.USER_ENDPT;
repl_mess.REP_IO_GRANT = repl_mess.REP_IO_GRANT =
(unsigned)mess.IO_GRANT; (unsigned)mess.IO_GRANT;
repl_mess.REP_STATUS = r; repl_mess.REP_STATUS = r;
@ -162,7 +162,7 @@ PUBLIC int main(int argc, char *argv[])
/* reopen the special file ( = parameter) */ /* reopen the special file ( = parameter) */
r = msg_open(mess.DEVICE); r = msg_open(mess.DEVICE);
repl_mess.m_type = DEV_REOPEN_REPL; repl_mess.m_type = DEV_REOPEN_REPL;
repl_mess.REP_ENDPT = mess.IO_ENDPT; repl_mess.REP_ENDPT = mess.USER_ENDPT;
repl_mess.REP_STATUS = r; repl_mess.REP_STATUS = r;
send(caller, &repl_mess); send(caller, &repl_mess);
continue; continue;
@ -479,7 +479,7 @@ PRIVATE int msg_ioctl(const message *m_ptr)
if (m_ptr->REQUEST & _IOC_IN) { /* if there is data for us, copy it */ if (m_ptr->REQUEST & _IOC_IN) { /* if there is data for us, copy it */
len = io_ctl_length(m_ptr->REQUEST); len = io_ctl_length(m_ptr->REQUEST);
if(sys_safecopyfrom(m_ptr->IO_ENDPT, if(sys_safecopyfrom(m_ptr->m_source,
(vir_bytes)m_ptr->ADDRESS, 0, (vir_bytes)m_ptr->ADDRESS, 0,
(vir_bytes)io_ctl_buf, len, D) != OK) { (vir_bytes)io_ctl_buf, len, D) != OK) {
printf("%s:%d: safecopyfrom failed\n", __FILE__, __LINE__); printf("%s:%d: safecopyfrom failed\n", __FILE__, __LINE__);
@ -493,7 +493,7 @@ PRIVATE int msg_ioctl(const message *m_ptr)
if (status == OK && m_ptr->REQUEST & _IOC_OUT) { if (status == OK && m_ptr->REQUEST & _IOC_OUT) {
/* copy result back to user */ /* copy result back to user */
if(sys_safecopyto(m_ptr->IO_ENDPT, (vir_bytes)m_ptr->ADDRESS, 0, if(sys_safecopyto(m_ptr->m_source, (vir_bytes)m_ptr->ADDRESS, 0,
(vir_bytes)io_ctl_buf, len, D) != OK) { (vir_bytes)io_ctl_buf, len, D) != OK) {
printf("%s:%d: safecopyto failed\n", __FILE__, __LINE__); printf("%s:%d: safecopyto failed\n", __FILE__, __LINE__);
} }
@ -515,7 +515,7 @@ PRIVATE void msg_write(const message *m_ptr)
if (chan == NO_CHANNEL) { if (chan == NO_CHANNEL) {
error("%s: No write channel specified!\n", drv.DriverName); error("%s: No write channel specified!\n", drv.DriverName);
reply(DEV_REVIVE, m_ptr->m_source, m_ptr->IO_ENDPT, EIO); reply(DEV_REVIVE, m_ptr->m_source, m_ptr->USER_ENDPT, EIO);
return; return;
} }
/* get pointer to sub device data */ /* get pointer to sub device data */
@ -529,20 +529,20 @@ PRIVATE void msg_write(const message *m_ptr)
} }
if(m_ptr->COUNT != sub_dev_ptr->FragSize) { if(m_ptr->COUNT != sub_dev_ptr->FragSize) {
error("Fragment size does not match user's buffer length\n"); error("Fragment size does not match user's buffer length\n");
reply(DEV_REVIVE, m_ptr->m_source, m_ptr->IO_ENDPT, EINVAL); reply(DEV_REVIVE, m_ptr->m_source, m_ptr->USER_ENDPT, EINVAL);
return; return;
} }
/* if we are busy with something else than writing, return EBUSY */ /* if we are busy with something else than writing, return EBUSY */
if(sub_dev_ptr->DmaBusy && sub_dev_ptr->DmaMode != DEV_WRITE_S) { if(sub_dev_ptr->DmaBusy && sub_dev_ptr->DmaMode != DEV_WRITE_S) {
error("Already busy with something else then writing\n"); error("Already busy with something else then writing\n");
reply(DEV_REVIVE, m_ptr->m_source, m_ptr->IO_ENDPT, EBUSY); reply(DEV_REVIVE, m_ptr->m_source, m_ptr->USER_ENDPT, EBUSY);
return; return;
} }
sub_dev_ptr->RevivePending = TRUE; sub_dev_ptr->RevivePending = TRUE;
sub_dev_ptr->ReviveProcNr = m_ptr->IO_ENDPT; sub_dev_ptr->ReviveProcNr = m_ptr->USER_ENDPT;
sub_dev_ptr->ReviveGrant = (cp_grant_id_t) m_ptr->ADDRESS; sub_dev_ptr->ReviveGrant = (cp_grant_id_t) m_ptr->ADDRESS;
sub_dev_ptr->NotifyProcNr = m_ptr->m_source; sub_dev_ptr->SourceProcNr = m_ptr->m_source;
data_from_user(sub_dev_ptr); data_from_user(sub_dev_ptr);
@ -566,7 +566,7 @@ PRIVATE void msg_read(message *m_ptr)
if (chan == NO_CHANNEL) { if (chan == NO_CHANNEL) {
error("%s: No read channel specified!\n", drv.DriverName); error("%s: No read channel specified!\n", drv.DriverName);
reply(DEV_REVIVE, m_ptr->m_source, m_ptr->IO_ENDPT, EIO); reply(DEV_REVIVE, m_ptr->m_source, m_ptr->USER_ENDPT, EIO);
return; return;
} }
/* get pointer to sub device data */ /* get pointer to sub device data */
@ -575,25 +575,26 @@ PRIVATE void msg_read(message *m_ptr)
if (!sub_dev_ptr->DmaBusy) { /* get fragment size on first read */ if (!sub_dev_ptr->DmaBusy) { /* get fragment size on first read */
if (drv_get_frag_size(&(sub_dev_ptr->FragSize), sub_dev_ptr->Nr) != OK){ if (drv_get_frag_size(&(sub_dev_ptr->FragSize), sub_dev_ptr->Nr) != OK){
error("%s: Could not retrieve fragment size!\n", drv.DriverName); error("%s: Could not retrieve fragment size!\n", drv.DriverName);
reply(DEV_REVIVE, m_ptr->m_source, m_ptr->IO_ENDPT, EIO); reply(DEV_REVIVE, m_ptr->m_source, m_ptr->USER_ENDPT,
EIO);
return; return;
} }
} }
if(m_ptr->COUNT != sub_dev_ptr->FragSize) { if(m_ptr->COUNT != sub_dev_ptr->FragSize) {
reply(DEV_REVIVE, m_ptr->m_source, m_ptr->IO_ENDPT, EINVAL); reply(DEV_REVIVE, m_ptr->m_source, m_ptr->USER_ENDPT, EINVAL);
error("fragment size does not match message size\n"); error("fragment size does not match message size\n");
return; return;
} }
/* if we are busy with something else than reading, reply EBUSY */ /* if we are busy with something else than reading, reply EBUSY */
if(sub_dev_ptr->DmaBusy && sub_dev_ptr->DmaMode != DEV_READ_S) { if(sub_dev_ptr->DmaBusy && sub_dev_ptr->DmaMode != DEV_READ_S) {
reply(DEV_REVIVE, m_ptr->m_source, m_ptr->IO_ENDPT, EBUSY); reply(DEV_REVIVE, m_ptr->m_source, m_ptr->USER_ENDPT, EBUSY);
return; return;
} }
sub_dev_ptr->RevivePending = TRUE; sub_dev_ptr->RevivePending = TRUE;
sub_dev_ptr->ReviveProcNr = m_ptr->IO_ENDPT; sub_dev_ptr->ReviveProcNr = m_ptr->USER_ENDPT;
sub_dev_ptr->ReviveGrant = (cp_grant_id_t) m_ptr->ADDRESS; sub_dev_ptr->ReviveGrant = (cp_grant_id_t) m_ptr->ADDRESS;
sub_dev_ptr->NotifyProcNr = m_ptr->m_source; sub_dev_ptr->SourceProcNr = m_ptr->m_source;
if(!sub_dev_ptr->DmaBusy) { /* Dma tranfer not yet started */ if(!sub_dev_ptr->DmaBusy) { /* Dma tranfer not yet started */
get_started(sub_dev_ptr); get_started(sub_dev_ptr);
@ -814,7 +815,7 @@ PRIVATE void data_from_user(sub_dev_t *subdev)
if (subdev->DmaLength < subdev->NrOfDmaFragments) { /* room in dma buf */ if (subdev->DmaLength < subdev->NrOfDmaFragments) { /* room in dma buf */
sys_safecopyfrom(subdev->ReviveProcNr, sys_safecopyfrom(subdev->SourceProcNr,
(vir_bytes)subdev->ReviveGrant, 0, (vir_bytes)subdev->ReviveGrant, 0,
(vir_bytes)subdev->DmaPtr + (vir_bytes)subdev->DmaPtr +
subdev->DmaFillNext * subdev->FragSize, subdev->DmaFillNext * subdev->FragSize,
@ -828,7 +829,7 @@ PRIVATE void data_from_user(sub_dev_t *subdev)
} else { /* room in extra buf */ } else { /* room in extra buf */
sys_safecopyfrom(subdev->ReviveProcNr, sys_safecopyfrom(subdev->SourceProcNr,
(vir_bytes)subdev->ReviveGrant, 0, (vir_bytes)subdev->ReviveGrant, 0,
(vir_bytes)subdev->ExtraBuf + (vir_bytes)subdev->ExtraBuf +
subdev->BufFillNext * subdev->FragSize, subdev->BufFillNext * subdev->FragSize,
@ -858,11 +859,11 @@ PRIVATE void data_from_user(sub_dev_t *subdev)
m.REP_ENDPT = subdev->ReviveProcNr; m.REP_ENDPT = subdev->ReviveProcNr;
m.REP_IO_GRANT = subdev->ReviveGrant; m.REP_IO_GRANT = subdev->ReviveGrant;
m.REP_STATUS = subdev->ReviveStatus; m.REP_STATUS = subdev->ReviveStatus;
r= send(subdev->NotifyProcNr, &m); /* send the message */ r= send(subdev->SourceProcNr, &m); /* send the message */
if (r != OK) if (r != OK)
{ {
printf("audio_fw: send to %d failed: %d\n", printf("audio_fw: send to %d failed: %d\n",
subdev->NotifyProcNr, r); subdev->SourceProcNr, r);
} }
/* reset variables */ /* reset variables */
@ -883,7 +884,7 @@ PRIVATE void data_to_user(sub_dev_t *sub_dev_ptr)
if(sub_dev_ptr->BufLength != 0) { /* data in extra buffer available */ if(sub_dev_ptr->BufLength != 0) { /* data in extra buffer available */
sys_safecopyto(sub_dev_ptr->ReviveProcNr, sys_safecopyto(sub_dev_ptr->SourceProcNr,
(vir_bytes)sub_dev_ptr->ReviveGrant, (vir_bytes)sub_dev_ptr->ReviveGrant,
0, (vir_bytes)sub_dev_ptr->ExtraBuf + 0, (vir_bytes)sub_dev_ptr->ExtraBuf +
sub_dev_ptr->BufReadNext * sub_dev_ptr->FragSize, sub_dev_ptr->BufReadNext * sub_dev_ptr->FragSize,
@ -898,7 +899,7 @@ PRIVATE void data_to_user(sub_dev_t *sub_dev_ptr)
} else { /* extra buf empty, but data in dma buf*/ } else { /* extra buf empty, but data in dma buf*/
sys_safecopyto( sys_safecopyto(
sub_dev_ptr->ReviveProcNr, sub_dev_ptr->SourceProcNr,
(vir_bytes)sub_dev_ptr->ReviveGrant, 0, (vir_bytes)sub_dev_ptr->ReviveGrant, 0,
(vir_bytes)sub_dev_ptr->DmaPtr + (vir_bytes)sub_dev_ptr->DmaPtr +
sub_dev_ptr->DmaReadNext * sub_dev_ptr->FragSize, sub_dev_ptr->DmaReadNext * sub_dev_ptr->FragSize,
@ -920,11 +921,11 @@ PRIVATE void data_to_user(sub_dev_t *sub_dev_ptr)
m.REP_ENDPT = sub_dev_ptr->ReviveProcNr; m.REP_ENDPT = sub_dev_ptr->ReviveProcNr;
m.REP_IO_GRANT = sub_dev_ptr->ReviveGrant; m.REP_IO_GRANT = sub_dev_ptr->ReviveGrant;
m.REP_STATUS = sub_dev_ptr->ReviveStatus; m.REP_STATUS = sub_dev_ptr->ReviveStatus;
r= send(sub_dev_ptr->NotifyProcNr, &m); /* send the message */ r= send(sub_dev_ptr->SourceProcNr, &m); /* send the message */
if (r != OK) if (r != OK)
{ {
printf("audio_fw: send to %d failed: %d\n", printf("audio_fw: send to %d failed: %d\n",
sub_dev_ptr->NotifyProcNr, r); sub_dev_ptr->SourceProcNr, r);
} }
/* reset variables */ /* reset variables */

View file

@ -9,7 +9,7 @@
* *
* The drivers support the following operations (using message format m2): * The drivers support the following operations (using message format m2):
* *
* m_type DEVICE IO_ENDPT COUNT POSITION HIGHPOS IO_GRANT * m_type DEVICE USER_ENDPT COUNT POSITION HIGHPOS IO_GRANT
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
* | DEV_OPEN | device | proc nr | | | | | * | DEV_OPEN | device | proc nr | | | | |
* |---------------+--------+---------+---------+--------+--------+-----------| * |---------------+--------+---------+---------+--------+--------+-----------|
@ -53,7 +53,7 @@ FORWARD _PROTOTYPE( void clear_open_devs, (void) );
FORWARD _PROTOTYPE( int is_open_dev, (int device) ); FORWARD _PROTOTYPE( int is_open_dev, (int device) );
FORWARD _PROTOTYPE( void set_open_dev, (int device) ); FORWARD _PROTOTYPE( void set_open_dev, (int device) );
FORWARD _PROTOTYPE( void asyn_reply, (message *mess, int proc_nr, int r) ); FORWARD _PROTOTYPE( void asyn_reply, (message *mess, int r) );
FORWARD _PROTOTYPE( int driver_reply, (endpoint_t caller_e, int caller_status, FORWARD _PROTOTYPE( int driver_reply, (endpoint_t caller_e, int caller_status,
message *m_ptr) ); message *m_ptr) );
FORWARD _PROTOTYPE( int driver_spurious_reply, (endpoint_t caller_e, FORWARD _PROTOTYPE( int driver_spurious_reply, (endpoint_t caller_e,
@ -61,7 +61,8 @@ FORWARD _PROTOTYPE( int driver_spurious_reply, (endpoint_t caller_e,
FORWARD _PROTOTYPE( int do_rdwt, (struct driver *dr, message *mp) ); FORWARD _PROTOTYPE( int do_rdwt, (struct driver *dr, message *mp) );
FORWARD _PROTOTYPE( int do_vrdwt, (struct driver *dr, message *mp) ); FORWARD _PROTOTYPE( int do_vrdwt, (struct driver *dr, message *mp) );
int device_caller; PRIVATE endpoint_t device_caller;
PUBLIC endpoint_t device_endpt; /* used externally by log driver */
PRIVATE mq_t *queue_head = NULL; PRIVATE mq_t *queue_head = NULL;
PRIVATE int open_devs[MAX_NR_OPEN_DEVICES]; PRIVATE int open_devs[MAX_NR_OPEN_DEVICES];
PRIVATE int next_open_devs_slot = 0; PRIVATE int next_open_devs_slot = 0;
@ -108,9 +109,8 @@ PRIVATE void set_open_dev(int device)
/*===========================================================================* /*===========================================================================*
* asyn_reply * * asyn_reply *
*===========================================================================*/ *===========================================================================*/
PRIVATE void asyn_reply(mess, proc_nr, r) PRIVATE void asyn_reply(mess, r)
message *mess; message *mess;
int proc_nr;
int r; int r;
{ {
/* Send a reply using the new asynchronous character device protocol. /* Send a reply using the new asynchronous character device protocol.
@ -120,13 +120,13 @@ int r;
switch (mess->m_type) { switch (mess->m_type) {
case DEV_OPEN: case DEV_OPEN:
reply_mess.m_type = DEV_REVIVE; reply_mess.m_type = DEV_REVIVE;
reply_mess.REP_ENDPT = proc_nr; reply_mess.REP_ENDPT = device_endpt;
reply_mess.REP_STATUS = r; reply_mess.REP_STATUS = r;
break; break;
case DEV_CLOSE: case DEV_CLOSE:
reply_mess.m_type = DEV_CLOSE_REPL; reply_mess.m_type = DEV_CLOSE_REPL;
reply_mess.REP_ENDPT = proc_nr; reply_mess.REP_ENDPT = device_endpt;
reply_mess.REP_STATUS = r; reply_mess.REP_STATUS = r;
break; break;
@ -134,10 +134,11 @@ int r;
case DEV_WRITE_S: case DEV_WRITE_S:
case DEV_IOCTL_S: case DEV_IOCTL_S:
if (r == SUSPEND) if (r == SUSPEND)
printf("driver_task: reviving %d with SUSPEND\n", proc_nr); printf("driver_task: reviving %d (%d) with SUSPEND\n",
device_caller, device_endpt);
reply_mess.m_type = DEV_REVIVE; reply_mess.m_type = DEV_REVIVE;
reply_mess.REP_ENDPT = proc_nr; reply_mess.REP_ENDPT = device_endpt;
reply_mess.REP_IO_GRANT = (cp_grant_id_t) mess->IO_GRANT; reply_mess.REP_IO_GRANT = (cp_grant_id_t) mess->IO_GRANT;
reply_mess.REP_STATUS = r; reply_mess.REP_STATUS = r;
break; break;
@ -154,7 +155,7 @@ int r;
default: default:
reply_mess.m_type = TASK_REPLY; reply_mess.m_type = TASK_REPLY;
reply_mess.REP_ENDPT = proc_nr; reply_mess.REP_ENDPT = device_endpt;
/* Status is # of bytes transferred or error code. */ /* Status is # of bytes transferred or error code. */
reply_mess.REP_STATUS = r; reply_mess.REP_STATUS = r;
break; break;
@ -202,7 +203,7 @@ message *m_ptr;
int r; int r;
m_ptr->m_type = TASK_REPLY; m_ptr->m_type = TASK_REPLY;
m_ptr->REP_ENDPT = m_ptr->IO_ENDPT; m_ptr->REP_ENDPT = m_ptr->USER_ENDPT;
m_ptr->REP_STATUS = ERESTART; m_ptr->REP_STATUS = ERESTART;
r = driver_reply(caller_e, caller_status, m_ptr); r = driver_reply(caller_e, caller_status, m_ptr);
@ -346,7 +347,7 @@ int type; /* Driver type (DRIVER_STD or DRIVER_ASYN) */
{ {
/* Main program of any device driver task. */ /* Main program of any device driver task. */
int r, proc_nr, ipc_status; int r, ipc_status;
message mess; message mess;
driver_running = TRUE; driver_running = TRUE;
@ -371,10 +372,10 @@ int type; /* Driver type (DRIVER_STD or DRIVER_ASYN) */
message *m_ptr; /* Pointer to message to handle */ message *m_ptr; /* Pointer to message to handle */
int ipc_status; int ipc_status;
{ {
int r, proc_nr; int r;
device_caller = m_ptr->m_source; device_caller = m_ptr->m_source;
proc_nr = m_ptr->IO_ENDPT; device_endpt = m_ptr->USER_ENDPT;
if (is_ipc_notify(ipc_status)) { if (is_ipc_notify(ipc_status)) {
switch (_ENDPOINT_P(m_ptr->m_source)) { switch (_ENDPOINT_P(m_ptr->m_source)) {
case HARDWARE: case HARDWARE:
@ -425,7 +426,7 @@ send_reply:
switch (type) { switch (type) {
case DRIVER_STD: case DRIVER_STD:
m_ptr->m_type = TASK_REPLY; m_ptr->m_type = TASK_REPLY;
m_ptr->REP_ENDPT = proc_nr; m_ptr->REP_ENDPT = device_endpt;
/* Status is # of bytes transferred or error code. */ /* Status is # of bytes transferred or error code. */
m_ptr->REP_STATUS = r; m_ptr->REP_STATUS = r;
@ -439,7 +440,7 @@ send_reply:
break; break;
case DRIVER_ASYN: case DRIVER_ASYN:
asyn_reply(m_ptr, proc_nr, r); asyn_reply(m_ptr, r);
break; break;
@ -495,7 +496,7 @@ message *mp; /* pointer to read or write message */
/* Transfer bytes from/to the device. */ /* Transfer bytes from/to the device. */
position= make64(mp->POSITION, mp->HIGHPOS); position= make64(mp->POSITION, mp->HIGHPOS);
r = (*dp->dr_transfer)(mp->IO_ENDPT, opcode, position, &iovec1, 1); r = (*dp->dr_transfer)(mp->m_source, opcode, position, &iovec1, 1);
/* Return the number of bytes transferred or an error code. */ /* Return the number of bytes transferred or an error code. */
return(r == OK ? (mp->COUNT - iovec1.iov_size) : r); return(r == OK ? (mp->COUNT - iovec1.iov_size) : r);
@ -536,7 +537,7 @@ message *mp; /* pointer to read or write message */
/* Transfer bytes from/to the device. */ /* Transfer bytes from/to the device. */
opcode = mp->m_type; opcode = mp->m_type;
position= make64(mp->POSITION, mp->HIGHPOS); position= make64(mp->POSITION, mp->HIGHPOS);
r = (*dp->dr_transfer)(mp->IO_ENDPT, opcode, position, iovec, nr_req); r = (*dp->dr_transfer)(mp->m_source, opcode, position, iovec, nr_req);
/* Copy the I/O vector back to the caller. */ /* Copy the I/O vector back to the caller. */
if (OK != sys_safecopyto(mp->m_source, (vir_bytes) mp->IO_GRANT, if (OK != sys_safecopyto(mp->m_source, (vir_bytes) mp->IO_GRANT,
@ -659,7 +660,7 @@ message *mp; /* pointer to ioctl request */
if (mp->REQUEST == DIOCSETP) { if (mp->REQUEST == DIOCSETP) {
/* Copy just this one partition table entry. */ /* Copy just this one partition table entry. */
s=sys_safecopyfrom(mp->IO_ENDPT, (vir_bytes) mp->IO_GRANT, s=sys_safecopyfrom(mp->m_source, (vir_bytes) mp->IO_GRANT,
0, (vir_bytes) &entry, sizeof(entry), D); 0, (vir_bytes) &entry, sizeof(entry), D);
if(s != OK) if(s != OK)
return s; return s;
@ -670,7 +671,7 @@ message *mp; /* pointer to ioctl request */
entry.base = dv->dv_base; entry.base = dv->dv_base;
entry.size = dv->dv_size; entry.size = dv->dv_size;
(*dp->dr_geometry)(&entry); (*dp->dr_geometry)(&entry);
s=sys_safecopyto(mp->IO_ENDPT, (vir_bytes) mp->IO_GRANT, s=sys_safecopyto(mp->m_source, (vir_bytes) mp->IO_GRANT,
0, (vir_bytes) &entry, sizeof(entry), D); 0, (vir_bytes) &entry, sizeof(entry), D);
if (OK != s) if (OK != s)
return s; return s;

View file

@ -7,7 +7,7 @@ PUBLIC int sys_enable_iop(proc_ep)
endpoint_t proc_ep; /* number of process to allow I/O */ endpoint_t proc_ep; /* number of process to allow I/O */
{ {
message m_iop; message m_iop;
m_iop.IO_ENDPT = proc_ep; m_iop.IOP_ENDPT = proc_ep;
return _kernel_call(SYS_IOPENABLE, &m_iop); return _kernel_call(SYS_IOPENABLE, &m_iop);
} }

View file

@ -185,13 +185,13 @@ PUBLIC int block_dev_io(
} }
/* By default, these are right. */ /* By default, these are right. */
m.IO_ENDPT = proc_e; m.USER_ENDPT = proc_e;
m.ADDRESS = buffer; m.ADDRESS = buffer;
buf_used = buffer; buf_used = buffer;
/* Convert parameters to 'safe mode'. */ /* Convert parameters to 'safe mode'. */
op_used = op; op_used = op;
safe = safe_io_conversion(driver_e, &gid, &op_used, gids, &m.IO_ENDPT, safe = safe_io_conversion(driver_e, &gid, &op_used, gids, &m.USER_ENDPT,
&buf_used, &vec_grants, bytes); &buf_used, &vec_grants, bytes);
/* Set up rest of the message. */ /* Set up rest of the message. */
@ -303,7 +303,7 @@ PRIVATE int gen_opcl(
dev_mess.m_type = op; dev_mess.m_type = op;
dev_mess.DEVICE = minor(dev); dev_mess.DEVICE = minor(dev);
dev_mess.IO_ENDPT = proc_e; dev_mess.USER_ENDPT = proc_e;
dev_mess.COUNT = flags; dev_mess.COUNT = flags;
/* Call the task. */ /* Call the task. */
@ -327,7 +327,7 @@ PRIVATE int gen_io(
int r, proc_e; int r, proc_e;
proc_e = mess_ptr->IO_ENDPT; proc_e = mess_ptr->USER_ENDPT;
r = sendrec(task_nr, mess_ptr); r = sendrec(task_nr, mess_ptr);
if(r == OK && mess_ptr->REP_STATUS == ERESTART) if(r == OK && mess_ptr->REP_STATUS == ERESTART)

View file

@ -543,7 +543,7 @@ eth_port_t *eth_port;
errno)); errno));
} }
m.m_type= DL_WRITEV_S; m.m_type= DL_WRITEV_S;
m.DL_ENDPT= this_proc; m.DL_ENDPT_LEGACY= this_proc; /* FIXME: legacy support */
m.DL_COUNT= i; m.DL_COUNT= i;
m.DL_GRANT= eth_port->etp_osdep.etp_wr_vec_grant; m.DL_GRANT= eth_port->etp_osdep.etp_wr_vec_grant;
@ -710,7 +710,7 @@ eth_port_t *eth_port;
} }
mess.m_type= DL_READV_S; mess.m_type= DL_READV_S;
mess.DL_ENDPT= this_proc; mess.DL_ENDPT_LEGACY= this_proc; /* FIXME: legacy support */
mess.DL_COUNT= i; mess.DL_COUNT= i;
mess.DL_GRANT= eth_port->etp_osdep.etp_rd_vec_grant; mess.DL_GRANT= eth_port->etp_osdep.etp_rd_vec_grant;
@ -822,7 +822,7 @@ eth_port_t *eth_port;
message mess; message mess;
mess.m_type= DL_GETSTAT_S; mess.m_type= DL_GETSTAT_S;
mess.DL_ENDPT= this_proc; mess.DL_ENDPT_LEGACY= this_proc; /* FIXME: legacy support */
mess.DL_GRANT= eth_port->etp_osdep.etp_stat_gid; mess.DL_GRANT= eth_port->etp_osdep.etp_stat_gid;
assert(eth_port->etp_osdep.etp_state == OEPS_IDLE); assert(eth_port->etp_osdep.etp_state == OEPS_IDLE);

View file

@ -7,14 +7,14 @@
* *
* Requests: * Requests:
* *
* m_type DEVICE IO_ENDPT COUNT * m_type DEVICE USER_ENDPT COUNT
* -------------------------------------------------- * --------------------------------------------------
* | DEV_OPEN | minor dev | proc nr | mode | * | DEV_OPEN | minor dev | proc nr | mode |
* |-------------+-----------+-----------+----------+ * |-------------+-----------+-----------+----------+
* | DEV_CLOSE | minor dev | proc nr | | * | DEV_CLOSE | minor dev | proc nr | |
* |-------------+-----------+-----------+----------+ * |-------------+-----------+-----------+----------+
* *
* m_type DEVICE IO_ENDPT COUNT IO_GRANT * m_type DEVICE USER_ENDPT COUNT IO_GRANT
* --------------------------------------------------------------- * ---------------------------------------------------------------
* | DEV_READ_S | minor dev | proc nr | count | grant ID | * | DEV_READ_S | minor dev | proc nr | count | grant ID |
* |-------------+-----------+-----------+-----------+-----------| * |-------------+-----------+-----------+-----------+-----------|
@ -30,7 +30,7 @@
* | DEV_STATUS | * | DEV_STATUS |
* |-------------| * |-------------|
* *
* m_type DEVICE IO_ENDPT COUNT * m_type DEVICE USER_ENDPT COUNT
* --------------------------------------------------| * --------------------------------------------------|
* | CANCEL | minor dev | proc nr | mode | * | CANCEL | minor dev | proc nr | mode |
* |-------------+-----------+-----------+-----------| * |-------------+-----------+-----------+-----------|
@ -124,7 +124,7 @@ mq_t *m;
{ {
if (m->mq_mess.m_type == CANCEL) if (m->mq_mess.m_type == CANCEL)
{ {
result= sr_repl_queue(m->mq_mess.IO_ENDPT, result= sr_repl_queue(m->mq_mess.USER_ENDPT,
(int)m->mq_mess.IO_GRANT, 0); (int)m->mq_mess.IO_GRANT, 0);
if (result) if (result)
@ -461,7 +461,7 @@ message *m;
int proc_nr, ref; int proc_nr, ref;
result=EINTR; result=EINTR;
proc_nr= m->IO_ENDPT; proc_nr= m->USER_ENDPT;
ref= (int)m->IO_GRANT; ref= (int)m->IO_GRANT;
sr_fd= sr_getchannel(m->DEVICE); sr_fd= sr_getchannel(m->DEVICE);
assert (sr_fd); assert (sr_fd);
@ -487,7 +487,7 @@ message *m;
ip_panic(( ip_panic((
"request not found: from %d, type %d, MINOR= %d, PROC= %d, REF= %d", "request not found: from %d, type %d, MINOR= %d, PROC= %d, REF= %d",
m->m_source, m->m_type, m->DEVICE, m->m_source, m->m_type, m->DEVICE,
m->IO_ENDPT, (int) m->IO_GRANT)); m->USER_ENDPT, (int) m->IO_GRANT));
return result; return result;
} }
@ -504,7 +504,7 @@ message *m;
sr_fd->srf_select_proc= m->m_source; sr_fd->srf_select_proc= m->m_source;
m_ops= m->IO_ENDPT; m_ops= m->USER_ENDPT;
i_ops= 0; i_ops= 0;
if (m_ops & SEL_RD) i_ops |= SR_SELECT_READ; if (m_ops & SEL_RD) i_ops |= SR_SELECT_READ;
if (m_ops & SEL_WR) i_ops |= SR_SELECT_WRITE; if (m_ops & SEL_WR) i_ops |= SR_SELECT_WRITE;
@ -597,7 +597,7 @@ int first_flag;
for(q_ptr_prv= NULL, q_ptr= *q_head_ptr; q_ptr; for(q_ptr_prv= NULL, q_ptr= *q_head_ptr; q_ptr;
q_ptr_prv= q_ptr, q_ptr= q_ptr->mq_next) q_ptr_prv= q_ptr, q_ptr= q_ptr->mq_next)
{ {
if (q_ptr->mq_mess.IO_ENDPT != proc_nr) if (q_ptr->mq_mess.USER_ENDPT != proc_nr)
continue; continue;
if ((int)q_ptr->mq_mess.IO_GRANT != ref) if ((int)q_ptr->mq_mess.IO_GRANT != ref)
continue; continue;
@ -650,7 +650,7 @@ int is_revive;
int result, proc, ref; int result, proc, ref;
message reply, *mp; message reply, *mp;
proc= mq->mq_mess.IO_ENDPT; proc= mq->mq_mess.USER_ENDPT;
ref= (int)mq->mq_mess.IO_GRANT; ref= (int)mq->mq_mess.IO_GRANT;
if (is_revive) if (is_revive)
@ -744,7 +744,7 @@ int for_ioctl;
return NULL; return NULL;
} }
result= cp_u2b ((*head_ptr)->mq_mess.IO_ENDPT, result= cp_u2b ((*head_ptr)->mq_mess.m_source,
(int)(*head_ptr)->mq_mess.IO_GRANT, offset, &acc, count); (int)(*head_ptr)->mq_mess.IO_GRANT, offset, &acc, count);
return result<0 ? NULL : acc; return result<0 ? NULL : acc;
@ -805,7 +805,7 @@ int for_ioctl;
return OK; return OK;
} }
return cp_b2u (data, (*head_ptr)->mq_mess.IO_ENDPT, return cp_b2u (data, (*head_ptr)->mq_mess.m_source,
(int)(*head_ptr)->mq_mess.IO_GRANT, offset); (int)(*head_ptr)->mq_mess.IO_GRANT, offset);
} }

View file

@ -193,14 +193,14 @@ PUBLIC int block_dev_io(
} }
/* By default, these are right. */ /* By default, these are right. */
m.IO_ENDPT = proc_e; m.USER_ENDPT = proc_e;
m.ADDRESS = buf; m.ADDRESS = buf;
buf_used = buf; buf_used = buf;
/* Convert parameters to 'safe mode'. */ /* Convert parameters to 'safe mode'. */
op_used = op; op_used = op;
safe = safe_io_conversion(driver_e, &gid, safe = safe_io_conversion(driver_e, &gid,
&op_used, gids, NR_IOREQS, &m.IO_ENDPT, &buf_used, &op_used, gids, NR_IOREQS, &m.USER_ENDPT, &buf_used,
&vec_grants, bytes); &vec_grants, bytes);
/* Set up rest of the message. */ /* Set up rest of the message. */
@ -273,7 +273,7 @@ PRIVATE int gen_opcl(
dev_mess.m_type = op; dev_mess.m_type = op;
dev_mess.DEVICE = (dev >> MINOR) & BYTE; dev_mess.DEVICE = (dev >> MINOR) & BYTE;
dev_mess.IO_ENDPT = proc_e; dev_mess.USER_ENDPT = proc_e;
dev_mess.COUNT = flags; dev_mess.COUNT = flags;
/* Call the task. */ /* Call the task. */
@ -296,7 +296,7 @@ message *mess_ptr; /* pointer to message for task */
int r, proc_e; int r, proc_e;
proc_e = mess_ptr->IO_ENDPT; proc_e = mess_ptr->USER_ENDPT;
r = sendrec(task_nr, mess_ptr); r = sendrec(task_nr, mess_ptr);
if(r == OK && mess_ptr->REP_STATUS == ERESTART) r = EDEADEPT; if(r == OK && mess_ptr->REP_STATUS == ERESTART) r = EDEADEPT;

View file

@ -147,7 +147,7 @@ static void driver_setup_read(struct nic * nic)
nic->rx_iovec[0].iov_size = nic->rx_pbuf->len; nic->rx_iovec[0].iov_size = nic->rx_pbuf->len;
m.m_type = DL_READV_S; m.m_type = DL_READV_S;
m.DL_ENDPT = lwip_ep; m.DL_ENDPT_LEGACY = lwip_ep; /* FIXME: legacy support */
m.DL_COUNT = 1; m.DL_COUNT = 1;
m.DL_GRANT = nic->rx_iogrant; m.DL_GRANT = nic->rx_iogrant;
@ -209,7 +209,7 @@ int driver_tx(struct nic * nic)
panic("Failed to set grant"); panic("Failed to set grant");
m.m_type = DL_WRITEV_S; m.m_type = DL_WRITEV_S;
m.DL_ENDPT = lwip_ep; m.DL_ENDPT_LEGACY = lwip_ep; /* FIXME: legacy support */
m.DL_COUNT = 1; m.DL_COUNT = 1;
m.DL_GRANT = nic->tx_iogrant; m.DL_GRANT = nic->tx_iogrant;
@ -274,7 +274,7 @@ static int raw_receive(message * m,
size_t cp_len; size_t cp_len;
cp_len = (rem_len < p->len) ? rem_len : p->len; cp_len = (rem_len < p->len) ? rem_len : p->len;
err = copy_to_user(m->IO_ENDPT, p->payload, cp_len, err = copy_to_user(m->m_source, p->payload, cp_len,
(cp_grant_id_t) m->IO_GRANT, (cp_grant_id_t) m->IO_GRANT,
written); written);
@ -468,7 +468,7 @@ static void nic_ioctl_set_conf(__unused struct socket * sock,
nwio_ipconf_t ipconf; nwio_ipconf_t ipconf;
int err; int err;
err = copy_from_user(m->IO_ENDPT, &ipconf, sizeof(ipconf), err = copy_from_user(m->m_source, &ipconf, sizeof(ipconf),
(cp_grant_id_t) m->IO_GRANT, 0); (cp_grant_id_t) m->IO_GRANT, 0);
if (err != OK) if (err != OK)
send_reply(m, err); send_reply(m, err);
@ -498,7 +498,7 @@ static void nic_ioctl_get_conf(__unused struct socket * sock,
ipconf.nwic_netmask = nic->netif.netmask.addr; ipconf.nwic_netmask = nic->netif.netmask.addr;
ipconf.nwic_mtu = nic->netif.mtu; ipconf.nwic_mtu = nic->netif.mtu;
err = copy_to_user(m->IO_ENDPT, &ipconf, sizeof(ipconf), err = copy_to_user(m->m_source, &ipconf, sizeof(ipconf),
(cp_grant_id_t) m->IO_GRANT, 0); (cp_grant_id_t) m->IO_GRANT, 0);
if (err != OK) if (err != OK)
send_reply(m, err); send_reply(m, err);
@ -513,7 +513,7 @@ static void nic_ioctl_set_gateway(__unused struct socket * sock,
nwio_route_t route; nwio_route_t route;
int err; int err;
err = copy_from_user(m->IO_ENDPT, &route, sizeof(route), err = copy_from_user(m->m_source, &route, sizeof(route),
(cp_grant_id_t) m->IO_GRANT, 0); (cp_grant_id_t) m->IO_GRANT, 0);
if (err != OK) if (err != OK)
send_reply(m, err); send_reply(m, err);
@ -546,7 +546,7 @@ static void nic_ioctl_get_ethstat(__unused struct socket * sock,
memset(&ethstat, 0, sizeof(ethstat)); memset(&ethstat, 0, sizeof(ethstat));
memcpy(&ethstat.nwes_addr, nic->netif.hwaddr, 6); memcpy(&ethstat.nwes_addr, nic->netif.hwaddr, 6);
err = copy_to_user(m->IO_ENDPT, &ethstat, sizeof(ethstat), err = copy_to_user(m->m_source, &ethstat, sizeof(ethstat),
(cp_grant_id_t) m->IO_GRANT, 0); (cp_grant_id_t) m->IO_GRANT, 0);
if (err != OK) if (err != OK)
send_reply(m, err); send_reply(m, err);
@ -580,7 +580,7 @@ static void nic_ioctl_set_ethopt(struct socket * sock,
return; return;
} }
err = copy_from_user(m->IO_ENDPT, &ethopt, sizeof(ethopt), err = copy_from_user(m->m_source, &ethopt, sizeof(ethopt),
(cp_grant_id_t) m->IO_GRANT, 0); (cp_grant_id_t) m->IO_GRANT, 0);
if (err != OK) if (err != OK)
send_reply(m, err); send_reply(m, err);
@ -697,7 +697,7 @@ static void nic_op_write(struct socket * sock, message * m)
goto write_err; goto write_err;
} }
if ((ret = copy_from_user(m->IO_ENDPT, pbuf->payload, m->COUNT, if ((ret = copy_from_user(m->m_source, pbuf->payload, m->COUNT,
(cp_grant_id_t) m->IO_GRANT, 0)) != OK) { (cp_grant_id_t) m->IO_GRANT, 0)) != OK) {
pbuf_free(pbuf); pbuf_free(pbuf);
goto write_err; goto write_err;

View file

@ -79,7 +79,7 @@ static int raw_ip_do_receive(message * m,
size_t cp_len; size_t cp_len;
cp_len = (rem_len < p->len) ? rem_len : p->len; cp_len = (rem_len < p->len) ? rem_len : p->len;
err = copy_to_user(m->IO_ENDPT, p->payload, cp_len, err = copy_to_user(m->m_source, p->payload, cp_len,
(cp_grant_id_t) m->IO_GRANT, (cp_grant_id_t) m->IO_GRANT,
hdr_sz + written); hdr_sz + written);
@ -231,7 +231,7 @@ static void raw_ip_op_write(struct socket * sock, message * m)
goto write_err; goto write_err;
} }
if ((ret = copy_from_user(m->IO_ENDPT, pbuf->payload, m->COUNT, if ((ret = copy_from_user(m->m_source, pbuf->payload, m->COUNT,
(cp_grant_id_t) m->IO_GRANT, 0)) != OK) { (cp_grant_id_t) m->IO_GRANT, 0)) != OK) {
pbuf_free(pbuf); pbuf_free(pbuf);
goto write_err; goto write_err;
@ -264,7 +264,7 @@ static void raw_ip_set_opt(struct socket * sock, message * m)
nwio_ipopt_t ipopt; nwio_ipopt_t ipopt;
struct raw_pcb * pcb; struct raw_pcb * pcb;
err = copy_from_user(m->IO_ENDPT, &ipopt, sizeof(ipopt), err = copy_from_user(m->m_source, &ipopt, sizeof(ipopt),
(cp_grant_id_t) m->IO_GRANT, 0); (cp_grant_id_t) m->IO_GRANT, 0);
if (err != OK) if (err != OK)
@ -323,7 +323,7 @@ static void raw_ip_get_opt(struct socket * sock, message * m)
return; return;
} }
err = copy_to_user(m->IO_ENDPT, &ipopt, sizeof(ipopt), err = copy_to_user(m->m_source, &ipopt, sizeof(ipopt),
(cp_grant_id_t) m->IO_GRANT, 0); (cp_grant_id_t) m->IO_GRANT, 0);
if (err != OK) if (err != OK)

View file

@ -114,7 +114,7 @@ static int mq_cancel(message * m)
for (mq = mq_tail; mq; mq = mq->prev) { for (mq = mq_tail; mq; mq = mq->prev) {
if (m->DEVICE == mq->m.DEVICE && if (m->DEVICE == mq->m.DEVICE &&
m->IO_ENDPT == mq->m.IO_ENDPT && m->USER_ENDPT == mq->m.USER_ENDPT &&
m->IO_GRANT == mq->m.IO_GRANT) { m->IO_GRANT == mq->m.IO_GRANT) {
debug_sock_print("socket %d\n", mq->m.DEVICE); debug_sock_print("socket %d\n", mq->m.DEVICE);
break; break;
@ -181,7 +181,7 @@ static void set_reply_msg(message * m, int status)
{ {
int proc, ref; int proc, ref;
proc= m->IO_ENDPT; proc= m->USER_ENDPT;
ref= (int)m->IO_GRANT; ref= (int)m->IO_GRANT;
m->REP_ENDPT= proc; m->REP_ENDPT= proc;
@ -591,9 +591,9 @@ void generic_op_select(struct socket * sock, message * m)
{ {
int retsel = 0, sel; int retsel = 0, sel;
debug_print("socket num %ld 0x%x", get_sock_num(sock), m->IO_ENDPT); debug_print("socket num %ld 0x%x", get_sock_num(sock), m->USER_ENDPT);
sel = m->IO_ENDPT; sel = m->USER_ENDPT;
/* in this case any operation would block, no error */ /* in this case any operation would block, no error */
if (sock->flags & SOCK_FLG_OP_PENDING) { if (sock->flags & SOCK_FLG_OP_PENDING) {

View file

@ -218,7 +218,7 @@ static int read_from_tcp(struct socket * sock, message * m)
#if 0 #if 0
print_tcp_payload(p->payload, p->len); print_tcp_payload(p->payload, p->len);
#endif #endif
err = copy_to_user(m->IO_ENDPT, p->payload, p->len, err = copy_to_user(m->m_source, p->payload, p->len,
(cp_grant_id_t) m->IO_GRANT, written); (cp_grant_id_t) m->IO_GRANT, written);
if (err != OK) if (err != OK)
goto cp_error; goto cp_error;
@ -259,7 +259,7 @@ static int read_from_tcp(struct socket * sock, message * m)
#if 0 #if 0
print_tcp_payload(p->payload, rem_buf); print_tcp_payload(p->payload, rem_buf);
#endif #endif
err = copy_to_user(m->IO_ENDPT, p->payload, rem_buf, err = copy_to_user(m->m_source, p->payload, rem_buf,
(cp_grant_id_t) m->IO_GRANT, written); (cp_grant_id_t) m->IO_GRANT, written);
if (err != OK) if (err != OK)
goto cp_error; goto cp_error;
@ -308,7 +308,7 @@ static void tcp_op_read(struct socket * sock, message * m)
} else { } else {
if (sock->flags & SOCK_FLG_CLOSED) { if (sock->flags & SOCK_FLG_CLOSED) {
printf("socket %ld already closed!!! call from %d\n", printf("socket %ld already closed!!! call from %d\n",
get_sock_num(sock), m->IO_ENDPT); get_sock_num(sock), m->USER_ENDPT);
do_tcp_debug = 1; do_tcp_debug = 1;
sock_reply(sock, 0); sock_reply(sock, 0);
return; return;
@ -423,7 +423,7 @@ static void tcp_op_write(struct socket * sock, message * m)
sock_reply(sock, ENOMEM); sock_reply(sock, ENOMEM);
} }
if ((ret = copy_from_user(m->IO_ENDPT, wbuf->data, usr_buf_len, if ((ret = copy_from_user(m->m_source, wbuf->data, usr_buf_len,
(cp_grant_id_t) m->IO_GRANT, 0)) != OK) { (cp_grant_id_t) m->IO_GRANT, 0)) != OK) {
sock_reply(sock, ret); sock_reply(sock, ret);
return; return;
@ -508,7 +508,7 @@ static void tcp_set_conf(struct socket * sock, message * m)
assert(pcb); assert(pcb);
err = copy_from_user(m->IO_ENDPT, &tconf, sizeof(tconf), err = copy_from_user(m->m_source, &tconf, sizeof(tconf),
(cp_grant_id_t) m->IO_GRANT, 0); (cp_grant_id_t) m->IO_GRANT, 0);
if (err != OK) if (err != OK)
@ -569,7 +569,7 @@ static void tcp_get_conf(struct socket * sock, message * m)
return; return;
} }
err = copy_to_user(m->IO_ENDPT, &tconf, sizeof(tconf), err = copy_to_user(m->m_source, &tconf, sizeof(tconf),
(cp_grant_id_t) m->IO_GRANT, 0); (cp_grant_id_t) m->IO_GRANT, 0);
if (err != OK) if (err != OK)
@ -835,7 +835,7 @@ static int tcp_do_accept(struct socket * listen_sock,
debug_tcp_print("socket num %ld", get_sock_num(listen_sock)); debug_tcp_print("socket num %ld", get_sock_num(listen_sock));
if ((ret = copy_from_user(m->IO_ENDPT, &sock_num, sizeof(sock_num), if ((ret = copy_from_user(m->m_source, &sock_num, sizeof(sock_num),
(cp_grant_id_t) m->IO_GRANT, 0)) != OK) (cp_grant_id_t) m->IO_GRANT, 0)) != OK)
return EFAULT; return EFAULT;
if (!is_valid_sock_num(sock_num)) if (!is_valid_sock_num(sock_num))
@ -903,7 +903,7 @@ static void tcp_op_listen(struct socket * sock, message * m)
debug_tcp_print("socket num %ld", get_sock_num(sock)); debug_tcp_print("socket num %ld", get_sock_num(sock));
err = copy_from_user(m->IO_ENDPT, &backlog, sizeof(backlog), err = copy_from_user(m->m_source, &backlog, sizeof(backlog),
(cp_grant_id_t) m->IO_GRANT, 0); (cp_grant_id_t) m->IO_GRANT, 0);
new_pcb = tcp_listen_with_backlog((struct tcp_pcb *) sock->pcb, new_pcb = tcp_listen_with_backlog((struct tcp_pcb *) sock->pcb,
@ -985,7 +985,7 @@ static void tcp_op_get_cookie(struct socket * sock, message * m)
sock_num = get_sock_num(sock); sock_num = get_sock_num(sock);
memcpy(&cookie, &sock_num, sizeof(sock_num)); memcpy(&cookie, &sock_num, sizeof(sock_num));
if (copy_to_user(m->IO_ENDPT, &cookie, sizeof(sock), if (copy_to_user(m->m_source, &cookie, sizeof(sock),
(cp_grant_id_t) m->IO_GRANT, 0) == OK) (cp_grant_id_t) m->IO_GRANT, 0) == OK)
sock_reply(sock, OK); sock_reply(sock, OK);
else else
@ -1010,7 +1010,7 @@ static void tcp_get_opt(struct socket * sock, message * m)
/* FIXME : not used by the userspace library */ /* FIXME : not used by the userspace library */
tcpopt.nwto_flags = 0; tcpopt.nwto_flags = 0;
err = copy_to_user(m->IO_ENDPT, &tcpopt, sizeof(tcpopt), err = copy_to_user(m->m_source, &tcpopt, sizeof(tcpopt),
(cp_grant_id_t) m->IO_GRANT, 0); (cp_grant_id_t) m->IO_GRANT, 0);
if (err != OK) if (err != OK)
@ -1029,7 +1029,7 @@ static void tcp_set_opt(struct socket * sock, message * m)
assert(pcb); assert(pcb);
err = copy_from_user(m->IO_ENDPT, &tcpopt, sizeof(tcpopt), err = copy_from_user(m->m_source, &tcpopt, sizeof(tcpopt),
(cp_grant_id_t) m->IO_GRANT, 0); (cp_grant_id_t) m->IO_GRANT, 0);
if (err != OK) if (err != OK)
@ -1091,7 +1091,7 @@ static void tcp_op_select(struct socket * sock, __unused message * m)
{ {
int retsel = 0, sel; int retsel = 0, sel;
sel = m->IO_ENDPT; sel = m->USER_ENDPT;
debug_tcp_print("socket num %ld 0x%x", get_sock_num(sock), sel); debug_tcp_print("socket num %ld 0x%x", get_sock_num(sock), sel);
/* in this case any operation would block, no error */ /* in this case any operation would block, no error */

View file

@ -101,7 +101,7 @@ static int udp_do_receive(struct socket * sock,
hdr.uih_data_len = 0; hdr.uih_data_len = 0;
hdr.uih_ip_opt_len = 0; hdr.uih_ip_opt_len = 0;
err = copy_to_user(m->IO_ENDPT, err = copy_to_user(m->m_source,
&hdr, sizeof(hdr), &hdr, sizeof(hdr),
(cp_grant_id_t) m->IO_GRANT, (cp_grant_id_t) m->IO_GRANT,
0); 0);
@ -116,7 +116,7 @@ static int udp_do_receive(struct socket * sock,
size_t cp_len; size_t cp_len;
cp_len = (rem_len < p->len) ? rem_len : p->len; cp_len = (rem_len < p->len) ? rem_len : p->len;
err = copy_to_user(m->IO_ENDPT, p->payload, cp_len, err = copy_to_user(m->m_source, p->payload, cp_len,
(cp_grant_id_t) m->IO_GRANT, (cp_grant_id_t) m->IO_GRANT,
hdr_sz + written); hdr_sz + written);
@ -276,7 +276,7 @@ static void udp_op_write(struct socket * sock, message * m)
goto write_err; goto write_err;
} }
if ((ret = copy_from_user(m->IO_ENDPT, pbuf->payload, m->COUNT, if ((ret = copy_from_user(m->m_source, pbuf->payload, m->COUNT,
(cp_grant_id_t) m->IO_GRANT, 0)) != OK) { (cp_grant_id_t) m->IO_GRANT, 0)) != OK) {
pbuf_free(pbuf); pbuf_free(pbuf);
goto write_err; goto write_err;
@ -304,7 +304,7 @@ static void udp_set_opt(struct socket * sock, message * m)
assert(pcb); assert(pcb);
err = copy_from_user(m->IO_ENDPT, &udpopt, sizeof(udpopt), err = copy_from_user(m->m_source, &udpopt, sizeof(udpopt),
(cp_grant_id_t) m->IO_GRANT, 0); (cp_grant_id_t) m->IO_GRANT, 0);
if (err != OK) if (err != OK)
@ -376,7 +376,7 @@ static void udp_get_opt(struct socket * sock, message * m)
return; return;
} }
err = copy_to_user(m->IO_ENDPT, &udpopt, sizeof(udpopt), err = copy_to_user(m->m_source, &udpopt, sizeof(udpopt),
(cp_grant_id_t) m->IO_GRANT, 0); (cp_grant_id_t) m->IO_GRANT, 0);
if (err != OK) if (err != OK)

View file

@ -185,13 +185,13 @@ PUBLIC int block_dev_io(
} }
/* By default, these are right. */ /* By default, these are right. */
m.IO_ENDPT = proc_e; m.USER_ENDPT = proc_e;
m.ADDRESS = buffer; m.ADDRESS = buffer;
buf_used = buffer; buf_used = buffer;
/* Convert parameters to 'safe mode'. */ /* Convert parameters to 'safe mode'. */
op_used = op; op_used = op;
safe = safe_io_conversion(driver_e, &gid, &op_used, gids, &m.IO_ENDPT, safe = safe_io_conversion(driver_e, &gid, &op_used, gids, &m.USER_ENDPT,
&buf_used, &vec_grants, bytes); &buf_used, &vec_grants, bytes);
/* Set up rest of the message. */ /* Set up rest of the message. */
@ -303,7 +303,7 @@ PRIVATE int gen_opcl(
dev_mess.m_type = op; dev_mess.m_type = op;
dev_mess.DEVICE = minor(dev); dev_mess.DEVICE = minor(dev);
dev_mess.IO_ENDPT = proc_e; dev_mess.USER_ENDPT = proc_e;
dev_mess.COUNT = flags; dev_mess.COUNT = flags;
/* Call the task. */ /* Call the task. */
@ -327,7 +327,7 @@ PRIVATE int gen_io(
int r, proc_e; int r, proc_e;
proc_e = mess_ptr->IO_ENDPT; proc_e = mess_ptr->USER_ENDPT;
r = sendrec(task_nr, mess_ptr); r = sendrec(task_nr, mess_ptr);
if(r == OK && mess_ptr->REP_STATUS == ERESTART) if(r == OK && mess_ptr->REP_STATUS == ERESTART)

View file

@ -48,7 +48,7 @@ PUBLIC int uds_open(message *dev_m_in, message *dev_m_out)
static int call_count = 0; static int call_count = 0;
printf("(uds) [%d] uds_open() call_count=%d\n", uds_minor(dev_m_in), printf("(uds) [%d] uds_open() call_count=%d\n", uds_minor(dev_m_in),
++call_count); ++call_count);
printf("Endpoint: 0x%x\n", dev_m_in->IO_ENDPT); printf("Endpoint: 0x%x\n", dev_m_in->USER_ENDPT);
#endif #endif
/* /*
@ -71,7 +71,7 @@ PUBLIC int uds_open(message *dev_m_in, message *dev_m_out)
if (minor == -1) { if (minor == -1) {
/* descriptor table full */ /* descriptor table full */
uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->IO_ENDPT, uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->USER_ENDPT,
(cp_grant_id_t) dev_m_in->IO_GRANT, ENFILE); (cp_grant_id_t) dev_m_in->IO_GRANT, ENFILE);
return ENFILE; return ENFILE;
} }
@ -91,8 +91,8 @@ PUBLIC int uds_open(message *dev_m_in, message *dev_m_out)
uds_fd_table[minor].syscall_done = 0; uds_fd_table[minor].syscall_done = 0;
/* set the socket owner */ /* set the socket owner */
uds_fd_table[minor].owner = dev_m_in->IO_ENDPT; uds_fd_table[minor].owner = dev_m_in->USER_ENDPT;
uds_fd_table[minor].endpoint = dev_m_in->IO_ENDPT; uds_fd_table[minor].endpoint = dev_m_in->USER_ENDPT;
/* setup select(2) framework */ /* setup select(2) framework */
uds_fd_table[minor].selecting = 0; uds_fd_table[minor].selecting = 0;
@ -168,7 +168,7 @@ PUBLIC int uds_open(message *dev_m_in, message *dev_m_out)
memset(&(uds_fd_table[minor]), '\0', sizeof(uds_fd_t)); memset(&(uds_fd_table[minor]), '\0', sizeof(uds_fd_t));
/* likely error: invalid endpoint / proc doesn't exist */ /* likely error: invalid endpoint / proc doesn't exist */
uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->IO_ENDPT, uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->USER_ENDPT,
(cp_grant_id_t) dev_m_in->IO_GRANT, errno); (cp_grant_id_t) dev_m_in->IO_GRANT, errno);
return errno; return errno;
} }
@ -189,7 +189,7 @@ PUBLIC int uds_open(message *dev_m_in, message *dev_m_out)
memset(&(uds_fd_table[minor]), '\0', sizeof(uds_fd_t)); memset(&(uds_fd_table[minor]), '\0', sizeof(uds_fd_t));
/* likely error: get_block() failed */ /* likely error: get_block() failed */
uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->IO_ENDPT, uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->USER_ENDPT,
(cp_grant_id_t) dev_m_in->IO_GRANT, rc); (cp_grant_id_t) dev_m_in->IO_GRANT, rc);
return rc; return rc;
} }
@ -201,7 +201,7 @@ PUBLIC int uds_open(message *dev_m_in, message *dev_m_out)
/* prepare the reply */ /* prepare the reply */
uds_fd_table[minor].syscall_done = 1; uds_fd_table[minor].syscall_done = 1;
uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->IO_ENDPT, uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->USER_ENDPT,
(cp_grant_id_t) dev_m_in->IO_GRANT, minor); (cp_grant_id_t) dev_m_in->IO_GRANT, minor);
return minor; return minor;
} }
@ -216,7 +216,7 @@ PUBLIC int uds_close(message *dev_m_in, message *dev_m_out)
static int call_count = 0; static int call_count = 0;
printf("(uds) [%d] uds_close() call_count=%d\n", uds_minor(dev_m_in), printf("(uds) [%d] uds_close() call_count=%d\n", uds_minor(dev_m_in),
++call_count); ++call_count);
printf("Endpoint: 0x%x\n", dev_m_in->IO_ENDPT); printf("Endpoint: 0x%x\n", dev_m_in->USER_ENDPT);
#endif #endif
minor = uds_minor(dev_m_in); minor = uds_minor(dev_m_in);
@ -225,7 +225,7 @@ PUBLIC int uds_close(message *dev_m_in, message *dev_m_out)
/* attempted to close a socket that hasn't been opened -- /* attempted to close a socket that hasn't been opened --
* something is very wrong :( * something is very wrong :(
*/ */
uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->IO_ENDPT, uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->USER_ENDPT,
(cp_grant_id_t) dev_m_in->IO_GRANT, EINVAL); (cp_grant_id_t) dev_m_in->IO_GRANT, EINVAL);
return EINVAL; return EINVAL;
} }
@ -276,7 +276,7 @@ PUBLIC int uds_close(message *dev_m_in, message *dev_m_out)
return rc; return rc;
} }
uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->IO_ENDPT, uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->USER_ENDPT,
(cp_grant_id_t) dev_m_in->IO_GRANT, OK); (cp_grant_id_t) dev_m_in->IO_GRANT, OK);
return OK; return OK;
} }
@ -290,7 +290,7 @@ PUBLIC int uds_select(message *dev_m_in, message *dev_m_out)
static int call_count = 0; static int call_count = 0;
printf("(uds) [%d] uds_select() call_count=%d\n", uds_minor(dev_m_in), printf("(uds) [%d] uds_select() call_count=%d\n", uds_minor(dev_m_in),
++call_count); ++call_count);
printf("Endpoint: 0x%x\n", dev_m_in->IO_ENDPT); printf("Endpoint: 0x%x\n", dev_m_in->USER_ENDPT);
#endif #endif
minor = uds_minor(dev_m_in); minor = uds_minor(dev_m_in);
@ -300,7 +300,7 @@ PUBLIC int uds_select(message *dev_m_in, message *dev_m_out)
/* attempted to close a socket that hasn't been opened -- /* attempted to close a socket that hasn't been opened --
* something is very wrong :( * something is very wrong :(
*/ */
uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->IO_ENDPT, uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->USER_ENDPT,
(cp_grant_id_t) dev_m_in->IO_GRANT, EINVAL); (cp_grant_id_t) dev_m_in->IO_GRANT, EINVAL);
return EINVAL; return EINVAL;
@ -317,7 +317,7 @@ PUBLIC int uds_select(message *dev_m_in, message *dev_m_out)
/* Can't update the process endpoint here, no info. */ /* Can't update the process endpoint here, no info. */
uds_fd_table[minor].sel_ops_in = dev_m_in->IO_ENDPT; uds_fd_table[minor].sel_ops_in = dev_m_in->USER_ENDPT;
uds_fd_table[minor].sel_ops_out = 0; uds_fd_table[minor].sel_ops_out = 0;
/* check if there is data available to read */ /* check if there is data available to read */
@ -346,7 +346,7 @@ PUBLIC int uds_select(message *dev_m_in, message *dev_m_out)
uds_fd_table[minor].syscall_done = 1; uds_fd_table[minor].syscall_done = 1;
uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->IO_ENDPT, uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->USER_ENDPT,
(cp_grant_id_t) dev_m_in->IO_GRANT, (cp_grant_id_t) dev_m_in->IO_GRANT,
uds_fd_table[minor].sel_ops_out); uds_fd_table[minor].sel_ops_out);
@ -663,7 +663,7 @@ PUBLIC int uds_read(message *dev_m_in, message *dev_m_out)
static int call_count = 0; static int call_count = 0;
printf("(uds) [%d] uds_read() call_count=%d\n", uds_minor(dev_m_in), printf("(uds) [%d] uds_read() call_count=%d\n", uds_minor(dev_m_in),
++call_count); ++call_count);
printf("Endpoint: 0x%x | Position 0x%x\n", dev_m_in->IO_ENDPT, printf("Endpoint: 0x%x | Position 0x%x\n", dev_m_in->USER_ENDPT,
dev_m_in->POSITION); dev_m_in->POSITION);
#endif #endif
@ -674,7 +674,7 @@ PUBLIC int uds_read(message *dev_m_in, message *dev_m_out)
/* attempted to close a socket that hasn't been opened -- /* attempted to close a socket that hasn't been opened --
* something is very wrong :( * something is very wrong :(
*/ */
uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->IO_ENDPT, uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->USER_ENDPT,
(cp_grant_id_t) dev_m_in->IO_GRANT, EINVAL); (cp_grant_id_t) dev_m_in->IO_GRANT, EINVAL);
return EINVAL; return EINVAL;
@ -686,7 +686,7 @@ PUBLIC int uds_read(message *dev_m_in, message *dev_m_out)
uds_fd_table[minor].syscall_done = 0; uds_fd_table[minor].syscall_done = 0;
/* Update the process endpoint. */ /* Update the process endpoint. */
uds_fd_table[minor].endpoint = dev_m_in->IO_ENDPT; uds_fd_table[minor].endpoint = dev_m_in->USER_ENDPT;
/* setup select(2) framework */ /* setup select(2) framework */
uds_fd_table[minor].selecting = 0; uds_fd_table[minor].selecting = 0;
@ -715,7 +715,7 @@ PUBLIC int uds_write(message *dev_m_in, message *dev_m_out)
static int call_count = 0; static int call_count = 0;
printf("(uds) [%d] uds_write() call_count=%d\n", uds_minor(dev_m_in), printf("(uds) [%d] uds_write() call_count=%d\n", uds_minor(dev_m_in),
++call_count); ++call_count);
printf("Endpoint: 0x%x | Position 0x%x\n", dev_m_in->IO_ENDPT, printf("Endpoint: 0x%x | Position 0x%x\n", dev_m_in->USER_ENDPT,
dev_m_in->POSITION); dev_m_in->POSITION);
#endif #endif
@ -726,7 +726,7 @@ PUBLIC int uds_write(message *dev_m_in, message *dev_m_out)
/* attempted to close a socket that hasn't been opened -- /* attempted to close a socket that hasn't been opened --
* something is very wrong :( * something is very wrong :(
*/ */
uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->IO_ENDPT, uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->USER_ENDPT,
(cp_grant_id_t) dev_m_in->IO_GRANT, EINVAL); (cp_grant_id_t) dev_m_in->IO_GRANT, EINVAL);
return EINVAL; return EINVAL;
@ -738,7 +738,7 @@ PUBLIC int uds_write(message *dev_m_in, message *dev_m_out)
uds_fd_table[minor].syscall_done = 0; uds_fd_table[minor].syscall_done = 0;
/* Update the process endpoint. */ /* Update the process endpoint. */
uds_fd_table[minor].endpoint = dev_m_in->IO_ENDPT; uds_fd_table[minor].endpoint = dev_m_in->USER_ENDPT;
/* setup select(2) framework */ /* setup select(2) framework */
uds_fd_table[minor].selecting = 0; uds_fd_table[minor].selecting = 0;
@ -766,7 +766,7 @@ PUBLIC int uds_ioctl(message *dev_m_in, message *dev_m_out)
static int call_count = 0; static int call_count = 0;
printf("(uds) [%d] uds_ioctl() call_count=%d\n", uds_minor(dev_m_in), printf("(uds) [%d] uds_ioctl() call_count=%d\n", uds_minor(dev_m_in),
++call_count); ++call_count);
printf("Endpoint: 0x%x | Position 0x%x\n", dev_m_in->IO_ENDPT, printf("Endpoint: 0x%x | Position 0x%x\n", dev_m_in->USER_ENDPT,
dev_m_in->POSITION); dev_m_in->POSITION);
#endif #endif
@ -777,7 +777,7 @@ PUBLIC int uds_ioctl(message *dev_m_in, message *dev_m_out)
/* attempted to close a socket that hasn't been opened -- /* attempted to close a socket that hasn't been opened --
* something is very wrong :( * something is very wrong :(
*/ */
uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->IO_ENDPT, uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->USER_ENDPT,
(cp_grant_id_t) dev_m_in->IO_GRANT, EINVAL); (cp_grant_id_t) dev_m_in->IO_GRANT, EINVAL);
return EINVAL; return EINVAL;
@ -950,7 +950,7 @@ PUBLIC int uds_ioctl(message *dev_m_in, message *dev_m_out)
if (rc != SUSPEND) if (rc != SUSPEND)
uds_fd_table[minor].syscall_done = 1; uds_fd_table[minor].syscall_done = 1;
uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->IO_ENDPT, uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->USER_ENDPT,
(cp_grant_id_t) dev_m_in->IO_GRANT, rc); (cp_grant_id_t) dev_m_in->IO_GRANT, rc);
return rc; return rc;
@ -964,7 +964,7 @@ PUBLIC int uds_status(message *dev_m_in, message *dev_m_out)
static int call_count = 0; static int call_count = 0;
printf("(uds) [%d] uds_status() call_count=%d\n", uds_minor(dev_m_in), printf("(uds) [%d] uds_status() call_count=%d\n", uds_minor(dev_m_in),
++call_count); ++call_count);
printf("Endpoint: 0x%x | Position 0x%x\n", dev_m_in->IO_ENDPT, dev_m_in->POSITION); printf("Endpoint: 0x%x | Position 0x%x\n", dev_m_in->USER_ENDPT, dev_m_in->POSITION);
#endif #endif
for (i = 0; i < NR_FDS; i++) { for (i = 0; i < NR_FDS; i++) {
@ -1085,7 +1085,7 @@ PUBLIC int uds_cancel(message *dev_m_in, message *dev_m_out)
static int call_count = 0; static int call_count = 0;
printf("(uds) [%d] uds_cancel() call_count=%d\n", uds_minor(dev_m_in), printf("(uds) [%d] uds_cancel() call_count=%d\n", uds_minor(dev_m_in),
++call_count); ++call_count);
printf("Endpoint: 0x%x\n", dev_m_in->IO_ENDPT); printf("Endpoint: 0x%x\n", dev_m_in->USER_ENDPT);
#endif #endif
minor = uds_minor(dev_m_in); minor = uds_minor(dev_m_in);
@ -1095,14 +1095,14 @@ PUBLIC int uds_cancel(message *dev_m_in, message *dev_m_out)
/* attempted to close a socket that hasn't been opened -- /* attempted to close a socket that hasn't been opened --
* something is very wrong :( * something is very wrong :(
*/ */
uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->IO_ENDPT, uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->USER_ENDPT,
(cp_grant_id_t) dev_m_in->IO_GRANT, EINVAL); (cp_grant_id_t) dev_m_in->IO_GRANT, EINVAL);
return EINVAL; return EINVAL;
} }
/* Update the process endpoint. */ /* Update the process endpoint. */
uds_fd_table[minor].endpoint = dev_m_in->IO_ENDPT; uds_fd_table[minor].endpoint = dev_m_in->USER_ENDPT;
/* setup select(2) framework */ /* setup select(2) framework */
uds_fd_table[minor].selecting = 0; uds_fd_table[minor].selecting = 0;
@ -1202,7 +1202,7 @@ PUBLIC int uds_cancel(message *dev_m_in, message *dev_m_out)
} }
uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->IO_ENDPT, uds_set_reply(dev_m_out, TASK_REPLY, dev_m_in->USER_ENDPT,
(cp_grant_id_t) dev_m_in->IO_GRANT, EINTR); (cp_grant_id_t) dev_m_in->IO_GRANT, EINTR);
return EINTR; return EINTR;

View file

@ -67,7 +67,7 @@ PRIVATE int check_perms(int minor, struct sockaddr_un *addr)
memset(&vfs_m, '\0', sizeof(message)); memset(&vfs_m, '\0', sizeof(message));
vfs_m.m_type = PFS_REQ_CHECK_PERMS; vfs_m.m_type = PFS_REQ_CHECK_PERMS;
vfs_m.IO_ENDPT = uds_fd_table[minor].owner; vfs_m.USER_ENDPT = uds_fd_table[minor].owner;
vfs_m.IO_GRANT = (char *) grant_id; vfs_m.IO_GRANT = (char *) grant_id;
vfs_m.COUNT = UNIX_PATH_MAX; vfs_m.COUNT = UNIX_PATH_MAX;
@ -102,7 +102,7 @@ PRIVATE filp_id_t verify_fd(endpoint_t ep, int fd)
memset(&vfs_m, '\0', sizeof(message)); memset(&vfs_m, '\0', sizeof(message));
vfs_m.m_type = PFS_REQ_VERIFY_FD; vfs_m.m_type = PFS_REQ_VERIFY_FD;
vfs_m.IO_ENDPT = ep; vfs_m.USER_ENDPT = ep;
vfs_m.COUNT = fd; vfs_m.COUNT = fd;
rc = sendrec(VFS_PROC_NR, &vfs_m); rc = sendrec(VFS_PROC_NR, &vfs_m);
@ -161,7 +161,7 @@ PRIVATE int copy_filp(endpoint_t to_ep, filp_id_t cfilp)
memset(&vfs_m, '\0', sizeof(message)); memset(&vfs_m, '\0', sizeof(message));
vfs_m.m_type = PFS_REQ_COPY_FILP; vfs_m.m_type = PFS_REQ_COPY_FILP;
vfs_m.IO_ENDPT = to_ep; vfs_m.USER_ENDPT = to_ep;
vfs_m.ADDRESS = cfilp; vfs_m.ADDRESS = cfilp;
rc = sendrec(VFS_PROC_NR, &vfs_m); rc = sendrec(VFS_PROC_NR, &vfs_m);
@ -218,7 +218,7 @@ PRIVATE int cancel_fd(endpoint_t ep, int fd)
memset(&vfs_m, '\0', sizeof(message)); memset(&vfs_m, '\0', sizeof(message));
vfs_m.m_type = PFS_REQ_CANCEL_FD; vfs_m.m_type = PFS_REQ_CANCEL_FD;
vfs_m.IO_ENDPT = ep; vfs_m.USER_ENDPT = ep;
vfs_m.COUNT = fd; vfs_m.COUNT = fd;
rc = sendrec(VFS_PROC_NR, &vfs_m); rc = sendrec(VFS_PROC_NR, &vfs_m);

View file

@ -377,13 +377,13 @@ PUBLIC int dev_io(
} }
/* By default, these are right. */ /* By default, these are right. */
dev_mess.IO_ENDPT = proc_e; dev_mess.USER_ENDPT = proc_e;
dev_mess.ADDRESS = buf; dev_mess.ADDRESS = buf;
/* Convert DEV_* to DEV_*_S variants. */ /* Convert DEV_* to DEV_*_S variants. */
buf_used = buf; buf_used = buf;
safe = safe_io_conversion(dp->dmap_driver, &gid, &op, gids, NR_IOREQS, safe = safe_io_conversion(dp->dmap_driver, &gid, &op, gids, NR_IOREQS,
(endpoint_t*) &dev_mess.IO_ENDPT, &buf_used, (endpoint_t*) &dev_mess.USER_ENDPT, &buf_used,
&vec_grants, bytes, &pos_lo); &vec_grants, bytes, &pos_lo);
if(buf != buf_used) if(buf != buf_used)
@ -402,7 +402,7 @@ PUBLIC int dev_io(
dev_mess.HIGHPOS = pos_high; dev_mess.HIGHPOS = pos_high;
/* This will be used if the i/o is suspended. */ /* This will be used if the i/o is suspended. */
ioproc = dev_mess.IO_ENDPT; ioproc = dev_mess.USER_ENDPT;
/* Call the task. */ /* Call the task. */
(*dp->dmap_io)(dp->dmap_driver, &dev_mess); (*dp->dmap_io)(dp->dmap_driver, &dev_mess);
@ -424,7 +424,7 @@ PUBLIC int dev_io(
if ((flags & O_NONBLOCK) && !(dp->dmap_style == STYLE_DEVA)) { if ((flags & O_NONBLOCK) && !(dp->dmap_style == STYLE_DEVA)) {
/* Not supposed to block. */ /* Not supposed to block. */
dev_mess.m_type = CANCEL; dev_mess.m_type = CANCEL;
dev_mess.IO_ENDPT = ioproc; dev_mess.USER_ENDPT = ioproc;
dev_mess.IO_GRANT = (char *) gid; dev_mess.IO_GRANT = (char *) gid;
/* This R_BIT/W_BIT check taken from suspend()/unpause() /* This R_BIT/W_BIT check taken from suspend()/unpause()
@ -449,7 +449,7 @@ PUBLIC int dev_io(
if (flags & O_NONBLOCK) { if (flags & O_NONBLOCK) {
/* Not supposed to block, send cancel message */ /* Not supposed to block, send cancel message */
dev_mess.m_type = CANCEL; dev_mess.m_type = CANCEL;
dev_mess.IO_ENDPT = ioproc; dev_mess.USER_ENDPT = ioproc;
dev_mess.IO_GRANT = (char *) gid; dev_mess.IO_GRANT = (char *) gid;
/* This R_BIT/W_BIT check taken from suspend()/unpause() /* This R_BIT/W_BIT check taken from suspend()/unpause()
@ -493,7 +493,7 @@ PUBLIC int gen_opcl(
dev_mess.m_type = op; dev_mess.m_type = op;
dev_mess.DEVICE = (dev >> MINOR) & BYTE; dev_mess.DEVICE = (dev >> MINOR) & BYTE;
dev_mess.IO_ENDPT = proc_e; dev_mess.USER_ENDPT = proc_e;
dev_mess.COUNT = flags; dev_mess.COUNT = flags;
if (dp->dmap_driver == NONE) { if (dp->dmap_driver == NONE) {
@ -626,7 +626,7 @@ message *mess_ptr; /* pointer to message for task */
printf("VFS: sending %d to SYSTEM\n", mess_ptr->m_type); printf("VFS: sending %d to SYSTEM\n", mess_ptr->m_type);
} }
proc_e = mess_ptr->IO_ENDPT; proc_e = mess_ptr->USER_ENDPT;
for (;;) { for (;;) {
@ -780,7 +780,7 @@ PUBLIC int clone_opcl(
dev_mess.m_type = op; dev_mess.m_type = op;
dev_mess.DEVICE = minor; dev_mess.DEVICE = minor;
dev_mess.IO_ENDPT = proc_e; dev_mess.USER_ENDPT = proc_e;
dev_mess.COUNT = flags; dev_mess.COUNT = flags;

View file

@ -174,7 +174,7 @@ int fd;
*===========================================================================*/ *===========================================================================*/
PUBLIC int do_verify_fd(void) PUBLIC int do_verify_fd(void)
{ {
m_out.ADDRESS = (void *) verify_fd(m_in.IO_ENDPT, m_in.COUNT); m_out.ADDRESS = (void *) verify_fd(m_in.USER_ENDPT, m_in.COUNT);
return (m_out.ADDRESS != NULL) ? OK : EINVAL; return (m_out.ADDRESS != NULL) ? OK : EINVAL;
} }
@ -236,7 +236,7 @@ filp_id_t cfilp;
*===========================================================================*/ *===========================================================================*/
PUBLIC int do_copy_filp(void) PUBLIC int do_copy_filp(void)
{ {
return copy_filp(m_in.IO_ENDPT, (filp_id_t) m_in.ADDRESS); return copy_filp(m_in.USER_ENDPT, (filp_id_t) m_in.ADDRESS);
} }
/*===========================================================================* /*===========================================================================*
@ -294,7 +294,7 @@ int fd;
*===========================================================================*/ *===========================================================================*/
PUBLIC int do_cancel_fd(void) PUBLIC int do_cancel_fd(void)
{ {
return cancel_fd(m_in.IO_ENDPT, m_in.COUNT); return cancel_fd(m_in.USER_ENDPT, m_in.COUNT);
} }
/*===========================================================================* /*===========================================================================*

View file

@ -533,5 +533,6 @@ int pathlen;
*===========================================================================*/ *===========================================================================*/
PUBLIC int do_check_perms(void) PUBLIC int do_check_perms(void)
{ {
return check_perms(m_in.IO_ENDPT, (cp_grant_id_t) m_in.IO_GRANT, m_in.COUNT); return check_perms(m_in.USER_ENDPT, (cp_grant_id_t) m_in.IO_GRANT,
m_in.COUNT);
} }

View file

@ -538,7 +538,7 @@ int proc_nr_e;
f = rfp->fp_filp[fild]; f = rfp->fp_filp[fild];
dev = (dev_t) f->filp_vno->v_sdev; /* device hung on */ dev = (dev_t) f->filp_vno->v_sdev; /* device hung on */
mess.TTY_LINE = (dev >> MINOR) & BYTE; mess.TTY_LINE = (dev >> MINOR) & BYTE;
mess.IO_ENDPT = rfp->fp_ioproc; mess.USER_ENDPT = rfp->fp_ioproc;
mess.IO_GRANT = (char *) rfp->fp_grant; mess.IO_GRANT = (char *) rfp->fp_grant;
/* Tell kernel R or W. Mode is from current call, not open. */ /* Tell kernel R or W. Mode is from current call, not open. */