endpoint migration for drivers.
mostly renaming message field names to the new names. tty stored process numbers in chars in tty and pty structs - now ints.
This commit is contained in:
parent
7967177710
commit
f877da3aec
18 changed files with 164 additions and 154 deletions
|
@ -438,7 +438,8 @@ PRIVATE void init_params_pci(int skip)
|
|||
continue;
|
||||
}
|
||||
|
||||
printf("init_params_pci: found device %04x/%04x at index %d\n",
|
||||
if(w_pci_debug)
|
||||
printf("init_params_pci: found device %04x/%04x at index %d\n",
|
||||
vid, did, devind);
|
||||
|
||||
/* Found a controller.
|
||||
|
@ -1661,7 +1662,7 @@ message *m;
|
|||
}
|
||||
|
||||
if (m->REQUEST == DIOCTIMEOUT) {
|
||||
if ((r=sys_datacopy(m->PROC_NR, (vir_bytes)m->ADDRESS,
|
||||
if ((r=sys_datacopy(m->IO_ENDPT, (vir_bytes)m->ADDRESS,
|
||||
SELF, (vir_bytes)&timeout, sizeof(timeout))) != OK)
|
||||
return r;
|
||||
|
||||
|
@ -1689,7 +1690,7 @@ message *m;
|
|||
}
|
||||
|
||||
if ((r=sys_datacopy(SELF, (vir_bytes)&prev,
|
||||
m->PROC_NR, (vir_bytes)m->ADDRESS, sizeof(prev))) != OK)
|
||||
m->IO_ENDPT, (vir_bytes)m->ADDRESS, sizeof(prev))) != OK)
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -1699,7 +1700,7 @@ message *m;
|
|||
if (w_prepare(m->DEVICE) == NIL_DEV) return ENXIO;
|
||||
count = w_wn->open_ct;
|
||||
if ((r=sys_datacopy(SELF, (vir_bytes)&count,
|
||||
m->PROC_NR, (vir_bytes)m->ADDRESS, sizeof(count))) != OK)
|
||||
m->IO_ENDPT, (vir_bytes)m->ADDRESS, sizeof(count))) != OK)
|
||||
return r;
|
||||
return OK;
|
||||
}
|
||||
|
|
|
@ -500,7 +500,7 @@ message *m;
|
|||
if (w_prepare(m->DEVICE) == NIL_DEV) return ENXIO;
|
||||
count = w_wn->open_ct;
|
||||
if ((r=sys_datacopy(SELF, (vir_bytes)&count,
|
||||
m->PROC_NR, (vir_bytes)m->ADDRESS, sizeof(count))) != OK)
|
||||
m->IO_ENDPT, (vir_bytes)m->ADDRESS, sizeof(count))) != OK)
|
||||
return r;
|
||||
return OK;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ PUBLIC void main(void)
|
|||
case DEV_OPEN:
|
||||
case DEV_CLOSE:
|
||||
case CANCEL:
|
||||
reply(TASK_REPLY, m.m_source, m.PROC_NR, OK);
|
||||
reply(TASK_REPLY, m.m_source, m.IO_ENDPT, OK);
|
||||
break;
|
||||
|
||||
case DEV_PING:
|
||||
|
@ -68,17 +68,17 @@ PUBLIC void main(void)
|
|||
* requests at a time.
|
||||
*/
|
||||
if (suspended != NONE) {
|
||||
reply(TASK_REPLY, m.m_source, m.PROC_NR, EBUSY);
|
||||
reply(TASK_REPLY, m.m_source, m.IO_ENDPT, EBUSY);
|
||||
break;
|
||||
}
|
||||
suspended = m.PROC_NR;
|
||||
reply(TASK_REPLY, m.m_source, m.PROC_NR, SUSPEND);
|
||||
suspended = m.IO_ENDPT;
|
||||
reply(TASK_REPLY, m.m_source, m.IO_ENDPT, SUSPEND);
|
||||
|
||||
switch(m.REQUEST) {
|
||||
case CIOCGETTIME: /* get CMOS time */
|
||||
case CIOCGETTIMEY2K:
|
||||
y2kflag = (m.REQUEST = CIOCGETTIME) ? 0 : 1;
|
||||
result = gettime(m.PROC_NR, y2kflag, (vir_bytes) m.ADDRESS);
|
||||
result = gettime(m.IO_ENDPT, y2kflag, (vir_bytes) m.ADDRESS);
|
||||
break;
|
||||
case CIOCSETTIME:
|
||||
case CIOCSETTIMEY2K:
|
||||
|
@ -107,7 +107,7 @@ PUBLIC void main(void)
|
|||
continue;
|
||||
|
||||
default:
|
||||
reply(TASK_REPLY, m.m_source, m.PROC_NR, EINVAL);
|
||||
reply(TASK_REPLY, m.m_source, m.IO_ENDPT, EINVAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ PRIVATE void reply(int code, int replyee, int process, int status)
|
|||
|
||||
m.m_type = code; /* TASK_REPLY or REVIVE */
|
||||
m.REP_STATUS = status; /* result of device operation */
|
||||
m.REP_PROC_NR = process; /* which user made the request */
|
||||
m.REP_ENDPT = process; /* which user made the request */
|
||||
if (OK != (s=send(replyee, &m)))
|
||||
panic("CMOS", "sending reply failed", s);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
*
|
||||
* The drivers support the following operations (using message format m2):
|
||||
*
|
||||
* m_type DEVICE PROC_NR COUNT POSITION ADRRESS
|
||||
* m_type DEVICE IO_ENDPT COUNT POSITION ADRRESS
|
||||
* ----------------------------------------------------------------
|
||||
* | DEV_OPEN | device | proc nr | | | |
|
||||
* |------------+---------+---------+---------+---------+---------|
|
||||
|
@ -90,7 +90,7 @@ struct driver *dp; /* Device dependent entry points. */
|
|||
if (receive(ANY, &mess) != OK) continue;
|
||||
|
||||
device_caller = mess.m_source;
|
||||
proc_nr = mess.PROC_NR;
|
||||
proc_nr = mess.IO_ENDPT;
|
||||
|
||||
/* Now carry out the work. */
|
||||
switch(mess.m_type) {
|
||||
|
@ -129,7 +129,7 @@ struct driver *dp; /* Device dependent entry points. */
|
|||
/* Finally, prepare and send the reply message. */
|
||||
if (r != EDONTREPLY) {
|
||||
mess.m_type = TASK_REPLY;
|
||||
mess.REP_PROC_NR = proc_nr;
|
||||
mess.REP_ENDPT = proc_nr;
|
||||
/* Status is # of bytes transferred or error code. */
|
||||
mess.REP_STATUS = r;
|
||||
send(device_caller, &mess);
|
||||
|
@ -178,7 +178,7 @@ message *mp; /* pointer to read or write message */
|
|||
if (mp->COUNT < 0) return(EINVAL);
|
||||
|
||||
/* Check the user buffer. */
|
||||
sys_umap(mp->PROC_NR, D, (vir_bytes) mp->ADDRESS, mp->COUNT, &phys_addr);
|
||||
sys_umap(mp->IO_ENDPT, D, (vir_bytes) mp->ADDRESS, mp->COUNT, &phys_addr);
|
||||
if (phys_addr == 0) return(EFAULT);
|
||||
|
||||
/* Prepare for I/O. */
|
||||
|
@ -190,7 +190,7 @@ message *mp; /* pointer to read or write message */
|
|||
iovec1.iov_size = mp->COUNT;
|
||||
|
||||
/* Transfer bytes from/to the device. */
|
||||
r = (*dp->dr_transfer)(mp->PROC_NR, opcode, mp->POSITION, &iovec1, 1);
|
||||
r = (*dp->dr_transfer)(mp->IO_ENDPT, opcode, mp->POSITION, &iovec1, 1);
|
||||
|
||||
/* Return the number of bytes transferred or an error code. */
|
||||
return(r == OK ? (mp->COUNT - iovec1.iov_size) : r);
|
||||
|
@ -215,10 +215,13 @@ message *mp; /* pointer to read or write message */
|
|||
|
||||
nr_req = mp->COUNT; /* Length of I/O vector */
|
||||
|
||||
#if 0
|
||||
if (mp->m_source < 0) {
|
||||
/* Called by a task, no need to copy vector. */
|
||||
iov = (iovec_t *) mp->ADDRESS;
|
||||
} else {
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
/* Copy the vector from the caller to kernel space. */
|
||||
if (nr_req > NR_IOREQS) nr_req = NR_IOREQS;
|
||||
iovec_size = (phys_bytes) (nr_req * sizeof(iovec[0]));
|
||||
|
@ -233,13 +236,14 @@ message *mp; /* pointer to read or write message */
|
|||
if ((*dp->dr_prepare)(mp->DEVICE) == NIL_DEV) return(ENXIO);
|
||||
|
||||
/* Transfer bytes from/to the device. */
|
||||
r = (*dp->dr_transfer)(mp->PROC_NR, mp->m_type, mp->POSITION, iov, nr_req);
|
||||
r = (*dp->dr_transfer)(mp->IO_ENDPT, mp->m_type, mp->POSITION, iov, nr_req);
|
||||
|
||||
/* Copy the I/O vector back to the caller. */
|
||||
#if 0
|
||||
if (mp->m_source >= 0) {
|
||||
#endif
|
||||
sys_datacopy(SELF, (vir_bytes) iovec,
|
||||
mp->m_source, (vir_bytes) mp->ADDRESS, iovec_size);
|
||||
}
|
||||
return(r);
|
||||
}
|
||||
|
||||
|
@ -353,7 +357,7 @@ message *mp; /* pointer to ioctl request */
|
|||
|
||||
if (mp->REQUEST == DIOCSETP) {
|
||||
/* Copy just this one partition table entry. */
|
||||
if (OK != (s=sys_datacopy(mp->PROC_NR, (vir_bytes) mp->ADDRESS,
|
||||
if (OK != (s=sys_datacopy(mp->IO_ENDPT, (vir_bytes) mp->ADDRESS,
|
||||
SELF, (vir_bytes) &entry, sizeof(entry))))
|
||||
return s;
|
||||
dv->dv_base = entry.base;
|
||||
|
@ -364,7 +368,7 @@ message *mp; /* pointer to ioctl request */
|
|||
entry.size = dv->dv_size;
|
||||
(*dp->dr_geometry)(&entry);
|
||||
if (OK != (s=sys_datacopy(SELF, (vir_bytes) &entry,
|
||||
mp->PROC_NR, (vir_bytes) mp->ADDRESS, sizeof(entry))))
|
||||
mp->IO_ENDPT, (vir_bytes) mp->ADDRESS, sizeof(entry))))
|
||||
return s;
|
||||
}
|
||||
return(OK);
|
||||
|
|
|
@ -29,9 +29,8 @@ $(LIBDRIVER):
|
|||
cd $d/libdriver && $(MAKE)
|
||||
|
||||
# install with other drivers
|
||||
install: /sbin/$(DRIVER)
|
||||
/sbin/$(DRIVER): $(DRIVER)
|
||||
install -o root -cs $? $@
|
||||
install: $(DRIVER)
|
||||
install -o root -cs $? /sbin/$(DRIVER)
|
||||
|
||||
# clean up local files
|
||||
clean:
|
||||
|
|
|
@ -90,7 +90,7 @@ PUBLIC int do_diagnostics(message *m)
|
|||
* user. It also saves a copy in a local buffer so that messages can be
|
||||
* reviewed at a later time.
|
||||
*/
|
||||
int proc_nr;
|
||||
int proc_nr_e;
|
||||
vir_bytes src;
|
||||
int count;
|
||||
char c;
|
||||
|
@ -98,8 +98,8 @@ PUBLIC int do_diagnostics(message *m)
|
|||
static char diagbuf[10240];
|
||||
|
||||
/* Change SELF to actual process number. */
|
||||
if ((proc_nr = m->DIAG_PROC_NR) == SELF)
|
||||
m->DIAG_PROC_NR = proc_nr = m->m_source;
|
||||
if ((proc_nr_e = m->DIAG_ENDPT) == SELF)
|
||||
m->DIAG_ENDPT = proc_nr_e = m->m_source;
|
||||
|
||||
/* Now also make a copy for the private buffer at the LOG server, so
|
||||
* that the messages can be reviewed at a later time.
|
||||
|
@ -107,7 +107,7 @@ PUBLIC int do_diagnostics(message *m)
|
|||
src = (vir_bytes) m->DIAG_PRINT_BUF;
|
||||
count = m->DIAG_BUF_COUNT;
|
||||
while (count > 0 && i < sizeof(diagbuf)-1) {
|
||||
if (sys_datacopy(proc_nr, src, SELF, (vir_bytes) &c, 1) != OK)
|
||||
if (sys_datacopy(proc_nr_e, src, SELF, (vir_bytes) &c, 1) != OK)
|
||||
break; /* stop copying on error */
|
||||
src ++;
|
||||
count --;
|
||||
|
|
|
@ -23,7 +23,7 @@ int c;
|
|||
if ((c == 0 && buf_count > 0) || buf_count == sizeof(print_buf)) {
|
||||
m.DIAG_BUF_COUNT = buf_count;
|
||||
m.DIAG_PRINT_BUF = print_buf;
|
||||
m.DIAG_PROC_NR = SELF;
|
||||
m.DIAG_ENDPT = SELF;
|
||||
m.m_type = DIAGNOSTICS; /* request TTY to output this buffer */
|
||||
_sendrec(TTY_PROC_NR, &m); /* if it fails, we give up */
|
||||
buf_count = 0; /* clear buffer for next batch */
|
||||
|
|
|
@ -346,14 +346,14 @@ PRIVATE void do_status(message *m_ptr)
|
|||
if(logdevices[d].log_proc_nr && logdevices[d].log_revive_alerted
|
||||
&& logdevices[d].log_source == m_ptr->m_source) {
|
||||
m.m_type = DEV_REVIVE;
|
||||
m.REP_PROC_NR = logdevices[d].log_proc_nr;
|
||||
m.REP_ENDPT = logdevices[d].log_proc_nr;
|
||||
m.REP_STATUS = logdevices[d].log_status;
|
||||
send(m_ptr->m_source, &m);
|
||||
logdevices[d].log_proc_nr = 0;
|
||||
logdevices[d].log_revive_alerted = 0;
|
||||
#if LOG_DEBUG
|
||||
printf("revived %d with %d bytes\n",
|
||||
m.REP_PROC_NR, m.REP_STATUS);
|
||||
m.REP_ENDPT, m.REP_STATUS);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
@ -447,10 +447,10 @@ message *m_ptr;
|
|||
return EINVAL;
|
||||
}
|
||||
|
||||
ops = m_ptr->PROC_NR & (SEL_RD|SEL_WR|SEL_ERR);
|
||||
ops = m_ptr->IO_ENDPT & (SEL_RD|SEL_WR|SEL_ERR);
|
||||
|
||||
/* Read blocks when there is no log. */
|
||||
if((m_ptr->PROC_NR & SEL_RD) && logdevices[d].log_size > 0) {
|
||||
if((m_ptr->IO_ENDPT & SEL_RD) && logdevices[d].log_size > 0) {
|
||||
#if LOG_DEBUG
|
||||
printf("log can read; size %d\n", logdevices[d].log_size);
|
||||
#endif
|
||||
|
@ -458,13 +458,13 @@ message *m_ptr;
|
|||
}
|
||||
|
||||
/* Write never blocks. */
|
||||
if(m_ptr->PROC_NR & SEL_WR) ready_ops |= SEL_WR;
|
||||
if(m_ptr->IO_ENDPT & SEL_WR) ready_ops |= SEL_WR;
|
||||
|
||||
/* Enable select calback if no operations were
|
||||
* ready to go, but operations were requested,
|
||||
* and notify was enabled.
|
||||
*/
|
||||
if((m_ptr->PROC_NR & SEL_NOTIFY) && ops && !ready_ops) {
|
||||
if((m_ptr->IO_ENDPT & SEL_NOTIFY) && ops && !ready_ops) {
|
||||
logdevices[d].log_selected |= ops;
|
||||
logdevices[d].log_select_proc = m_ptr->m_source;
|
||||
#if LOG_DEBUG
|
||||
|
|
|
@ -233,11 +233,11 @@ message *m_ptr;
|
|||
if (m_prepare(m_ptr->DEVICE) == NIL_DEV) return(ENXIO);
|
||||
if (m_device == MEM_DEV)
|
||||
{
|
||||
r = sys_enable_iop(m_ptr->PROC_NR);
|
||||
r = sys_enable_iop(m_ptr->IO_ENDPT);
|
||||
if (r != OK)
|
||||
{
|
||||
printf("m_do_open: sys_enable_iop failed for %d: %d\n",
|
||||
m_ptr->PROC_NR, r);
|
||||
m_ptr->IO_ENDPT, r);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
@ -356,7 +356,7 @@ message *m_ptr; /* pointer to control message */
|
|||
ramdev_size= m_ptr->POSITION;
|
||||
#else
|
||||
/* Get request structure */
|
||||
s= sys_vircopy(m_ptr->PROC_NR, D, (vir_bytes)m_ptr->ADDRESS,
|
||||
s= sys_vircopy(m_ptr->IO_ENDPT, D, (vir_bytes)m_ptr->ADDRESS,
|
||||
SELF, D, (vir_bytes)&ramdev_size, sizeof(ramdev_size));
|
||||
if (s != OK)
|
||||
return s;
|
||||
|
@ -405,11 +405,11 @@ message *m_ptr; /* pointer to control message */
|
|||
do_map= (m_ptr->REQUEST == MIOCMAP); /* else unmap */
|
||||
|
||||
/* Get request structure */
|
||||
r= sys_vircopy(m_ptr->PROC_NR, D, (vir_bytes)m_ptr->ADDRESS,
|
||||
r= sys_vircopy(m_ptr->IO_ENDPT, D, (vir_bytes)m_ptr->ADDRESS,
|
||||
SELF, D, (vir_bytes)&mapreq, sizeof(mapreq));
|
||||
if (r != OK)
|
||||
return r;
|
||||
r= sys_vm_map(m_ptr->PROC_NR, do_map,
|
||||
r= sys_vm_map(m_ptr->IO_ENDPT, do_map,
|
||||
(phys_bytes)mapreq.base, mapreq.size, mapreq.offset);
|
||||
return r;
|
||||
}
|
||||
|
|
|
@ -322,9 +322,11 @@ char *name;
|
|||
ior.ior_limit= ior.ior_base +
|
||||
pcidev[devind].pd_bar[i].pb_size-1;
|
||||
|
||||
printf(
|
||||
if(debug) {
|
||||
printf(
|
||||
"pci_reserve3: for proc %d, adding I/O range [0x%x..0x%x]\n",
|
||||
proc, ior.ior_base, ior.ior_limit);
|
||||
}
|
||||
r= sys_privctl(proc, SYS_PRIV_ADD_IO, 0, &ior);
|
||||
if (r != OK)
|
||||
{
|
||||
|
@ -338,9 +340,11 @@ char *name;
|
|||
mr.mr_limit= mr.mr_base +
|
||||
pcidev[devind].pd_bar[i].pb_size-1;
|
||||
|
||||
printf(
|
||||
if(debug) {
|
||||
printf(
|
||||
"pci_reserve3: for proc %d, should add memory range [0x%x..0x%x]\n",
|
||||
proc, mr.mr_base, mr.mr_limit);
|
||||
}
|
||||
r= sys_privctl(proc, SYS_PRIV_ADD_MEM, 0, &mr);
|
||||
if (r != OK)
|
||||
{
|
||||
|
@ -352,7 +356,7 @@ char *name;
|
|||
ilr= pcidev[devind].pd_ilr;
|
||||
if (ilr != PCI_ILR_UNKNOWN)
|
||||
{
|
||||
printf("pci_reserve3: adding IRQ %d\n", ilr);
|
||||
if(debug) printf("pci_reserve3: adding IRQ %d\n", ilr);
|
||||
r= sys_privctl(proc, SYS_PRIV_ADD_IRQ, ilr, NULL);
|
||||
if (r != OK)
|
||||
{
|
||||
|
@ -884,10 +888,12 @@ int devind;
|
|||
return;
|
||||
}
|
||||
}
|
||||
printf(
|
||||
if(debug) {
|
||||
printf(
|
||||
"PCI: device %d.%d.%d uses INT%c but is not assigned any IRQ\n",
|
||||
pcidev[devind].pd_busnr, pcidev[devind].pd_dev,
|
||||
pcidev[devind].pd_func, 'A' + ipr-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* DEV_WRITE: a process wants to write on a terminal
|
||||
* CANCEL: terminate a previous incomplete system call immediately
|
||||
*
|
||||
* m_type TTY_LINE PROC_NR COUNT ADDRESS
|
||||
* m_type TTY_LINE IO_ENDPT COUNT ADDRESS
|
||||
* |-------------+---------+---------+---------+---------|
|
||||
* | DEV_OPEN | | | | |
|
||||
* |-------------+---------+---------+---------+---------|
|
||||
|
@ -135,7 +135,7 @@ PUBLIC void main(void)
|
|||
do_initialize(); /* initialize */
|
||||
/* fall through */
|
||||
case DEV_CLOSE:
|
||||
reply(TASK_REPLY, pr_mess.m_source, pr_mess.PROC_NR, OK);
|
||||
reply(TASK_REPLY, pr_mess.m_source, pr_mess.IO_ENDPT, OK);
|
||||
break;
|
||||
case DEV_WRITE: do_write(&pr_mess); break;
|
||||
case DEV_STATUS: do_status(&pr_mess); break;
|
||||
|
@ -144,7 +144,7 @@ PUBLIC void main(void)
|
|||
case SYS_SIG: do_signal(&pr_mess); break;
|
||||
case DEV_PING: notify(pr_mess.m_source); break;
|
||||
default:
|
||||
reply(TASK_REPLY, pr_mess.m_source, pr_mess.PROC_NR, EINVAL);
|
||||
reply(TASK_REPLY, pr_mess.m_source, pr_mess.IO_ENDPT, EINVAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -185,14 +185,14 @@ register message *m_ptr; /* pointer to the newly arrived message */
|
|||
else if (m_ptr->COUNT <= 0) r = EINVAL;
|
||||
|
||||
/* Reply to FS, no matter what happened, possible SUSPEND caller. */
|
||||
reply(TASK_REPLY, m_ptr->m_source, m_ptr->PROC_NR, r);
|
||||
reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, r);
|
||||
|
||||
/* If no errors occurred, continue printing with SUSPENDED caller.
|
||||
* First wait until the printer is online to prevent stupid errors.
|
||||
*/
|
||||
if (SUSPEND == r) {
|
||||
caller = m_ptr->m_source;
|
||||
proc_nr = m_ptr->PROC_NR;
|
||||
proc_nr = m_ptr->IO_ENDPT;
|
||||
user_left = m_ptr->COUNT;
|
||||
orig_count = m_ptr->COUNT;
|
||||
user_vir = (vir_bytes) m_ptr->ADDRESS;
|
||||
|
@ -261,7 +261,7 @@ register message *m_ptr; /* pointer to the newly arrived message */
|
|||
{
|
||||
if (revive_pending) {
|
||||
m_ptr->m_type = DEV_REVIVE; /* build message */
|
||||
m_ptr->REP_PROC_NR = proc_nr;
|
||||
m_ptr->REP_ENDPT = proc_nr;
|
||||
m_ptr->REP_STATUS = revive_status;
|
||||
|
||||
writing = FALSE; /* unmark event */
|
||||
|
@ -284,12 +284,12 @@ register message *m_ptr; /* pointer to the newly arrived message */
|
|||
* but rely on FS to handle the EINTR reply and de-suspension properly.
|
||||
*/
|
||||
|
||||
if (writing && m_ptr->PROC_NR == proc_nr) {
|
||||
if (writing && m_ptr->IO_ENDPT == proc_nr) {
|
||||
oleft = 0; /* cancel output by interrupt handler */
|
||||
writing = FALSE;
|
||||
revive_pending = FALSE;
|
||||
}
|
||||
reply(TASK_REPLY, m_ptr->m_source, m_ptr->PROC_NR, EINTR);
|
||||
reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, EINTR);
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
|
@ -307,7 +307,7 @@ int status; /* number of chars printed or error code */
|
|||
|
||||
pr_mess.m_type = code; /* TASK_REPLY or REVIVE */
|
||||
pr_mess.REP_STATUS = status; /* count or EIO */
|
||||
pr_mess.REP_PROC_NR = process; /* which user does this pertain to */
|
||||
pr_mess.REP_ENDPT = process; /* which user does this pertain to */
|
||||
send(replyee, &pr_mess); /* send the message */
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* The driver supports the following operations (using message format m2):
|
||||
*
|
||||
* m_type DEVICE PROC_NR COUNT POSITION ADRRESS
|
||||
* m_type DEVICE IO_ENDPT COUNT POSITION ADRRESS
|
||||
* ----------------------------------------------------------------
|
||||
* | DEV_OPEN | device | proc nr | | | |
|
||||
* |------------+---------+---------+---------+---------+---------|
|
||||
|
@ -95,7 +95,7 @@ PUBLIC void main()
|
|||
receive(ANY, &mess);
|
||||
|
||||
caller = mess.m_source;
|
||||
proc_nr = mess.PROC_NR;
|
||||
proc_nr = mess.IO_ENDPT;
|
||||
|
||||
/* Now carry out the work. */
|
||||
switch(mess.m_type) {
|
||||
|
@ -178,7 +178,7 @@ message *m_ptr;
|
|||
|
||||
/* Get user data */
|
||||
if(m_ptr->REQUEST != DSPIORESET) {
|
||||
sys_vircopy(m_ptr->PROC_NR, D, (vir_bytes)m_ptr->ADDRESS, SELF, D, (vir_bytes)&val, sizeof(val));
|
||||
sys_vircopy(m_ptr->IO_ENDPT, D, (vir_bytes)m_ptr->ADDRESS, SELF, D, (vir_bytes)&val, sizeof(val));
|
||||
}
|
||||
|
||||
dprint("dsp_ioctl: got ioctl %d, argument: %d\n", m_ptr->REQUEST, val);
|
||||
|
@ -191,7 +191,7 @@ message *m_ptr;
|
|||
case DSPIOSIGN: status = dsp_set_sign(val); break;
|
||||
case DSPIOMAX:
|
||||
val = DSP_MAX_FRAGMENT_SIZE;
|
||||
sys_vircopy(SELF, D, (vir_bytes)&val, m_ptr->PROC_NR, D, (vir_bytes)m_ptr->ADDRESS, sizeof(val));
|
||||
sys_vircopy(SELF, D, (vir_bytes)&val, m_ptr->IO_ENDPT, D, (vir_bytes)m_ptr->ADDRESS, sizeof(val));
|
||||
status = OK;
|
||||
break;
|
||||
case DSPIORESET: status = dsp_reset(); break;
|
||||
|
@ -214,20 +214,20 @@ message *m_ptr;
|
|||
dprint("sb16_dsp.c: dsp_write()\n");
|
||||
|
||||
if(m_ptr->COUNT != DspFragmentSize) {
|
||||
reply(TASK_REPLY, m_ptr->m_source, m_ptr->PROC_NR, EINVAL);
|
||||
reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, EINVAL);
|
||||
return;
|
||||
}
|
||||
if(m_ptr->m_type != DmaMode && DmaBusy >= 0) {
|
||||
reply(TASK_REPLY, m_ptr->m_source, m_ptr->PROC_NR, EBUSY);
|
||||
reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, EBUSY);
|
||||
return;
|
||||
}
|
||||
|
||||
reply(TASK_REPLY, m_ptr->m_source, m_ptr->PROC_NR, SUSPEND);
|
||||
reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, SUSPEND);
|
||||
|
||||
if(DmaBusy < 0) { /* Dma tranfer not yet started */
|
||||
|
||||
DmaMode = DEV_WRITE; /* Dma mode is writing */
|
||||
sys_datacopy(m_ptr->PROC_NR, (vir_bytes)m_ptr->ADDRESS, SELF, (vir_bytes)DmaPtr, (phys_bytes)DspFragmentSize);
|
||||
sys_datacopy(m_ptr->IO_ENDPT, (vir_bytes)m_ptr->ADDRESS, SELF, (vir_bytes)DmaPtr, (phys_bytes)DspFragmentSize);
|
||||
dsp_dma_setup(DmaPhys, DspFragmentSize * DMA_NR_OF_BUFFERS);
|
||||
dsp_setup();
|
||||
DmaBusy = 0; /* Dma is busy */
|
||||
|
@ -236,13 +236,13 @@ message *m_ptr;
|
|||
|
||||
} else if(DmaBusy != DmaFillNext) { /* Dma transfer started, but Dma buffer not yet full */
|
||||
|
||||
sys_datacopy(m_ptr->PROC_NR, (vir_bytes)m_ptr->ADDRESS, SELF, (vir_bytes)DmaPtr + DmaFillNext * DspFragmentSize, (phys_bytes)DspFragmentSize);
|
||||
sys_datacopy(m_ptr->IO_ENDPT, (vir_bytes)m_ptr->ADDRESS, SELF, (vir_bytes)DmaPtr + DmaFillNext * DspFragmentSize, (phys_bytes)DspFragmentSize);
|
||||
dprint(" filled dma[%d]\n", DmaFillNext);
|
||||
DmaFillNext = (DmaFillNext + 1) % DMA_NR_OF_BUFFERS;
|
||||
|
||||
} else if(BufReadNext < 0) { /* Dma buffer full, fill first element of second buffer */
|
||||
|
||||
sys_datacopy(m_ptr->PROC_NR, (vir_bytes)m_ptr->ADDRESS, SELF, (vir_bytes)Buffer, (phys_bytes)DspFragmentSize);
|
||||
sys_datacopy(m_ptr->IO_ENDPT, (vir_bytes)m_ptr->ADDRESS, SELF, (vir_bytes)Buffer, (phys_bytes)DspFragmentSize);
|
||||
dprint(" filled buf[0]\n");
|
||||
BufReadNext = 0;
|
||||
BufFillNext = 1;
|
||||
|
@ -253,7 +253,7 @@ message *m_ptr;
|
|||
receive(HARDWARE, &mess);
|
||||
dsp_hardware_msg();
|
||||
}
|
||||
sys_datacopy(m_ptr->PROC_NR, (vir_bytes)m_ptr->ADDRESS, SELF, (vir_bytes)Buffer + BufFillNext * DspFragmentSize, (phys_bytes)DspFragmentSize);
|
||||
sys_datacopy(m_ptr->IO_ENDPT, (vir_bytes)m_ptr->ADDRESS, SELF, (vir_bytes)Buffer + BufFillNext * DspFragmentSize, (phys_bytes)DspFragmentSize);
|
||||
dprint(" filled buf[%d]\n", BufFillNext);
|
||||
BufFillNext = (BufFillNext + 1) % DSP_NR_OF_BUFFERS;
|
||||
|
||||
|
@ -261,7 +261,7 @@ message *m_ptr;
|
|||
|
||||
revivePending = 1;
|
||||
reviveStatus = DspFragmentSize;
|
||||
reviveProcNr = m_ptr->PROC_NR;
|
||||
reviveProcNr = m_ptr->IO_ENDPT;
|
||||
notify(m_ptr->m_source);
|
||||
}
|
||||
|
||||
|
@ -315,7 +315,7 @@ message *m_ptr; /* pointer to the newly arrived message */
|
|||
{
|
||||
if(revivePending) {
|
||||
m_ptr->m_type = DEV_REVIVE; /* build message */
|
||||
m_ptr->REP_PROC_NR = reviveProcNr;
|
||||
m_ptr->REP_ENDPT = reviveProcNr;
|
||||
m_ptr->REP_STATUS = reviveStatus;
|
||||
|
||||
revivePending = 0; /* unmark event */
|
||||
|
@ -340,7 +340,7 @@ int status;
|
|||
|
||||
m.m_type = code; /* TASK_REPLY or REVIVE */
|
||||
m.REP_STATUS = status; /* result of device operation */
|
||||
m.REP_PROC_NR = process; /* which user made the request */
|
||||
m.REP_ENDPT = process; /* which user made the request */
|
||||
|
||||
send(replyee, &m);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* The driver supports the following operations (using message format m2):
|
||||
*
|
||||
* m_type DEVICE PROC_NR COUNT POSITION ADRRESS
|
||||
* m_type DEVICE IO_ENDPT COUNT POSITION ADRRESS
|
||||
* ----------------------------------------------------------------
|
||||
* | DEV_OPEN | device | proc nr | | | |
|
||||
* |------------+---------+---------+---------+---------+---------|
|
||||
|
@ -55,7 +55,7 @@ message mess;
|
|||
receive(ANY, &mess);
|
||||
|
||||
caller = mess.m_source;
|
||||
proc_nr = mess.PROC_NR;
|
||||
proc_nr = mess.IO_ENDPT;
|
||||
|
||||
switch (caller) {
|
||||
case HARDWARE: /* Leftover interrupt. */
|
||||
|
@ -77,7 +77,7 @@ message mess;
|
|||
|
||||
/* Finally, prepare and send the reply message. */
|
||||
mess.m_type = TASK_REPLY;
|
||||
mess.REP_PROC_NR = proc_nr;
|
||||
mess.REP_ENDPT = proc_nr;
|
||||
|
||||
dprint("%d %d", err, OK);
|
||||
|
||||
|
@ -191,7 +191,7 @@ int flag; /* 0 = get, 1 = set */
|
|||
struct volume_level level;
|
||||
int cmd_left, cmd_right, shift, max_level;
|
||||
|
||||
sys_datacopy(m_ptr->PROC_NR, (vir_bytes)m_ptr->ADDRESS, SELF, (vir_bytes)&level, (phys_bytes)sizeof(level));
|
||||
sys_datacopy(m_ptr->IO_ENDPT, (vir_bytes)m_ptr->ADDRESS, SELF, (vir_bytes)&level, (phys_bytes)sizeof(level));
|
||||
|
||||
shift = 3;
|
||||
max_level = 0x1F;
|
||||
|
@ -257,7 +257,7 @@ int flag; /* 0 = get, 1 = set */
|
|||
level.right >>= shift;
|
||||
|
||||
/* Copy back to user */
|
||||
sys_datacopy(SELF, (vir_bytes)&level, m_ptr->PROC_NR, (vir_bytes)m_ptr->ADDRESS, (phys_bytes)sizeof(level));
|
||||
sys_datacopy(SELF, (vir_bytes)&level, m_ptr->IO_ENDPT, (vir_bytes)m_ptr->ADDRESS, (phys_bytes)sizeof(level));
|
||||
}
|
||||
|
||||
return OK;
|
||||
|
@ -276,7 +276,7 @@ int channel; /* 0 = left, 1 = right */
|
|||
struct inout_ctrl input;
|
||||
int input_cmd, input_mask, mask, del_mask, shift;
|
||||
|
||||
sys_datacopy(m_ptr->PROC_NR, (vir_bytes)m_ptr->ADDRESS, SELF, (vir_bytes)&input, (phys_bytes)sizeof(input));
|
||||
sys_datacopy(m_ptr->IO_ENDPT, (vir_bytes)m_ptr->ADDRESS, SELF, (vir_bytes)&input, (phys_bytes)sizeof(input));
|
||||
|
||||
input_cmd = (channel == 0 ? MIXER_IN_LEFT : MIXER_IN_RIGHT);
|
||||
|
||||
|
@ -322,7 +322,7 @@ int channel; /* 0 = left, 1 = right */
|
|||
}
|
||||
|
||||
/* Copy back to user */
|
||||
sys_datacopy(SELF, (vir_bytes)&input, m_ptr->PROC_NR, (vir_bytes)m_ptr->ADDRESS, (phys_bytes)sizeof(input));
|
||||
sys_datacopy(SELF, (vir_bytes)&input, m_ptr->IO_ENDPT, (vir_bytes)m_ptr->ADDRESS, (phys_bytes)sizeof(input));
|
||||
}
|
||||
|
||||
return OK;
|
||||
|
@ -340,7 +340,7 @@ int flag; /* 0 = get, 1 = set */
|
|||
struct inout_ctrl output;
|
||||
int output_mask, mask, del_mask, shift;
|
||||
|
||||
sys_datacopy(m_ptr->PROC_NR, (vir_bytes)m_ptr->ADDRESS, SELF, (vir_bytes)&output, (phys_bytes)sizeof(output));
|
||||
sys_datacopy(m_ptr->IO_ENDPT, (vir_bytes)m_ptr->ADDRESS, SELF, (vir_bytes)&output, (phys_bytes)sizeof(output));
|
||||
|
||||
mask = mixer_get(MIXER_OUTPUT_CTRL);
|
||||
|
||||
|
@ -380,7 +380,7 @@ int flag; /* 0 = get, 1 = set */
|
|||
}
|
||||
|
||||
/* Copy back to user */
|
||||
sys_datacopy(SELF, (vir_bytes)&output, m_ptr->PROC_NR, (vir_bytes)m_ptr->ADDRESS, (phys_bytes)sizeof(output));
|
||||
sys_datacopy(SELF, (vir_bytes)&output, m_ptr->IO_ENDPT, (vir_bytes)m_ptr->ADDRESS, (phys_bytes)sizeof(output));
|
||||
}
|
||||
|
||||
return OK;
|
||||
|
|
|
@ -795,19 +795,19 @@ PUBLIC void do_video(message *m)
|
|||
do_map= (m->REQUEST == MIOCMAP); /* else unmap */
|
||||
|
||||
/* Get request structure */
|
||||
r= sys_vircopy(m->PROC_NR, D,
|
||||
r= sys_vircopy(m->IO_ENDPT, D,
|
||||
(vir_bytes)m->ADDRESS,
|
||||
SELF, D, (vir_bytes)&mapreq, sizeof(mapreq));
|
||||
if (r != OK)
|
||||
{
|
||||
tty_reply(TASK_REPLY, m->m_source, m->PROC_NR,
|
||||
tty_reply(TASK_REPLY, m->m_source, m->IO_ENDPT,
|
||||
r);
|
||||
return;
|
||||
}
|
||||
r= sys_vm_map(m->PROC_NR, do_map,
|
||||
r= sys_vm_map(m->IO_ENDPT, do_map,
|
||||
(phys_bytes)mapreq.base, mapreq.size,
|
||||
mapreq.offset);
|
||||
tty_reply(TASK_REPLY, m->m_source, m->PROC_NR, r);
|
||||
tty_reply(TASK_REPLY, m->m_source, m->IO_ENDPT, r);
|
||||
return;
|
||||
}
|
||||
r= ENOTTY;
|
||||
|
@ -819,7 +819,7 @@ PUBLIC void do_video(message *m)
|
|||
m->m_type, m->m_source);
|
||||
r= EINVAL;
|
||||
}
|
||||
tty_reply(TASK_REPLY, m->m_source, m->PROC_NR, r);
|
||||
tty_reply(TASK_REPLY, m->m_source, m->IO_ENDPT, r);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1058,7 +1058,7 @@ message *m_ptr; /* pointer to request message */
|
|||
vir_bytes src;
|
||||
int count;
|
||||
int result = OK;
|
||||
int proc_nr = m_ptr->DIAG_PROC_NR;
|
||||
int proc_nr = m_ptr->DIAG_ENDPT;
|
||||
if (proc_nr == SELF) proc_nr = m_ptr->m_source;
|
||||
|
||||
src = (vir_bytes) m_ptr->DIAG_PRINT_BUF;
|
||||
|
@ -1204,7 +1204,7 @@ message *m;
|
|||
if (!machine.vdu_ega) return(ENOTTY);
|
||||
result = ga_program(seq1); /* bring font memory into view */
|
||||
|
||||
result = sys_physcopy(m->PROC_NR, D, (vir_bytes) m->ADDRESS,
|
||||
result = sys_physcopy(m->IO_ENDPT, D, (vir_bytes) m->ADDRESS,
|
||||
NONE, PHYS_SEG, (phys_bytes) GA_VIDEO_ADDRESS, (phys_bytes)GA_FONT_SIZE);
|
||||
|
||||
result = ga_program(seq2); /* restore */
|
||||
|
|
|
@ -220,7 +220,7 @@ message *m;
|
|||
{
|
||||
/* Should record proc */
|
||||
kbdp->req_size= m->COUNT;
|
||||
kbdp->req_proc= m->PROC_NR;
|
||||
kbdp->req_proc= m->IO_ENDPT;
|
||||
kbdp->req_addr= (vir_bytes)m->ADDRESS;
|
||||
kbdp->incaller= m->m_source;
|
||||
r= SUSPEND;
|
||||
|
@ -236,7 +236,7 @@ message *m;
|
|||
if (n <= 0)
|
||||
panic("TTY", "do_kbd(READ): bad n", n);
|
||||
r= sys_vircopy(SELF, D, (vir_bytes)&kbdp->buf[kbdp->offset],
|
||||
m->PROC_NR, D, (vir_bytes) m->ADDRESS, n);
|
||||
m->IO_ENDPT, D, (vir_bytes) m->ADDRESS, n);
|
||||
if (r == OK)
|
||||
{
|
||||
kbdp->offset= (kbdp->offset+n) % KBD_BUFSZ;
|
||||
|
@ -260,7 +260,7 @@ message *m;
|
|||
*/
|
||||
for (i= 0; i<m->COUNT; i++)
|
||||
{
|
||||
r= sys_vircopy(m->PROC_NR, D, (vir_bytes) m->ADDRESS+i,
|
||||
r= sys_vircopy(m->IO_ENDPT, D, (vir_bytes) m->ADDRESS+i,
|
||||
SELF, D, (vir_bytes)&c, 1);
|
||||
if (r != OK)
|
||||
break;
|
||||
|
@ -274,8 +274,8 @@ message *m;
|
|||
r= OK;
|
||||
break;
|
||||
case DEV_SELECT:
|
||||
ops = m->PROC_NR & (SEL_RD|SEL_WR|SEL_ERR);
|
||||
watch = (m->PROC_NR & SEL_NOTIFY) ? 1 : 0;
|
||||
ops = m->IO_ENDPT & (SEL_RD|SEL_WR|SEL_ERR);
|
||||
watch = (m->IO_ENDPT & SEL_NOTIFY) ? 1 : 0;
|
||||
|
||||
r= 0;
|
||||
if (kbdp->avail && (ops & SEL_RD))
|
||||
|
@ -296,7 +296,7 @@ message *m;
|
|||
kio_leds_t leds;
|
||||
unsigned char b;
|
||||
|
||||
r= sys_vircopy(m->PROC_NR, D, (vir_bytes) m->ADDRESS,
|
||||
r= sys_vircopy(m->IO_ENDPT, D, (vir_bytes) m->ADDRESS,
|
||||
SELF, D, (vir_bytes)&leds, sizeof(leds));
|
||||
if (r != OK)
|
||||
break;
|
||||
|
@ -330,7 +330,7 @@ message *m;
|
|||
kio_bell_t bell;
|
||||
clock_t ticks;
|
||||
|
||||
r= sys_vircopy(m->PROC_NR, D, (vir_bytes) m->ADDRESS,
|
||||
r= sys_vircopy(m->IO_ENDPT, D, (vir_bytes) m->ADDRESS,
|
||||
SELF, D, (vir_bytes)&bell, sizeof(bell));
|
||||
if (r != OK)
|
||||
break;
|
||||
|
@ -352,7 +352,7 @@ message *m;
|
|||
m->m_type, m->m_source);
|
||||
r= EINVAL;
|
||||
}
|
||||
tty_reply(TASK_REPLY, m->m_source, m->PROC_NR, r);
|
||||
tty_reply(TASK_REPLY, m->m_source, m->IO_ENDPT, r);
|
||||
}
|
||||
|
||||
|
||||
|
@ -386,7 +386,7 @@ message *m;
|
|||
}
|
||||
|
||||
m->m_type = DEV_REVIVE;
|
||||
m->REP_PROC_NR= kbdp->req_proc;
|
||||
m->REP_ENDPT= kbdp->req_proc;
|
||||
m->REP_STATUS= r;
|
||||
return 1;
|
||||
}
|
||||
|
@ -927,7 +927,7 @@ message *m;
|
|||
{
|
||||
/* Load a new keymap. */
|
||||
int result;
|
||||
result = sys_vircopy(m->PROC_NR, D, (vir_bytes) m->ADDRESS,
|
||||
result = sys_vircopy(m->IO_ENDPT, D, (vir_bytes) m->ADDRESS,
|
||||
SELF, D, (vir_bytes) keymap,
|
||||
(vir_bytes) sizeof(keymap));
|
||||
return(result);
|
||||
|
|
|
@ -34,16 +34,16 @@ typedef struct pty {
|
|||
|
||||
/* Read call on /dev/ptypX. */
|
||||
char rdsendreply; /* send a reply (instead of notify) */
|
||||
char rdcaller; /* process making the call (usually FS) */
|
||||
char rdproc; /* process that wants to read from the pty */
|
||||
int rdcaller; /* process making the call (usually FS) */
|
||||
int rdproc; /* process that wants to read from the pty */
|
||||
vir_bytes rdvir; /* virtual address in readers address space */
|
||||
int rdleft; /* # bytes yet to be read */
|
||||
int rdcum; /* # bytes written so far */
|
||||
|
||||
/* Write call to /dev/ptypX. */
|
||||
char wrsendreply; /* send a reply (instead of notify) */
|
||||
char wrcaller; /* process making the call (usually FS) */
|
||||
char wrproc; /* process that wants to write to the pty */
|
||||
int wrcaller; /* process making the call (usually FS) */
|
||||
int wrproc; /* process that wants to write to the pty */
|
||||
vir_bytes wrvir; /* virtual address in writers address space */
|
||||
int wrleft; /* # bytes yet to be written */
|
||||
int wrcum; /* # bytes written so far */
|
||||
|
@ -103,17 +103,17 @@ message *m_ptr;
|
|||
break;
|
||||
}
|
||||
#if DEAD_CODE
|
||||
if (numap_local(m_ptr->PROC_NR, (vir_bytes) m_ptr->ADDRESS,
|
||||
if (numap_local(m_ptr->IO_ENDPT, (vir_bytes) m_ptr->ADDRESS,
|
||||
m_ptr->COUNT) == 0) {
|
||||
#else
|
||||
if ((r = sys_umap(m_ptr->PROC_NR, D, (vir_bytes) m_ptr->ADDRESS,
|
||||
if ((r = sys_umap(m_ptr->IO_ENDPT, D, (vir_bytes) m_ptr->ADDRESS,
|
||||
m_ptr->COUNT, &p)) != OK) {
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
pp->rdsendreply = TRUE;
|
||||
pp->rdcaller = m_ptr->m_source;
|
||||
pp->rdproc = m_ptr->PROC_NR;
|
||||
pp->rdproc = m_ptr->IO_ENDPT;
|
||||
pp->rdvir = (vir_bytes) m_ptr->ADDRESS;
|
||||
pp->rdleft = m_ptr->COUNT;
|
||||
pty_start(pp);
|
||||
|
@ -144,18 +144,18 @@ message *m_ptr;
|
|||
break;
|
||||
}
|
||||
#if DEAD_CODE
|
||||
if (numap_local(m_ptr->PROC_NR, (vir_bytes) m_ptr->ADDRESS,
|
||||
if (numap_local(m_ptr->IO_ENDPT, (vir_bytes) m_ptr->ADDRESS,
|
||||
m_ptr->COUNT) == 0) {
|
||||
r = EFAULT;
|
||||
#else
|
||||
if ((r = sys_umap(m_ptr->PROC_NR, D, (vir_bytes) m_ptr->ADDRESS,
|
||||
if ((r = sys_umap(m_ptr->IO_ENDPT, D, (vir_bytes) m_ptr->ADDRESS,
|
||||
m_ptr->COUNT, &p)) != OK) {
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
pp->wrsendreply = TRUE;
|
||||
pp->wrcaller = m_ptr->m_source;
|
||||
pp->wrproc = m_ptr->PROC_NR;
|
||||
pp->wrproc = m_ptr->IO_ENDPT;
|
||||
pp->wrvir = (vir_bytes) m_ptr->ADDRESS;
|
||||
pp->wrleft = m_ptr->COUNT;
|
||||
handle_events(tp);
|
||||
|
@ -192,11 +192,11 @@ message *m_ptr;
|
|||
break;
|
||||
|
||||
case CANCEL:
|
||||
if (m_ptr->PROC_NR == pp->rdproc) {
|
||||
if (m_ptr->IO_ENDPT == pp->rdproc) {
|
||||
/* Cancel a read from a PTY. */
|
||||
pp->rdleft = pp->rdcum = 0;
|
||||
}
|
||||
if (m_ptr->PROC_NR == pp->wrproc) {
|
||||
if (m_ptr->IO_ENDPT == pp->wrproc) {
|
||||
/* Cancel a write to a PTY. */
|
||||
pp->wrleft = pp->wrcum = 0;
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ message *m_ptr;
|
|||
default:
|
||||
r = EINVAL;
|
||||
}
|
||||
tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->PROC_NR, r);
|
||||
tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, r);
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
|
@ -511,7 +511,7 @@ PUBLIC int pty_status(message *m_ptr)
|
|||
pp->rdcaller == m_ptr->m_source)
|
||||
{
|
||||
m_ptr->m_type = DEV_REVIVE;
|
||||
m_ptr->REP_PROC_NR = pp->rdproc;
|
||||
m_ptr->REP_ENDPT = pp->rdproc;
|
||||
m_ptr->REP_STATUS = pp->rdcum;
|
||||
|
||||
pp->rdleft = pp->rdcum = 0;
|
||||
|
@ -524,7 +524,7 @@ PUBLIC int pty_status(message *m_ptr)
|
|||
pp->wrcaller == m_ptr->m_source)
|
||||
{
|
||||
m_ptr->m_type = DEV_REVIVE;
|
||||
m_ptr->REP_PROC_NR = pp->wrproc;
|
||||
m_ptr->REP_ENDPT = pp->wrproc;
|
||||
if (pp->wrcum == 0)
|
||||
m_ptr->REP_STATUS = EIO;
|
||||
else
|
||||
|
@ -596,8 +596,8 @@ PRIVATE int pty_select(tty_t *tp, message *m)
|
|||
pty_t *pp = tp->tty_priv;
|
||||
int ops, ready_ops = 0, watch;
|
||||
|
||||
ops = m->PROC_NR & (SEL_RD|SEL_WR|SEL_ERR);
|
||||
watch = (m->PROC_NR & SEL_NOTIFY) ? 1 : 0;
|
||||
ops = m->IO_ENDPT & (SEL_RD|SEL_WR|SEL_ERR);
|
||||
watch = (m->IO_ENDPT & SEL_NOTIFY) ? 1 : 0;
|
||||
|
||||
ready_ops = select_try_pty(tp, ops);
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
* DEV_STATUS: FS wants to know status for SELECT or REVIVE
|
||||
* CANCEL: terminate a previous incomplete system call immediately
|
||||
*
|
||||
* m_type TTY_LINE PROC_NR COUNT TTY_SPEK TTY_FLAGS ADDRESS
|
||||
* m_type TTY_LINE IO_ENDPT COUNT TTY_SPEK TTY_FLAGS ADDRESS
|
||||
* ---------------------------------------------------------------------------
|
||||
* | HARD_INT | | | | | | |
|
||||
* |-------------+---------+---------+---------+---------+---------+---------|
|
||||
|
@ -302,7 +302,7 @@ PUBLIC void main(void)
|
|||
if (tty_mess.m_source != LOG_PROC_NR)
|
||||
{
|
||||
tty_reply(TASK_REPLY, tty_mess.m_source,
|
||||
tty_mess.PROC_NR, ENXIO);
|
||||
tty_mess.IO_ENDPT, ENXIO);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -320,7 +320,7 @@ PUBLIC void main(void)
|
|||
printf("Warning, TTY got unexpected request %d from %d\n",
|
||||
tty_mess.m_type, tty_mess.m_source);
|
||||
tty_reply(TASK_REPLY, tty_mess.m_source,
|
||||
tty_mess.PROC_NR, EINVAL);
|
||||
tty_mess.IO_ENDPT, EINVAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -358,7 +358,7 @@ message *m_ptr;
|
|||
|
||||
/* Suspended request finished. Send a REVIVE. */
|
||||
m_ptr->m_type = DEV_REVIVE;
|
||||
m_ptr->REP_PROC_NR = tp->tty_inproc;
|
||||
m_ptr->REP_ENDPT = tp->tty_inproc;
|
||||
m_ptr->REP_STATUS = tp->tty_incum;
|
||||
|
||||
tp->tty_inleft = tp->tty_incum = 0;
|
||||
|
@ -370,7 +370,7 @@ message *m_ptr;
|
|||
|
||||
/* Suspended request finished. Send a REVIVE. */
|
||||
m_ptr->m_type = DEV_REVIVE;
|
||||
m_ptr->REP_PROC_NR = tp->tty_outproc;
|
||||
m_ptr->REP_ENDPT = tp->tty_outproc;
|
||||
m_ptr->REP_STATUS = tp->tty_outcum;
|
||||
|
||||
tp->tty_outcum = 0;
|
||||
|
@ -421,7 +421,7 @@ register message *m_ptr; /* pointer to message sent to the task */
|
|||
if (more_verbose) printf("do_read: EINVAL\n");
|
||||
r = EINVAL;
|
||||
} else
|
||||
if (sys_umap(m_ptr->PROC_NR, D, (vir_bytes) m_ptr->ADDRESS, m_ptr->COUNT,
|
||||
if (sys_umap(m_ptr->IO_ENDPT, D, (vir_bytes) m_ptr->ADDRESS, m_ptr->COUNT,
|
||||
&phys_addr) != OK) {
|
||||
if (more_verbose) printf("do_read: EFAULT\n");
|
||||
r = EFAULT;
|
||||
|
@ -429,7 +429,7 @@ register message *m_ptr; /* pointer to message sent to the task */
|
|||
/* Copy information from the message to the tty struct. */
|
||||
tp->tty_inrepcode = TASK_REPLY;
|
||||
tp->tty_incaller = m_ptr->m_source;
|
||||
tp->tty_inproc = m_ptr->PROC_NR;
|
||||
tp->tty_inproc = m_ptr->IO_ENDPT;
|
||||
tp->tty_in_vir = (vir_bytes) m_ptr->ADDRESS;
|
||||
tp->tty_inleft = m_ptr->COUNT;
|
||||
|
||||
|
@ -474,7 +474,7 @@ register message *m_ptr; /* pointer to message sent to the task */
|
|||
}
|
||||
}
|
||||
if (more_verbose) printf("do_read: replying %d\n", r);
|
||||
tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->PROC_NR, r);
|
||||
tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, r);
|
||||
if (tp->tty_select_ops)
|
||||
select_retry(tp);
|
||||
}
|
||||
|
@ -499,14 +499,14 @@ register message *m_ptr; /* pointer to message sent to the task */
|
|||
if (m_ptr->COUNT <= 0) {
|
||||
r = EINVAL;
|
||||
} else
|
||||
if (sys_umap(m_ptr->PROC_NR, D, (vir_bytes) m_ptr->ADDRESS, m_ptr->COUNT,
|
||||
if (sys_umap(m_ptr->IO_ENDPT, D, (vir_bytes) m_ptr->ADDRESS, m_ptr->COUNT,
|
||||
&phys_addr) != OK) {
|
||||
r = EFAULT;
|
||||
} else {
|
||||
/* Copy message parameters to the tty structure. */
|
||||
tp->tty_outrepcode = TASK_REPLY;
|
||||
tp->tty_outcaller = m_ptr->m_source;
|
||||
tp->tty_outproc = m_ptr->PROC_NR;
|
||||
tp->tty_outproc = m_ptr->IO_ENDPT;
|
||||
tp->tty_out_vir = (vir_bytes) m_ptr->ADDRESS;
|
||||
tp->tty_outleft = m_ptr->COUNT;
|
||||
|
||||
|
@ -526,7 +526,7 @@ register message *m_ptr; /* pointer to message sent to the task */
|
|||
tp->tty_outrepcode = REVIVE;
|
||||
}
|
||||
}
|
||||
tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->PROC_NR, r);
|
||||
tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, r);
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
|
@ -602,7 +602,7 @@ message *m_ptr; /* pointer to message sent to task */
|
|||
case TCGETS:
|
||||
/* Get the termios attributes. */
|
||||
r = sys_vircopy(SELF, D, (vir_bytes) &tp->tty_termios,
|
||||
m_ptr->PROC_NR, D, (vir_bytes) m_ptr->ADDRESS,
|
||||
m_ptr->IO_ENDPT, D, (vir_bytes) m_ptr->ADDRESS,
|
||||
(vir_bytes) size);
|
||||
break;
|
||||
|
||||
|
@ -612,7 +612,7 @@ message *m_ptr; /* pointer to message sent to task */
|
|||
if (tp->tty_outleft > 0) {
|
||||
/* Wait for all ongoing output processing to finish. */
|
||||
tp->tty_iocaller = m_ptr->m_source;
|
||||
tp->tty_ioproc = m_ptr->PROC_NR;
|
||||
tp->tty_ioproc = m_ptr->IO_ENDPT;
|
||||
tp->tty_ioreq = m_ptr->REQUEST;
|
||||
tp->tty_iovir = (vir_bytes) m_ptr->ADDRESS;
|
||||
r = SUSPEND;
|
||||
|
@ -623,14 +623,14 @@ message *m_ptr; /* pointer to message sent to task */
|
|||
/*FALL THROUGH*/
|
||||
case TCSETS:
|
||||
/* Set the termios attributes. */
|
||||
r = sys_vircopy( m_ptr->PROC_NR, D, (vir_bytes) m_ptr->ADDRESS,
|
||||
r = sys_vircopy( m_ptr->IO_ENDPT, D, (vir_bytes) m_ptr->ADDRESS,
|
||||
SELF, D, (vir_bytes) &tp->tty_termios, (vir_bytes) size);
|
||||
if (r != OK) break;
|
||||
setattr(tp);
|
||||
break;
|
||||
|
||||
case TCFLSH:
|
||||
r = sys_vircopy( m_ptr->PROC_NR, D, (vir_bytes) m_ptr->ADDRESS,
|
||||
r = sys_vircopy( m_ptr->IO_ENDPT, D, (vir_bytes) m_ptr->ADDRESS,
|
||||
SELF, D, (vir_bytes) ¶m.i, (vir_bytes) size);
|
||||
if (r != OK) break;
|
||||
switch (param.i) {
|
||||
|
@ -642,7 +642,7 @@ message *m_ptr; /* pointer to message sent to task */
|
|||
break;
|
||||
|
||||
case TCFLOW:
|
||||
r = sys_vircopy( m_ptr->PROC_NR, D, (vir_bytes) m_ptr->ADDRESS,
|
||||
r = sys_vircopy( m_ptr->IO_ENDPT, D, (vir_bytes) m_ptr->ADDRESS,
|
||||
SELF, D, (vir_bytes) ¶m.i, (vir_bytes) size);
|
||||
if (r != OK) break;
|
||||
switch (param.i) {
|
||||
|
@ -668,12 +668,12 @@ message *m_ptr; /* pointer to message sent to task */
|
|||
|
||||
case TIOCGWINSZ:
|
||||
r = sys_vircopy(SELF, D, (vir_bytes) &tp->tty_winsize,
|
||||
m_ptr->PROC_NR, D, (vir_bytes) m_ptr->ADDRESS,
|
||||
m_ptr->IO_ENDPT, D, (vir_bytes) m_ptr->ADDRESS,
|
||||
(vir_bytes) size);
|
||||
break;
|
||||
|
||||
case TIOCSWINSZ:
|
||||
r = sys_vircopy( m_ptr->PROC_NR, D, (vir_bytes) m_ptr->ADDRESS,
|
||||
r = sys_vircopy( m_ptr->IO_ENDPT, D, (vir_bytes) m_ptr->ADDRESS,
|
||||
SELF, D, (vir_bytes) &tp->tty_winsize, (vir_bytes) size);
|
||||
sigchar(tp, SIGWINCH);
|
||||
break;
|
||||
|
@ -682,12 +682,12 @@ message *m_ptr; /* pointer to message sent to task */
|
|||
case TIOCGETP:
|
||||
compat_getp(tp, ¶m.sg);
|
||||
r = sys_vircopy(SELF, D, (vir_bytes) ¶m.sg,
|
||||
m_ptr->PROC_NR, D, (vir_bytes) m_ptr->ADDRESS,
|
||||
m_ptr->IO_ENDPT, D, (vir_bytes) m_ptr->ADDRESS,
|
||||
(vir_bytes) size);
|
||||
break;
|
||||
|
||||
case TIOCSETP:
|
||||
r = sys_vircopy( m_ptr->PROC_NR, D, (vir_bytes) m_ptr->ADDRESS,
|
||||
r = sys_vircopy( m_ptr->IO_ENDPT, D, (vir_bytes) m_ptr->ADDRESS,
|
||||
SELF, D, (vir_bytes) ¶m.sg, (vir_bytes) size);
|
||||
if (r != OK) break;
|
||||
compat_setp(tp, ¶m.sg);
|
||||
|
@ -696,12 +696,12 @@ message *m_ptr; /* pointer to message sent to task */
|
|||
case TIOCGETC:
|
||||
compat_getc(tp, ¶m.tc);
|
||||
r = sys_vircopy(SELF, D, (vir_bytes) ¶m.tc,
|
||||
m_ptr->PROC_NR, D, (vir_bytes) m_ptr->ADDRESS,
|
||||
m_ptr->IO_ENDPT, D, (vir_bytes) m_ptr->ADDRESS,
|
||||
(vir_bytes) size);
|
||||
break;
|
||||
|
||||
case TIOCSETC:
|
||||
r = sys_vircopy( m_ptr->PROC_NR, D, (vir_bytes) m_ptr->ADDRESS,
|
||||
r = sys_vircopy( m_ptr->IO_ENDPT, D, (vir_bytes) m_ptr->ADDRESS,
|
||||
SELF, D, (vir_bytes) ¶m.tc, (vir_bytes) size);
|
||||
if (r != OK) break;
|
||||
compat_setc(tp, ¶m.tc);
|
||||
|
@ -741,7 +741,7 @@ message *m_ptr; /* pointer to message sent to task */
|
|||
}
|
||||
|
||||
/* Send the reply. */
|
||||
tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->PROC_NR, r);
|
||||
tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, r);
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
|
@ -762,12 +762,12 @@ message *m_ptr; /* pointer to message sent to task */
|
|||
if (m_ptr->COUNT & R_BIT) r = EACCES;
|
||||
} else {
|
||||
if (!(m_ptr->COUNT & O_NOCTTY)) {
|
||||
tp->tty_pgrp = m_ptr->PROC_NR;
|
||||
tp->tty_pgrp = m_ptr->IO_ENDPT;
|
||||
r = 1;
|
||||
}
|
||||
tp->tty_openct++;
|
||||
}
|
||||
tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->PROC_NR, r);
|
||||
tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, r);
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
|
@ -788,7 +788,7 @@ message *m_ptr; /* pointer to message sent to task */
|
|||
tp->tty_winsize = winsize_defaults;
|
||||
setattr(tp);
|
||||
}
|
||||
tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->PROC_NR, OK);
|
||||
tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, OK);
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
|
@ -806,7 +806,7 @@ message *m_ptr; /* pointer to message sent to task */
|
|||
int mode;
|
||||
|
||||
/* Check the parameters carefully, to avoid cancelling twice. */
|
||||
proc_nr = m_ptr->PROC_NR;
|
||||
proc_nr = m_ptr->IO_ENDPT;
|
||||
mode = m_ptr->COUNT;
|
||||
if ((mode & R_BIT) && tp->tty_inleft != 0 && proc_nr == tp->tty_inproc) {
|
||||
/* Process was reading when killed. Clean up input. */
|
||||
|
@ -1476,7 +1476,7 @@ int status; /* reply code */
|
|||
message tty_mess;
|
||||
|
||||
tty_mess.m_type = code;
|
||||
tty_mess.REP_PROC_NR = proc_nr;
|
||||
tty_mess.REP_ENDPT = proc_nr;
|
||||
tty_mess.REP_STATUS = status;
|
||||
|
||||
if ((status = send(replyee, &tty_mess)) != OK) {
|
||||
|
@ -1672,8 +1672,8 @@ register message *m_ptr; /* pointer to message sent to the task */
|
|||
{
|
||||
int ops, ready_ops = 0, watch;
|
||||
|
||||
ops = m_ptr->PROC_NR & (SEL_RD|SEL_WR|SEL_ERR);
|
||||
watch = (m_ptr->PROC_NR & SEL_NOTIFY) ? 1 : 0;
|
||||
ops = m_ptr->IO_ENDPT & (SEL_RD|SEL_WR|SEL_ERR);
|
||||
watch = (m_ptr->IO_ENDPT & SEL_NOTIFY) ? 1 : 0;
|
||||
|
||||
ready_ops = select_try(tp, ops);
|
||||
|
||||
|
@ -1682,7 +1682,7 @@ register message *m_ptr; /* pointer to message sent to the task */
|
|||
tp->tty_select_proc = m_ptr->m_source;
|
||||
}
|
||||
|
||||
tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->PROC_NR, ready_ops);
|
||||
tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, ready_ops);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -1968,7 +1968,7 @@ message *m_ptr;
|
|||
message reply_mess;
|
||||
|
||||
minor = m_ptr->TTY_LINE;
|
||||
proc = m_ptr->PROC_NR;
|
||||
proc = m_ptr->IO_ENDPT;
|
||||
func = m_ptr->REQUEST;
|
||||
spek = m_ptr->m2_l1;
|
||||
flags = m_ptr->m2_l2;
|
||||
|
@ -2016,7 +2016,7 @@ message *m_ptr;
|
|||
r = ENOTTY;
|
||||
}
|
||||
reply_mess.m_type = TASK_REPLY;
|
||||
reply_mess.REP_PROC_NR = m_ptr->PROC_NR;
|
||||
reply_mess.REP_ENDPT = m_ptr->IO_ENDPT;
|
||||
reply_mess.REP_STATUS = r;
|
||||
reply_mess.m2_l1 = erki;
|
||||
reply_mess.m2_l2 = flags;
|
||||
|
|
|
@ -58,26 +58,26 @@ typedef struct tty {
|
|||
char tty_reprint; /* 1 when echoed input messed up, 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_pgrp; /* slot number of controlling process */
|
||||
int tty_pgrp; /* slot number of controlling process */
|
||||
char tty_openct; /* count of number of opens of this tty */
|
||||
|
||||
/* Information about incomplete I/O requests is stored here. */
|
||||
char tty_inrepcode; /* reply code, TASK_REPLY or REVIVE */
|
||||
char tty_inrevived; /* set to 1 if revive callback is pending */
|
||||
char tty_incaller; /* process that made the call (usually FS) */
|
||||
char tty_inproc; /* process that wants to read from tty */
|
||||
int tty_incaller; /* process that made the call (usually FS) */
|
||||
int tty_inproc; /* process that wants to read from tty */
|
||||
vir_bytes tty_in_vir; /* virtual address where data is to go */
|
||||
int tty_inleft; /* how many chars are still needed */
|
||||
int tty_incum; /* # chars input so far */
|
||||
char tty_outrepcode; /* reply code, TASK_REPLY or REVIVE */
|
||||
char tty_outrevived; /* set to 1 if revive callback is pending */
|
||||
char tty_outcaller; /* process that made the call (usually FS) */
|
||||
char tty_outproc; /* process that wants to write to tty */
|
||||
int tty_outrepcode; /* reply code, TASK_REPLY or REVIVE */
|
||||
int tty_outrevived; /* set to 1 if revive callback is pending */
|
||||
int tty_outcaller; /* process that made the call (usually FS) */
|
||||
int tty_outproc; /* process that wants to write to tty */
|
||||
vir_bytes tty_out_vir; /* virtual address where data comes from */
|
||||
int tty_outleft; /* # chars yet to be output */
|
||||
int tty_outcum; /* # chars output so far */
|
||||
char tty_iocaller; /* process that made the call (usually FS) */
|
||||
char tty_ioproc; /* process that wants to do an ioctl */
|
||||
int tty_iocaller; /* process that made the call (usually FS) */
|
||||
int tty_ioproc; /* process that wants to do an ioctl */
|
||||
int tty_ioreq; /* ioctl request code */
|
||||
vir_bytes tty_iovir; /* virtual address of ioctl buffer */
|
||||
|
||||
|
|
Loading…
Reference in a new issue