TTY/LOG driver cleanup:
- remove non-safecopy support from TTY - make TTY warning-free with gcc -Wall - remove obsolete diagnostics support
This commit is contained in:
		
							parent
							
								
									9caa53e8d9
								
							
						
					
					
						commit
						f56c4001d5
					
				@ -14,7 +14,6 @@
 | 
				
			|||||||
 *    0x700 -  0x7FF	Reincarnation Server (RS) requests
 | 
					 *    0x700 -  0x7FF	Reincarnation Server (RS) requests
 | 
				
			||||||
 *    0x800 -  0x8FF	Data Store (DS) requests
 | 
					 *    0x800 -  0x8FF	Data Store (DS) requests
 | 
				
			||||||
 *    0x900 -  0x9FF	Requests from PM to VFS, and responses
 | 
					 *    0x900 -  0x9FF	Requests from PM to VFS, and responses
 | 
				
			||||||
 *   (0xA00 -  0xAFF	old TTY and LOG requests, being phased out)
 | 
					 | 
				
			||||||
 *    0xA00 -  0xAFF	Requests from VFS to file systems (see vfsif.h)
 | 
					 *    0xA00 -  0xAFF	Requests from VFS to file systems (see vfsif.h)
 | 
				
			||||||
 *    0xB00 -  0xBFF	Requests from VM to VFS
 | 
					 *    0xB00 -  0xBFF	Requests from VM to VFS
 | 
				
			||||||
 *    0xC00 -  0xCFF	Virtual Memory (VM) requests
 | 
					 *    0xC00 -  0xCFF	Virtual Memory (VM) requests
 | 
				
			||||||
@ -762,18 +761,6 @@
 | 
				
			|||||||
#  define    FKEY_EVENTS	12	/* request open key presses */
 | 
					#  define    FKEY_EVENTS	12	/* request open key presses */
 | 
				
			||||||
#  define FKEY_FKEYS	      m2_l1	/* F1-F12 keys pressed */
 | 
					#  define FKEY_FKEYS	      m2_l1	/* F1-F12 keys pressed */
 | 
				
			||||||
#  define FKEY_SFKEYS	      m2_l2	/* Shift-F1-F12 keys pressed */
 | 
					#  define FKEY_SFKEYS	      m2_l2	/* Shift-F1-F12 keys pressed */
 | 
				
			||||||
#define DIAG_BASE	0xa00
 | 
					 | 
				
			||||||
#define DIAGNOSTICS_OLD 	(DIAG_BASE+1) 	/* output a string without FS in between */
 | 
					 | 
				
			||||||
#define DIAGNOSTICS_S_OLD 	(DIAG_BASE+2) 	/* grant-based version of DIAGNOSTICS */
 | 
					 | 
				
			||||||
#  define DIAG_PRINT_BUF_G    m1_p1
 | 
					 | 
				
			||||||
#  define DIAG_BUF_COUNT      m1_i1
 | 
					 | 
				
			||||||
#define GET_KMESS	(DIAG_BASE+3)	/* get kmess from TTY */
 | 
					 | 
				
			||||||
#  define GETKM_PTR	      m1_p1
 | 
					 | 
				
			||||||
#define GET_KMESS_S	(DIAG_BASE+4)	/* get kmess from TTY */
 | 
					 | 
				
			||||||
#  define GETKM_GRANT	      m1_i1
 | 
					 | 
				
			||||||
#define ASYN_DIAGNOSTICS_OLD (DIAG_BASE+5) 	/* grant-based, replyless DIAGNOSTICS */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define DIAG_REPL_OLD 	(DIAG_BASE+0x80+0) 	/* reply to DIAGNOSTICS(_S) */
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*===========================================================================*
 | 
					/*===========================================================================*
 | 
				
			||||||
 *                Messages used between PM and VFS			     *
 | 
					 *                Messages used between PM and VFS			     *
 | 
				
			||||||
 | 
				
			|||||||
@ -1,81 +1,42 @@
 | 
				
			|||||||
/* This file handle diagnostic output that is directly sent to the LOG driver.
 | 
					/* This file handle diagnostic output that is sent to the LOG driver. Output
 | 
				
			||||||
 * This output can either be a kernel message (announced through a SYS_EVENT
 | 
					 * can be either from the kernel, or from other system processes. Output from
 | 
				
			||||||
 * with a SIGKMESS in the signal set) or output from another system process
 | 
					 * system processes is also routed through the kernel. The kernel notifies
 | 
				
			||||||
 * (announced through a DIAGNOSTICS message).
 | 
					 * this driver with a SIGKMESS signal if any messages are available.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Changes:
 | 
					 * Changes:
 | 
				
			||||||
 *	21 July 2005:	Created  (Jorrit N. Herder)
 | 
					 *	21 July 2005:	Created  (Jorrit N. Herder)
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdio.h>
 | 
					 | 
				
			||||||
#include <minix/type.h>
 | 
					 | 
				
			||||||
#include <minix/safecopies.h>
 | 
					 | 
				
			||||||
#include <minix/sys_config.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "log.h"
 | 
					#include "log.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*==========================================================================*
 | 
					/*==========================================================================*
 | 
				
			||||||
 *				do_new_kmess				    *
 | 
					 *				do_new_kmess				    *
 | 
				
			||||||
 *==========================================================================*/
 | 
					 *==========================================================================*/
 | 
				
			||||||
PUBLIC int do_new_kmess(from)
 | 
					PUBLIC void do_new_kmess(void)
 | 
				
			||||||
endpoint_t from;				/* who sent this message? */
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
/* Notification for a new kernel message. */
 | 
					/* Notification for a new kernel message. */
 | 
				
			||||||
  static struct kmessages kmess;		/* entire kmess structure */
 | 
					  static struct kmessages kmess;		/* entire kmess structure */
 | 
				
			||||||
  static char print_buf[_KMESS_BUF_SIZE];	/* copy new message here */
 | 
					  static char print_buf[_KMESS_BUF_SIZE];	/* copy new message here */
 | 
				
			||||||
  int bytes;
 | 
					  int bytes;
 | 
				
			||||||
  int i, r;
 | 
					  int i, r;
 | 
				
			||||||
  int *prev_nextp;
 | 
					  static int prev_next = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  static int kernel_prev_next = 0;
 | 
					  /* Try to get a fresh copy of the buffer with kernel messages. */
 | 
				
			||||||
  static int tty_prev_next = 0;
 | 
					  if ((r=sys_getkmessages(&kmess)) != OK) {
 | 
				
			||||||
 | 
						printf("log: couldn't get copy of kmessages: %d\n", r);
 | 
				
			||||||
  if (from == TTY_PROC_NR)
 | 
						return;
 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
	cp_grant_id_t gid;
 | 
					 | 
				
			||||||
	message mess;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	prev_nextp= &tty_prev_next;
 | 
					 | 
				
			||||||
	gid= cpf_grant_direct(TTY_PROC_NR, (vir_bytes)&kmess, sizeof(kmess),
 | 
					 | 
				
			||||||
		CPF_WRITE);
 | 
					 | 
				
			||||||
	if (gid == -1)
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		return EDONTREPLY;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* Ask TTY driver for log output */
 | 
					 | 
				
			||||||
	mess.GETKM_GRANT= gid;
 | 
					 | 
				
			||||||
	mess.m_type = GET_KMESS_S;
 | 
					 | 
				
			||||||
	r= sendrec(TTY_PROC_NR, &mess);
 | 
					 | 
				
			||||||
	cpf_revoke(gid);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (r == OK) r= mess.m_type;
 | 
					 | 
				
			||||||
	if (r != OK)
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		printf("log: couldn't get copy of kmessages from TTY: %d\n", r);
 | 
					 | 
				
			||||||
		return EDONTREPLY;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  else
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
	/* Try to get a fresh copy of the buffer with kernel messages. */
 | 
					 | 
				
			||||||
	if ((r=sys_getkmessages(&kmess)) != OK) {
 | 
					 | 
				
			||||||
		printf("log: couldn't get copy of kmessages: %d\n", r);
 | 
					 | 
				
			||||||
		return EDONTREPLY;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	prev_nextp= &kernel_prev_next;
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* Print only the new part. Determine how many new bytes there are with 
 | 
					  /* Print only the new part. Determine how many new bytes there are with 
 | 
				
			||||||
   * help of the current and previous 'next' index. Note that the kernel
 | 
					   * help of the current and previous 'next' index. Note that the kernel
 | 
				
			||||||
   * buffer is circular. This works fine if less then KMESS_BUF_SIZE bytes
 | 
					   * buffer is circular. This works fine if less than KMESS_BUF_SIZE bytes
 | 
				
			||||||
   * is new data; else we miss % KMESS_BUF_SIZE here.  
 | 
					   * are new data; else we miss % KMESS_BUF_SIZE here.  
 | 
				
			||||||
   * Check for size being positive, the buffer might as well be emptied!
 | 
					   * Check for size being positive, the buffer might as well be emptied!
 | 
				
			||||||
   */
 | 
					   */
 | 
				
			||||||
  if (kmess.km_size > 0) {
 | 
					  if (kmess.km_size > 0) {
 | 
				
			||||||
      bytes = ((kmess.km_next + _KMESS_BUF_SIZE) - (*prev_nextp)) %
 | 
					      bytes = ((kmess.km_next + _KMESS_BUF_SIZE) - prev_next) %
 | 
				
			||||||
	_KMESS_BUF_SIZE;
 | 
						_KMESS_BUF_SIZE;
 | 
				
			||||||
      r= *prev_nextp;				/* start at previous old */ 
 | 
					      r= prev_next;				/* start at previous old */ 
 | 
				
			||||||
      i=0;
 | 
					      i=0;
 | 
				
			||||||
      while (bytes > 0) {			
 | 
					      while (bytes > 0) {			
 | 
				
			||||||
          print_buf[i] = kmess.km_buf[(r%_KMESS_BUF_SIZE)];
 | 
					          print_buf[i] = kmess.km_buf[(r%_KMESS_BUF_SIZE)];
 | 
				
			||||||
@ -91,46 +52,5 @@ endpoint_t from;				/* who sent this message? */
 | 
				
			|||||||
  /* Almost done, store 'next' so that we can determine what part of the
 | 
					  /* Almost done, store 'next' so that we can determine what part of the
 | 
				
			||||||
   * kernel messages buffer to print next time a notification arrives.
 | 
					   * kernel messages buffer to print next time a notification arrives.
 | 
				
			||||||
   */
 | 
					   */
 | 
				
			||||||
  *prev_nextp = kmess.km_next;
 | 
					  prev_next = kmess.km_next;
 | 
				
			||||||
  return EDONTREPLY;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*===========================================================================*
 | 
					 | 
				
			||||||
 *				do_diagnostics				     *
 | 
					 | 
				
			||||||
 *===========================================================================*/
 | 
					 | 
				
			||||||
PUBLIC int do_diagnostics(message *m, int safe)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
/* The LOG server handles all diagnostic messages from servers and device 
 | 
					 | 
				
			||||||
 * drivers. It forwards the message to the TTY driver to display it to the
 | 
					 | 
				
			||||||
 * user. It also saves a copy in a local buffer so that messages can be 
 | 
					 | 
				
			||||||
 * reviewed at a later time.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
  vir_bytes src;
 | 
					 | 
				
			||||||
  int count;
 | 
					 | 
				
			||||||
  char c;
 | 
					 | 
				
			||||||
  int i = 0, offset = 0;
 | 
					 | 
				
			||||||
  static char diagbuf[10240];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /* Also make a copy for the private buffer at the LOG server, so
 | 
					 | 
				
			||||||
   * that the messages can be reviewed at a later time.
 | 
					 | 
				
			||||||
   */
 | 
					 | 
				
			||||||
  src = (vir_bytes) m->DIAG_PRINT_BUF_G;
 | 
					 | 
				
			||||||
  count = m->DIAG_BUF_COUNT; 
 | 
					 | 
				
			||||||
  while (count > 0 && i < sizeof(diagbuf)-1) {
 | 
					 | 
				
			||||||
      int r;
 | 
					 | 
				
			||||||
      if(safe) {
 | 
					 | 
				
			||||||
        r = sys_safecopyfrom(m->m_source, src, offset, (vir_bytes) &c, 1, D);
 | 
					 | 
				
			||||||
      } else {
 | 
					 | 
				
			||||||
        r = sys_datacopy(m->m_source, src+offset, SELF, (vir_bytes) &c, 1);
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      if(r != OK) break;
 | 
					 | 
				
			||||||
      offset ++;
 | 
					 | 
				
			||||||
      count --;
 | 
					 | 
				
			||||||
      diagbuf[i++] = c;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  log_append(diagbuf, i);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if(m->m_type == ASYN_DIAGNOSTICS_OLD) return EDONTREPLY;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return OK;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -31,7 +31,7 @@ FORWARD _PROTOTYPE( int log_cancel, (struct driver *dp, message *m_ptr) );
 | 
				
			|||||||
FORWARD _PROTOTYPE( int log_select, (struct driver *dp, message *m_ptr) );
 | 
					FORWARD _PROTOTYPE( int log_select, (struct driver *dp, message *m_ptr) );
 | 
				
			||||||
FORWARD _PROTOTYPE( int log_other, (struct driver *dp, message *m_ptr) );
 | 
					FORWARD _PROTOTYPE( int log_other, (struct driver *dp, message *m_ptr) );
 | 
				
			||||||
FORWARD _PROTOTYPE( void log_geometry, (struct partition *entry) );
 | 
					FORWARD _PROTOTYPE( void log_geometry, (struct partition *entry) );
 | 
				
			||||||
FORWARD _PROTOTYPE( int subread, (struct logdevice *log, int count, int proc_nr, vir_bytes user_vir, size_t) );
 | 
					FORWARD _PROTOTYPE( int subread, (struct logdevice *log, int count, int proc_nr, cp_grant_id_t grant, size_t) );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Entry points to this driver. */
 | 
					/* Entry points to this driver. */
 | 
				
			||||||
PRIVATE struct driver log_dtab = {
 | 
					PRIVATE struct driver log_dtab = {
 | 
				
			||||||
@ -128,7 +128,7 @@ PRIVATE void sef_cb_signal_handler(int signo)
 | 
				
			|||||||
  /* Only check for a pending message from the kernel, ignore anything else. */
 | 
					  /* Only check for a pending message from the kernel, ignore anything else. */
 | 
				
			||||||
  if (signo != SIGKMESS) return;
 | 
					  if (signo != SIGKMESS) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  do_new_kmess(SYSTEM);
 | 
					  do_new_kmess();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*===========================================================================*
 | 
					/*===========================================================================*
 | 
				
			||||||
@ -160,7 +160,7 @@ int device;
 | 
				
			|||||||
 *===========================================================================*/
 | 
					 *===========================================================================*/
 | 
				
			||||||
PRIVATE int
 | 
					PRIVATE int
 | 
				
			||||||
subwrite(struct logdevice *log, int count, int proc_nr,
 | 
					subwrite(struct logdevice *log, int count, int proc_nr,
 | 
				
			||||||
	vir_bytes user_vir, size_t offset)
 | 
						cp_grant_id_t grant, size_t offset, char *localbuf)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int d, r;
 | 
						int d, r;
 | 
				
			||||||
	char *buf;
 | 
						char *buf;
 | 
				
			||||||
@ -170,11 +170,11 @@ subwrite(struct logdevice *log, int count, int proc_nr,
 | 
				
			|||||||
		count = LOG_SIZE - log->log_write;
 | 
							count = LOG_SIZE - log->log_write;
 | 
				
			||||||
	buf = log->log_buffer + log->log_write;
 | 
						buf = log->log_buffer + log->log_write;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(proc_nr == SELF) {
 | 
						if(localbuf != NULL) {
 | 
				
			||||||
		memcpy(buf, (char *) user_vir, count);
 | 
							memcpy(buf, localbuf, count);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else {
 | 
						else {
 | 
				
			||||||
		if((r=sys_safecopyfrom(proc_nr, user_vir, offset,
 | 
							if((r=sys_safecopyfrom(proc_nr, grant, offset,
 | 
				
			||||||
			(vir_bytes)buf, count, D)) != OK)
 | 
								(vir_bytes)buf, count, D)) != OK)
 | 
				
			||||||
			return r;
 | 
								return r;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@ -194,13 +194,13 @@ subwrite(struct logdevice *log, int count, int proc_nr,
 | 
				
			|||||||
        	 * 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_vir_g,
 | 
					    			log->log_proc_nr, log->log_user_grant,
 | 
				
			||||||
			log->log_user_vir_offset);
 | 
								log->log_user_offset);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		m.m_type = DEV_REVIVE;
 | 
							m.m_type = DEV_REVIVE;
 | 
				
			||||||
		m.REP_ENDPT = log->log_proc_nr;
 | 
							m.REP_ENDPT = log->log_proc_nr;
 | 
				
			||||||
		m.REP_STATUS  = log->log_status;
 | 
							m.REP_STATUS  = log->log_status;
 | 
				
			||||||
		m.REP_IO_GRANT  = log->log_user_vir_g;
 | 
							m.REP_IO_GRANT  = log->log_user_grant;
 | 
				
			||||||
  		r= send(log->log_source, &m);
 | 
					  		r= send(log->log_source, &m);
 | 
				
			||||||
		if (r != OK)
 | 
							if (r != OK)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@ -243,7 +243,7 @@ subwrite(struct logdevice *log, int count, int proc_nr,
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*===========================================================================*
 | 
					/*===========================================================================*
 | 
				
			||||||
 *				log_append				*
 | 
					 *				log_append				     *
 | 
				
			||||||
 *===========================================================================*/
 | 
					 *===========================================================================*/
 | 
				
			||||||
PUBLIC void
 | 
					PUBLIC void
 | 
				
			||||||
log_append(char *buf, int count)
 | 
					log_append(char *buf, int count)
 | 
				
			||||||
@ -254,10 +254,11 @@ log_append(char *buf, int count)
 | 
				
			|||||||
	if(count > LOG_SIZE) skip = count - LOG_SIZE;
 | 
						if(count > LOG_SIZE) skip = count - LOG_SIZE;
 | 
				
			||||||
	count -= skip;
 | 
						count -= skip;
 | 
				
			||||||
	buf += skip;
 | 
						buf += skip;
 | 
				
			||||||
	w = subwrite(&logdevices[0], count, SELF, (vir_bytes) buf,0);
 | 
						w = subwrite(&logdevices[0], count, SELF, GRANT_INVALID, 0, buf);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(w > 0 && w < count)
 | 
						if(w > 0 && w < count)
 | 
				
			||||||
		subwrite(&logdevices[0], count-w, SELF, (vir_bytes) buf+w,0);
 | 
							subwrite(&logdevices[0], count-w, SELF, GRANT_INVALID, 0,
 | 
				
			||||||
 | 
								buf + w);
 | 
				
			||||||
	return;
 | 
						return;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -266,7 +267,7 @@ log_append(char *buf, int count)
 | 
				
			|||||||
 *===========================================================================*/
 | 
					 *===========================================================================*/
 | 
				
			||||||
PRIVATE int
 | 
					PRIVATE int
 | 
				
			||||||
subread(struct logdevice *log, int count, int proc_nr,
 | 
					subread(struct logdevice *log, int count, int proc_nr,
 | 
				
			||||||
	vir_bytes user_vir, size_t offset)
 | 
						cp_grant_id_t grant, size_t offset)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	char *buf;
 | 
						char *buf;
 | 
				
			||||||
	int r;
 | 
						int r;
 | 
				
			||||||
@ -276,7 +277,7 @@ subread(struct logdevice *log, int count, int proc_nr,
 | 
				
			|||||||
        	count = LOG_SIZE - log->log_read;
 | 
					        	count = LOG_SIZE - log->log_read;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    	buf = log->log_buffer + log->log_read;
 | 
					    	buf = log->log_buffer + log->log_read;
 | 
				
			||||||
	if((r=sys_safecopyto(proc_nr, user_vir, offset,
 | 
						if((r=sys_safecopyto(proc_nr, grant, offset,
 | 
				
			||||||
		(vir_bytes)buf, count, D)) != OK)
 | 
							(vir_bytes)buf, count, D)) != OK)
 | 
				
			||||||
		return r;
 | 
							return r;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -297,8 +298,8 @@ iovec_t *iov;			/* pointer to read or write request vector */
 | 
				
			|||||||
unsigned nr_req;		/* length of request vector */
 | 
					unsigned nr_req;		/* length of request vector */
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
/* Read or write one the driver's minor devices. */
 | 
					/* Read or write one the driver's minor devices. */
 | 
				
			||||||
  unsigned count;
 | 
					  int count;
 | 
				
			||||||
  vir_bytes user_vir;
 | 
					  cp_grant_id_t grant;
 | 
				
			||||||
  int accumulated_read = 0;
 | 
					  int accumulated_read = 0;
 | 
				
			||||||
  struct logdevice *log;
 | 
					  struct logdevice *log;
 | 
				
			||||||
  size_t vir_offset = 0;
 | 
					  size_t vir_offset = 0;
 | 
				
			||||||
@ -312,7 +313,7 @@ unsigned nr_req;		/* length of request vector */
 | 
				
			|||||||
  while (nr_req > 0) {
 | 
					  while (nr_req > 0) {
 | 
				
			||||||
	/* How much to transfer and where to / from. */
 | 
						/* How much to transfer and where to / from. */
 | 
				
			||||||
	count = iov->iov_size;
 | 
						count = iov->iov_size;
 | 
				
			||||||
	user_vir = iov->iov_addr;
 | 
						grant = iov->iov_addr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	switch (log_device) {
 | 
						switch (log_device) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -331,8 +332,8 @@ unsigned nr_req;		/* length of request vector */
 | 
				
			|||||||
	    		/* No data available; let caller block. */
 | 
						    		/* No data available; let caller block. */
 | 
				
			||||||
	    		log->log_proc_nr = proc_nr;
 | 
						    		log->log_proc_nr = proc_nr;
 | 
				
			||||||
	    		log->log_iosize = count;
 | 
						    		log->log_iosize = count;
 | 
				
			||||||
	    		log->log_user_vir_g = user_vir;
 | 
						    		log->log_user_grant = grant;
 | 
				
			||||||
	    		log->log_user_vir_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_caller is a global in drivers library. */
 | 
				
			||||||
@ -343,13 +344,13 @@ unsigned nr_req;		/* length of request vector */
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
	    		return(EDONTREPLY);
 | 
						    		return(EDONTREPLY);
 | 
				
			||||||
	    	}
 | 
						    	}
 | 
				
			||||||
	    	count = subread(log, count, proc_nr, user_vir, vir_offset);
 | 
						    	count = subread(log, count, proc_nr, grant, vir_offset);
 | 
				
			||||||
	    	if(count < 0) {
 | 
						    	if(count < 0) {
 | 
				
			||||||
	    		return count;
 | 
						    		return count;
 | 
				
			||||||
	    	}
 | 
						    	}
 | 
				
			||||||
	    	accumulated_read += count;
 | 
						    	accumulated_read += count;
 | 
				
			||||||
	    } else {
 | 
						    } else {
 | 
				
			||||||
	    	count = subwrite(log, count, proc_nr, user_vir, vir_offset);
 | 
						    	count = subwrite(log, count, proc_nr, grant, vir_offset, NULL);
 | 
				
			||||||
	    	if(count < 0)
 | 
						    	if(count < 0)
 | 
				
			||||||
	    		return count;
 | 
						    		return count;
 | 
				
			||||||
	    }
 | 
						    }
 | 
				
			||||||
@ -419,27 +420,10 @@ message *m_ptr;
 | 
				
			|||||||
	 * understand.
 | 
						 * understand.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	if (is_notify(m_ptr->m_type)) {
 | 
						if (is_notify(m_ptr->m_type)) {
 | 
				
			||||||
		switch (_ENDPOINT_P(m_ptr->m_source)) {
 | 
							return EINVAL;
 | 
				
			||||||
			case TTY_PROC_NR:
 | 
					 | 
				
			||||||
				do_new_kmess(m_ptr->m_source);
 | 
					 | 
				
			||||||
				r = EDONTREPLY;
 | 
					 | 
				
			||||||
				break;
 | 
					 | 
				
			||||||
			default:
 | 
					 | 
				
			||||||
				r = EINVAL;
 | 
					 | 
				
			||||||
				break;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		return r;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	switch(m_ptr->m_type) {
 | 
						switch(m_ptr->m_type) {
 | 
				
			||||||
	case DIAGNOSTICS_OLD: {
 | 
					 | 
				
			||||||
		r = do_diagnostics(m_ptr, 0);
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	case ASYN_DIAGNOSTICS_OLD:
 | 
					 | 
				
			||||||
	case DIAGNOSTICS_S_OLD:
 | 
					 | 
				
			||||||
		r = do_diagnostics(m_ptr, 1);
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case DEV_STATUS: {
 | 
						case DEV_STATUS: {
 | 
				
			||||||
		printf("log_other: unexpected DEV_STATUS request\n");
 | 
							printf("log_other: unexpected DEV_STATUS request\n");
 | 
				
			||||||
		r = EDONTREPLY;
 | 
							r = EDONTREPLY;
 | 
				
			||||||
 | 
				
			|||||||
@ -23,14 +23,14 @@ struct logdevice {
 | 
				
			|||||||
		log_iosize,
 | 
							log_iosize,
 | 
				
			||||||
		log_revive_alerted,
 | 
							log_revive_alerted,
 | 
				
			||||||
		log_status;	/* proc that is blocking on read */
 | 
							log_status;	/* proc that is blocking on read */
 | 
				
			||||||
	vir_bytes log_user_vir_g, log_user_vir_offset;
 | 
						cp_grant_id_t log_user_grant;
 | 
				
			||||||
 | 
						vir_bytes log_user_offset;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	int	log_selected, log_select_proc,
 | 
						int	log_selected, log_select_proc,
 | 
				
			||||||
		log_select_alerted, log_select_ready_ops;
 | 
							log_select_alerted, log_select_ready_ops;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Function prototypes. */
 | 
					/* Function prototypes. */
 | 
				
			||||||
_PROTOTYPE( int do_new_kmess, (endpoint_t from)				);
 | 
					_PROTOTYPE( void do_new_kmess, (void)					);
 | 
				
			||||||
_PROTOTYPE( int do_diagnostics, (message *m, int safe)			);
 | 
					_PROTOTYPE( void log_append, (char *buf, int len)			);
 | 
				
			||||||
_PROTOTYPE( void log_append, (char *buf, int len)				);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -171,17 +171,10 @@ int try;
 | 
				
			|||||||
   */
 | 
					   */
 | 
				
			||||||
  do {
 | 
					  do {
 | 
				
			||||||
	if (count > sizeof(buf)) count = sizeof(buf);
 | 
						if (count > sizeof(buf)) count = sizeof(buf);
 | 
				
			||||||
	if(tp->tty_out_safe) {
 | 
						if ((result = sys_safecopyfrom(tp->tty_outproc, tp->tty_outgrant,
 | 
				
			||||||
	   if ((result = sys_safecopyfrom(tp->tty_outproc, tp->tty_out_vir_g,
 | 
							tp->tty_outoffset, (vir_bytes) buf, count, D)) != OK)
 | 
				
			||||||
		tp->tty_out_vir_offset, (vir_bytes) buf, count, D)) != OK)
 | 
					 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	    tp->tty_out_vir_offset += count;
 | 
						tp->tty_outoffset += count;
 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
	   if ((result = sys_vircopy(tp->tty_outproc, D, tp->tty_out_vir_g, 
 | 
					 | 
				
			||||||
			SELF, D, (vir_bytes) buf, (vir_bytes) count)) != OK)
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	    tp->tty_out_vir_g += count;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	tbuf = buf;
 | 
						tbuf = buf;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Update terminal data structure. */
 | 
						/* Update terminal data structure. */
 | 
				
			||||||
@ -767,9 +760,7 @@ PRIVATE void beep()
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
  static timer_t tmr_stop_beep;
 | 
					  static timer_t tmr_stop_beep;
 | 
				
			||||||
  pvb_pair_t char_out[3];
 | 
					  pvb_pair_t char_out[3];
 | 
				
			||||||
  clock_t now;
 | 
					 | 
				
			||||||
  unsigned long port_b_val;
 | 
					  unsigned long port_b_val;
 | 
				
			||||||
  int s;
 | 
					 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  /* Set timer in advance to prevent beeping delay. */
 | 
					  /* Set timer in advance to prevent beeping delay. */
 | 
				
			||||||
  set_timer(&tmr_stop_beep, B_TIME, stop_beep, 0);
 | 
					  set_timer(&tmr_stop_beep, B_TIME, stop_beep, 0);
 | 
				
			||||||
@ -793,7 +784,7 @@ PRIVATE void beep()
 | 
				
			|||||||
 *===========================================================================*/
 | 
					 *===========================================================================*/
 | 
				
			||||||
PUBLIC void do_video(message *m)
 | 
					PUBLIC void do_video(message *m)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int r, safe = 0;
 | 
						int r;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Execute the requested device driver function. */
 | 
						/* Execute the requested device driver function. */
 | 
				
			||||||
	r= EINVAL;	/* just in case */
 | 
						r= EINVAL;	/* just in case */
 | 
				
			||||||
@ -808,7 +799,6 @@ PUBLIC void do_video(message *m)
 | 
				
			|||||||
		r= OK;
 | 
							r= OK;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	    case DEV_IOCTL_S:
 | 
						    case DEV_IOCTL_S:
 | 
				
			||||||
		safe=1;
 | 
					 | 
				
			||||||
		switch(m->TTY_REQUEST) {
 | 
							switch(m->TTY_REQUEST) {
 | 
				
			||||||
		  case TIOCMAPMEM:
 | 
							  case TIOCMAPMEM:
 | 
				
			||||||
		  case TIOCUNMAPMEM: {
 | 
							  case TIOCUNMAPMEM: {
 | 
				
			||||||
@ -817,15 +807,9 @@ PUBLIC void do_video(message *m)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			do_map= (m->REQUEST == TIOCMAPMEM);	/* else unmap */
 | 
								do_map= (m->REQUEST == TIOCMAPMEM);	/* else unmap */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			/* Get request structure */
 | 
					 | 
				
			||||||
			if(!safe) {
 | 
					 | 
				
			||||||
				printf("tty: safecopy only\n");
 | 
					 | 
				
			||||||
				return;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	   		r = sys_safecopyfrom(m->IO_ENDPT,
 | 
						   		r = sys_safecopyfrom(m->IO_ENDPT,
 | 
				
			||||||
			  (vir_bytes)m->ADDRESS, 0, (vir_bytes) &mapreqvm,
 | 
									(cp_grant_id_t) m->IO_GRANT, 0,
 | 
				
			||||||
			  sizeof(mapreqvm), D);
 | 
									(vir_bytes) &mapreqvm, sizeof(mapreqvm), D);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (r != OK)
 | 
								if (r != OK)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
@ -844,7 +828,7 @@ PUBLIC void do_video(message *m)
 | 
				
			|||||||
				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->IO_ENDPT,
 | 
				
			||||||
				  (vir_bytes)m->ADDRESS, 0,
 | 
									  (cp_grant_id_t) m->IO_GRANT, 0,
 | 
				
			||||||
				  (vir_bytes) &mapreqvm,
 | 
									  (vir_bytes) &mapreqvm,
 | 
				
			||||||
				  sizeof(mapreqvm), D)) != OK) {
 | 
									  sizeof(mapreqvm), D)) != OK) {
 | 
				
			||||||
				  printf("tty: sys_safecopyto failed\n");
 | 
									  printf("tty: sys_safecopyto failed\n");
 | 
				
			||||||
@ -883,9 +867,7 @@ clock_t dur;
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
  static timer_t tmr_stop_beep;
 | 
					  static timer_t tmr_stop_beep;
 | 
				
			||||||
  pvb_pair_t char_out[3];
 | 
					  pvb_pair_t char_out[3];
 | 
				
			||||||
  clock_t now;
 | 
					 | 
				
			||||||
  unsigned long port_b_val;
 | 
					  unsigned long port_b_val;
 | 
				
			||||||
  int s;
 | 
					 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  unsigned long ival= TIMER_FREQ / freq;
 | 
					  unsigned long ival= TIMER_FREQ / freq;
 | 
				
			||||||
  if (ival == 0 || ival > 0xffff)
 | 
					  if (ival == 0 || ival > 0xffff)
 | 
				
			||||||
@ -1069,86 +1051,6 @@ PUBLIC void do_new_kmess()
 | 
				
			|||||||
  prev_next = kmess.km_next;
 | 
					  prev_next = kmess.km_next;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*===========================================================================*
 | 
					 | 
				
			||||||
 *				do_diagnostics				     *
 | 
					 | 
				
			||||||
 *===========================================================================*/
 | 
					 | 
				
			||||||
PUBLIC void do_diagnostics(m_ptr, safe)
 | 
					 | 
				
			||||||
message *m_ptr;			/* pointer to request message */
 | 
					 | 
				
			||||||
int safe;
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
/* Print a string for a server. */
 | 
					 | 
				
			||||||
  char c;
 | 
					 | 
				
			||||||
  vir_bytes src;
 | 
					 | 
				
			||||||
  int count, offset = 0;
 | 
					 | 
				
			||||||
  int result = OK;
 | 
					 | 
				
			||||||
  int proc_nr = m_ptr->m_source;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  src = (vir_bytes) m_ptr->DIAG_PRINT_BUF_G;
 | 
					 | 
				
			||||||
  for (count = m_ptr->DIAG_BUF_COUNT; count > 0; count--) {
 | 
					 | 
				
			||||||
	int r;
 | 
					 | 
				
			||||||
	if(safe) {
 | 
					 | 
				
			||||||
	   r = sys_safecopyfrom(proc_nr, src, offset, (vir_bytes) &c, 1, D);
 | 
					 | 
				
			||||||
	   if(r != OK)
 | 
					 | 
				
			||||||
	  	   printf("<tty: proc %d, grant %ld>", proc_nr, src);
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
	   r = sys_vircopy(proc_nr, D, src+offset, SELF, D, (vir_bytes) &c, 1);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	offset++;
 | 
					 | 
				
			||||||
	if(r != OK) {
 | 
					 | 
				
			||||||
		result = EFAULT;
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	cons_putk(c);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  cons_putk(0);			/* always terminate, even with EFAULT */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if(m_ptr->m_type != ASYN_DIAGNOSTICS_OLD) {
 | 
					 | 
				
			||||||
	  m_ptr->m_type = DIAG_REPL_OLD;
 | 
					 | 
				
			||||||
	  m_ptr->REP_STATUS = result;
 | 
					 | 
				
			||||||
	  send(m_ptr->m_source, m_ptr);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*===========================================================================*
 | 
					 | 
				
			||||||
 *				do_get_kmess				     *
 | 
					 | 
				
			||||||
 *===========================================================================*/
 | 
					 | 
				
			||||||
PUBLIC void do_get_kmess(m_ptr)
 | 
					 | 
				
			||||||
message *m_ptr;			/* pointer to request message */
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
/* Provide the log device with debug output */
 | 
					 | 
				
			||||||
  vir_bytes dst;
 | 
					 | 
				
			||||||
  int r;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  dst = (vir_bytes) m_ptr->GETKM_PTR;
 | 
					 | 
				
			||||||
  r= OK;
 | 
					 | 
				
			||||||
  if (sys_vircopy(SELF, D, (vir_bytes)&kmess, m_ptr->m_source, D,
 | 
					 | 
				
			||||||
	dst, sizeof(kmess)) != OK) {
 | 
					 | 
				
			||||||
	r = EFAULT;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  m_ptr->m_type = r;
 | 
					 | 
				
			||||||
  send(m_ptr->m_source, m_ptr);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*===========================================================================*
 | 
					 | 
				
			||||||
 *				do_get_kmess_s				     *
 | 
					 | 
				
			||||||
 *===========================================================================*/
 | 
					 | 
				
			||||||
PUBLIC void do_get_kmess_s(m_ptr)
 | 
					 | 
				
			||||||
message *m_ptr;			/* pointer to request message */
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
/* Provide the log device with debug output */
 | 
					 | 
				
			||||||
  cp_grant_id_t gid;
 | 
					 | 
				
			||||||
  int r;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  gid = m_ptr->GETKM_GRANT;
 | 
					 | 
				
			||||||
  r= OK;
 | 
					 | 
				
			||||||
  if (sys_safecopyto(m_ptr->m_source, gid, 0, (vir_bytes)&kmess, sizeof(kmess),
 | 
					 | 
				
			||||||
	D) != OK) {
 | 
					 | 
				
			||||||
	r = EFAULT;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  m_ptr->m_type = r;
 | 
					 | 
				
			||||||
  send(m_ptr->m_source, m_ptr);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*===========================================================================*
 | 
					/*===========================================================================*
 | 
				
			||||||
 *				cons_putk				     *
 | 
					 *				cons_putk				     *
 | 
				
			||||||
 *===========================================================================*/
 | 
					 *===========================================================================*/
 | 
				
			||||||
@ -1299,7 +1201,7 @@ 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->ADDRESS, 0,
 | 
					  if(sys_safecopyfrom(m->IO_ENDPT, (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->IO_ENDPT);
 | 
				
			||||||
	return EFAULT;
 | 
						return EFAULT;
 | 
				
			||||||
 | 
				
			|||||||
@ -108,10 +108,10 @@ PRIVATE int locks[NR_CONS];	/* per console lock keys state */
 | 
				
			|||||||
#define CAPS_LOCK	0x04
 | 
					#define CAPS_LOCK	0x04
 | 
				
			||||||
#define ALT_LOCK	0x08
 | 
					#define ALT_LOCK	0x08
 | 
				
			||||||
 | 
					
 | 
				
			||||||
PRIVATE char numpad_map[] =
 | 
					PRIVATE char numpad_map[12] =
 | 
				
			||||||
		{'H', 'Y', 'A', 'B', 'D', 'C', 'V', 'U', 'G', 'S', 'T', '@'};
 | 
							{'H', 'Y', 'A', 'B', 'D', 'C', 'V', 'U', 'G', 'S', 'T', '@'};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
PRIVATE char *fkey_map[] =
 | 
					PRIVATE char *fkey_map[12] =
 | 
				
			||||||
		{"11", "12", "13", "14", "15", "17",	/* F1-F6 */
 | 
							{"11", "12", "13", "14", "15", "17",	/* F1-F6 */
 | 
				
			||||||
		 "18", "19", "20", "21", "23", "24"};	/* F7-F12 */
 | 
							 "18", "19", "20", "21", "23", "24"};	/* F7-F12 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -129,8 +129,7 @@ PRIVATE struct kbd
 | 
				
			|||||||
	int avail;
 | 
						int avail;
 | 
				
			||||||
	int req_size;
 | 
						int req_size;
 | 
				
			||||||
	int req_proc;
 | 
						int req_proc;
 | 
				
			||||||
	int req_safe;		/* nonzero: safe (req_addr_g is grant) */
 | 
						cp_grant_id_t req_grant;
 | 
				
			||||||
	vir_bytes req_addr_g;	/* Virtual address or grant */
 | 
					 | 
				
			||||||
	vir_bytes req_addr_offset;
 | 
						vir_bytes req_addr_offset;
 | 
				
			||||||
	int incaller;
 | 
						int incaller;
 | 
				
			||||||
	int select_ops;
 | 
						int select_ops;
 | 
				
			||||||
@ -217,7 +216,7 @@ PRIVATE void handle_req(kbdp, m)
 | 
				
			|||||||
struct kbd *kbdp;
 | 
					struct kbd *kbdp;
 | 
				
			||||||
message *m;
 | 
					message *m;
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int i, n, r, ops, watch, safecopy = 0;
 | 
						int i, n, r, ops, watch;
 | 
				
			||||||
	unsigned char c;
 | 
						unsigned char c;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Execute the requested device driver function. */
 | 
						/* Execute the requested device driver function. */
 | 
				
			||||||
@ -239,7 +238,6 @@ message *m;
 | 
				
			|||||||
		r= OK;
 | 
							r= OK;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	    case DEV_READ_S:
 | 
						    case DEV_READ_S:
 | 
				
			||||||
	        safecopy = 1;
 | 
					 | 
				
			||||||
		if (kbdp->req_size)
 | 
							if (kbdp->req_size)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			/* We handle only request at a time */
 | 
								/* We handle only request at a time */
 | 
				
			||||||
@ -251,9 +249,8 @@ 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->IO_ENDPT;
 | 
				
			||||||
			kbdp->req_addr_g= (vir_bytes)m->ADDRESS;
 | 
								kbdp->req_grant= (cp_grant_id_t) m->IO_GRANT;
 | 
				
			||||||
			kbdp->req_addr_offset= 0;
 | 
								kbdp->req_addr_offset= 0;
 | 
				
			||||||
			kbdp->req_safe= safecopy;
 | 
					 | 
				
			||||||
			kbdp->incaller= m->m_source;
 | 
								kbdp->incaller= m->m_source;
 | 
				
			||||||
			r= SUSPEND;
 | 
								r= SUSPEND;
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
@ -267,13 +264,8 @@ 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);
 | 
				
			||||||
		if(safecopy) {
 | 
							r= sys_safecopyto(m->IO_ENDPT, (cp_grant_id_t) m->IO_GRANT, 0, 
 | 
				
			||||||
		  r= sys_safecopyto(m->IO_ENDPT, (vir_bytes) m->ADDRESS, 0, 
 | 
					 | 
				
			||||||
			(vir_bytes) &kbdp->buf[kbdp->offset], n, D);
 | 
								(vir_bytes) &kbdp->buf[kbdp->offset], n, D);
 | 
				
			||||||
		} else {
 | 
					 | 
				
			||||||
		  r= sys_vircopy(SELF, D, (vir_bytes)&kbdp->buf[kbdp->offset], 
 | 
					 | 
				
			||||||
			m->IO_ENDPT, D, (vir_bytes) m->ADDRESS, n);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		if (r == OK)
 | 
							if (r == OK)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			kbdp->offset= (kbdp->offset+n) % KBD_BUFSZ;
 | 
								kbdp->offset= (kbdp->offset+n) % KBD_BUFSZ;
 | 
				
			||||||
@ -286,7 +278,6 @@ message *m;
 | 
				
			|||||||
		break;
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	    case DEV_WRITE_S:
 | 
						    case DEV_WRITE_S:
 | 
				
			||||||
	        safecopy = 1;
 | 
					 | 
				
			||||||
		if (kbdp != &kbdaux)
 | 
							if (kbdp != &kbdaux)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			printf("write to keyboard not implemented\n");
 | 
								printf("write to keyboard not implemented\n");
 | 
				
			||||||
@ -300,14 +291,8 @@ message *m;
 | 
				
			|||||||
		 */
 | 
							 */
 | 
				
			||||||
		for (i= 0; i<m->COUNT; i++)
 | 
							for (i= 0; i<m->COUNT; i++)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			if(safecopy) {
 | 
								r= sys_safecopyfrom(m->IO_ENDPT, (cp_grant_id_t)
 | 
				
			||||||
		  	  r= sys_safecopyfrom(m->IO_ENDPT, (vir_bytes)
 | 
									m->IO_GRANT, i, (vir_bytes) &c, 1, D);
 | 
				
			||||||
				m->ADDRESS, i, (vir_bytes)&c, 1, D);
 | 
					 | 
				
			||||||
			} else {
 | 
					 | 
				
			||||||
			  r= sys_vircopy(m->IO_ENDPT, D,
 | 
					 | 
				
			||||||
				(vir_bytes) m->ADDRESS+i,
 | 
					 | 
				
			||||||
				SELF, D, (vir_bytes)&c, 1);
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			if (r != OK)
 | 
								if (r != OK)
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
			kbc_cmd1(KBC_WRITE_AUX, c);
 | 
								kbc_cmd1(KBC_WRITE_AUX, c);
 | 
				
			||||||
@ -337,21 +322,15 @@ message *m;
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	    case DEV_IOCTL_S:
 | 
						    case DEV_IOCTL_S:
 | 
				
			||||||
		 safecopy=1;
 | 
					 | 
				
			||||||
		if (kbdp == &kbd && m->TTY_REQUEST == KIOCSLEDS)
 | 
							if (kbdp == &kbd && m->TTY_REQUEST == KIOCSLEDS)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			kio_leds_t leds;
 | 
								kio_leds_t leds;
 | 
				
			||||||
			unsigned char b;
 | 
								unsigned char b;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			if(safecopy) {
 | 
								r= sys_safecopyfrom(m->IO_ENDPT, (cp_grant_id_t)
 | 
				
			||||||
		  	  r= sys_safecopyfrom(m->IO_ENDPT, (vir_bytes)
 | 
									m->IO_GRANT, 0, (vir_bytes) &leds,
 | 
				
			||||||
				m->ADDRESS, 0, (vir_bytes)&leds,
 | 
					 | 
				
			||||||
				sizeof(leds), D);
 | 
									sizeof(leds), D);
 | 
				
			||||||
			} else {
 | 
					 | 
				
			||||||
			 r= sys_vircopy(m->IO_ENDPT, D, (vir_bytes) m->ADDRESS,
 | 
					 | 
				
			||||||
				SELF, D, (vir_bytes)&leds, sizeof(leds));
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			if (r != OK)
 | 
								if (r != OK)
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
			b= 0;
 | 
								b= 0;
 | 
				
			||||||
@ -384,14 +363,9 @@ message *m;
 | 
				
			|||||||
			kio_bell_t bell;
 | 
								kio_bell_t bell;
 | 
				
			||||||
			clock_t ticks;
 | 
								clock_t ticks;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if(safecopy) {
 | 
								r = sys_safecopyfrom(m->IO_ENDPT, (cp_grant_id_t)
 | 
				
			||||||
		  	  r= sys_safecopyfrom(m->IO_ENDPT, (vir_bytes)
 | 
									m->IO_GRANT, 0, (vir_bytes) &bell,
 | 
				
			||||||
				m->ADDRESS, 0, (vir_bytes)&bell,
 | 
					 | 
				
			||||||
				sizeof(bell), D);
 | 
									sizeof(bell), D);
 | 
				
			||||||
			} else {
 | 
					 | 
				
			||||||
			  r= sys_vircopy(m->IO_ENDPT, D, (vir_bytes) m->ADDRESS,
 | 
					 | 
				
			||||||
				SELF, D, (vir_bytes)&bell, sizeof(bell));
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			if (r != OK)
 | 
								if (r != OK)
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -436,13 +410,8 @@ 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;
 | 
				
			||||||
		if(kbdp->req_safe) {
 | 
							r= sys_safecopyto(kbdp->req_proc, kbdp->req_grant, 0,
 | 
				
			||||||
		  r= sys_safecopyto(kbdp->req_proc, kbdp->req_addr_g, 0,
 | 
					 | 
				
			||||||
			(vir_bytes)&kbdp->buf[kbdp->offset], n, D);
 | 
								(vir_bytes)&kbdp->buf[kbdp->offset], n, D);
 | 
				
			||||||
		} else {
 | 
					 | 
				
			||||||
		  r= sys_vircopy(SELF, D, (vir_bytes)&kbdp->buf[kbdp->offset], 
 | 
					 | 
				
			||||||
			kbdp->req_proc, D, kbdp->req_addr_g, n);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		if (r == OK)
 | 
							if (r == OK)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			kbdp->offset= (kbdp->offset+n) % KBD_BUFSZ;
 | 
								kbdp->offset= (kbdp->offset+n) % KBD_BUFSZ;
 | 
				
			||||||
@ -452,7 +421,7 @@ message *m;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		m->m_type = DEV_REVIVE;
 | 
							m->m_type = DEV_REVIVE;
 | 
				
			||||||
  		m->REP_ENDPT= kbdp->req_proc;
 | 
					  		m->REP_ENDPT= kbdp->req_proc;
 | 
				
			||||||
  		m->REP_IO_GRANT= kbdp->req_addr_g;
 | 
					  		m->REP_IO_GRANT= kbdp->req_grant;
 | 
				
			||||||
  		m->REP_STATUS= r;
 | 
					  		m->REP_STATUS= r;
 | 
				
			||||||
		return 1;
 | 
							return 1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@ -653,7 +622,7 @@ int try;
 | 
				
			|||||||
			ch -= SF1;
 | 
								ch -= SF1;
 | 
				
			||||||
			suffix = '2';
 | 
								suffix = '2';
 | 
				
			||||||
		} else
 | 
							} else
 | 
				
			||||||
		if (CF1 <= ch && ch <= CF12) {
 | 
							/* (CF1 <= ch && ch <= CF12) */ {
 | 
				
			||||||
			ch -= CF1;
 | 
								ch -= CF1;
 | 
				
			||||||
			suffix = shift ? '6' : '5';
 | 
								suffix = shift ? '6' : '5';
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@ -709,7 +678,6 @@ PRIVATE void kbd_send()
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	unsigned long sb;
 | 
						unsigned long sb;
 | 
				
			||||||
	int r;
 | 
						int r;
 | 
				
			||||||
	clock_t now;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!kbdout.avail)
 | 
						if (!kbdout.avail)
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
@ -1088,21 +1056,12 @@ PUBLIC void kb_init_once(void)
 | 
				
			|||||||
/*===========================================================================*
 | 
					/*===========================================================================*
 | 
				
			||||||
 *				kbd_loadmap				     *
 | 
					 *				kbd_loadmap				     *
 | 
				
			||||||
 *===========================================================================*/
 | 
					 *===========================================================================*/
 | 
				
			||||||
PUBLIC int kbd_loadmap(m, safe)
 | 
					PUBLIC int kbd_loadmap(m)
 | 
				
			||||||
message *m;
 | 
					message *m;
 | 
				
			||||||
int safe;
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
/* Load a new keymap. */
 | 
					/* Load a new keymap. */
 | 
				
			||||||
  int result;
 | 
					  return sys_safecopyfrom(m->IO_ENDPT, (cp_grant_id_t) m->IO_GRANT,
 | 
				
			||||||
  if(safe) {
 | 
						0, (vir_bytes) keymap, (vir_bytes) sizeof(keymap), D);
 | 
				
			||||||
    result = sys_safecopyfrom(m->IO_ENDPT, (vir_bytes) m->ADDRESS,
 | 
					 | 
				
			||||||
  	0, (vir_bytes) keymap, (vir_bytes) sizeof(keymap), D);
 | 
					 | 
				
			||||||
  } else {
 | 
					 | 
				
			||||||
    result = sys_vircopy(m->IO_ENDPT, D, (vir_bytes) m->ADDRESS,
 | 
					 | 
				
			||||||
  	SELF, D, (vir_bytes) keymap, 
 | 
					 | 
				
			||||||
  	(vir_bytes) sizeof(keymap));
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  return(result);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*===========================================================================*
 | 
					/*===========================================================================*
 | 
				
			||||||
@ -1341,8 +1300,6 @@ int *isauxp;
 | 
				
			|||||||
PRIVATE void kbd_watchdog(tmrp)
 | 
					PRIVATE void kbd_watchdog(tmrp)
 | 
				
			||||||
timer_t *tmrp;
 | 
					timer_t *tmrp;
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int r;
 | 
					 | 
				
			||||||
	clock_t now;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	kbd_watchdog_set= 0;
 | 
						kbd_watchdog_set= 0;
 | 
				
			||||||
	if (!kbdout.avail)
 | 
						if (!kbdout.avail)
 | 
				
			||||||
 | 
				
			|||||||
@ -36,9 +36,8 @@ typedef struct pty {
 | 
				
			|||||||
  char		rdsendreply;	/* send a reply (instead of notify) */
 | 
					  char		rdsendreply;	/* send a reply (instead of notify) */
 | 
				
			||||||
  int		rdcaller;	/* process making the call (usually FS) */
 | 
					  int		rdcaller;	/* process making the call (usually FS) */
 | 
				
			||||||
  int		rdproc;		/* process that wants to read from the pty */
 | 
					  int		rdproc;		/* process that wants to read from the pty */
 | 
				
			||||||
  vir_bytes	rdvir_g;	/* virtual address in readers address space */
 | 
					  cp_grant_id_t	rdgrant;	/* grant for readers address space */
 | 
				
			||||||
  vir_bytes	rdvir_offset;	/* offset in above grant */
 | 
					  vir_bytes	rdoffset;	/* offset in above grant */
 | 
				
			||||||
  int		rdsafe;		/* safe read mode? */
 | 
					 | 
				
			||||||
  int		rdleft;		/* # bytes yet to be read */
 | 
					  int		rdleft;		/* # bytes yet to be read */
 | 
				
			||||||
  int		rdcum;		/* # bytes written so far */
 | 
					  int		rdcum;		/* # bytes written so far */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -46,9 +45,8 @@ typedef struct pty {
 | 
				
			|||||||
  char		wrsendreply;	/* send a reply (instead of notify) */
 | 
					  char		wrsendreply;	/* send a reply (instead of notify) */
 | 
				
			||||||
  int		wrcaller;	/* process making the call (usually FS) */
 | 
					  int		wrcaller;	/* process making the call (usually FS) */
 | 
				
			||||||
  int		wrproc;		/* process that wants to write to the pty */
 | 
					  int		wrproc;		/* process that wants to write to the pty */
 | 
				
			||||||
  vir_bytes	wrvir_g;	/* virtual address in writers address space */
 | 
					  cp_grant_id_t	wrgrant;	/* grant for writers address space */
 | 
				
			||||||
  vir_bytes	wrvir_offset;	/* offset in above grant */
 | 
					  vir_bytes	wroffset;	/* offset in above grant */
 | 
				
			||||||
  int		wrsafe;		/* safe write mode? */
 | 
					 | 
				
			||||||
  int		wrleft;		/* # bytes yet to be written */
 | 
					  int		wrleft;		/* # bytes yet to be written */
 | 
				
			||||||
  int		wrcum;		/* # bytes written so far */
 | 
					  int		wrcum;		/* # bytes written so far */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -87,11 +85,9 @@ PUBLIC void do_pty(tty_t *tp, message *m_ptr)
 | 
				
			|||||||
/* Perform an open/close/read/write call on a /dev/ptypX device. */
 | 
					/* Perform an open/close/read/write call on a /dev/ptypX device. */
 | 
				
			||||||
  pty_t *pp = tp->tty_priv;
 | 
					  pty_t *pp = tp->tty_priv;
 | 
				
			||||||
  int r;
 | 
					  int r;
 | 
				
			||||||
  int safe = 0;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  switch (m_ptr->m_type) {
 | 
					  switch (m_ptr->m_type) {
 | 
				
			||||||
    case DEV_READ_S:
 | 
					    case DEV_READ_S:
 | 
				
			||||||
	safe=1;
 | 
					 | 
				
			||||||
	/* Check, store information on the reader, do I/O. */
 | 
						/* Check, store information on the reader, do I/O. */
 | 
				
			||||||
	if (pp->state & TTY_CLOSED) {
 | 
						if (pp->state & TTY_CLOSED) {
 | 
				
			||||||
		r = 0;
 | 
							r = 0;
 | 
				
			||||||
@ -108,9 +104,8 @@ 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->IO_ENDPT;
 | 
				
			||||||
	pp->rdvir_g = (vir_bytes) m_ptr->ADDRESS;
 | 
						pp->rdgrant = (cp_grant_id_t) m_ptr->IO_GRANT;
 | 
				
			||||||
	pp->rdvir_offset = 0;
 | 
						pp->rdoffset = 0;
 | 
				
			||||||
	pp->rdsafe = safe;
 | 
					 | 
				
			||||||
	pp->rdleft = m_ptr->COUNT;
 | 
						pp->rdleft = m_ptr->COUNT;
 | 
				
			||||||
	pty_start(pp);
 | 
						pty_start(pp);
 | 
				
			||||||
	handle_events(tp);
 | 
						handle_events(tp);
 | 
				
			||||||
@ -125,7 +120,6 @@ PUBLIC void do_pty(tty_t *tp, message *m_ptr)
 | 
				
			|||||||
	break;
 | 
						break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    case DEV_WRITE_S:
 | 
					    case DEV_WRITE_S:
 | 
				
			||||||
	safe=1;
 | 
					 | 
				
			||||||
	/* Check, store information on the writer, do I/O. */
 | 
						/* Check, store information on the writer, do I/O. */
 | 
				
			||||||
	if (pp->state & TTY_CLOSED) {
 | 
						if (pp->state & TTY_CLOSED) {
 | 
				
			||||||
		r = EIO;
 | 
							r = EIO;
 | 
				
			||||||
@ -142,9 +136,8 @@ 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->IO_ENDPT;
 | 
				
			||||||
	pp->wrvir_g = (vir_bytes) m_ptr->ADDRESS;
 | 
						pp->wrgrant = (cp_grant_id_t) m_ptr->IO_GRANT;
 | 
				
			||||||
	pp->wrvir_offset = 0;
 | 
						pp->wroffset = 0;
 | 
				
			||||||
	pp->wrsafe = safe;
 | 
					 | 
				
			||||||
	pp->wrleft = m_ptr->COUNT;
 | 
						pp->wrleft = m_ptr->COUNT;
 | 
				
			||||||
	handle_events(tp);
 | 
						handle_events(tp);
 | 
				
			||||||
	if (pp->wrleft == 0) {
 | 
						if (pp->wrleft == 0) {
 | 
				
			||||||
@ -237,16 +230,9 @@ 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(tp->tty_out_safe) {
 | 
						if ((s = sys_safecopyfrom(tp->tty_outproc, tp->tty_outgrant,
 | 
				
			||||||
	  if ((s = sys_safecopyfrom(tp->tty_outproc, tp->tty_out_vir_g,
 | 
							tp->tty_outoffset, (vir_bytes) pp->ohead, count, D))!=OK) {
 | 
				
			||||||
		tp->tty_out_vir_offset, (vir_bytes) pp->ohead, count, D))!=OK) {
 | 
					 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
 	  }
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
	  if ((s = sys_vircopy(tp->tty_outproc, D, (vir_bytes) tp->tty_out_vir_g,
 | 
					 | 
				
			||||||
		SELF, D, (vir_bytes) pp->ohead, (phys_bytes) count)) != OK) {
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	  }
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Perform output processing on the output buffer. */
 | 
						/* Perform output processing on the output buffer. */
 | 
				
			||||||
@ -262,8 +248,7 @@ PRIVATE int pty_write(tty_t *tp, int try)
 | 
				
			|||||||
		pp->ohead -= buflen(pp->obuf);
 | 
							pp->ohead -= buflen(pp->obuf);
 | 
				
			||||||
	pty_start(pp);
 | 
						pty_start(pp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(tp->tty_out_safe) tp->tty_out_vir_offset += count;
 | 
						tp->tty_outoffset += count;
 | 
				
			||||||
	else tp->tty_out_vir_g += count;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	tp->tty_outcum += count;
 | 
						tp->tty_outcum += count;
 | 
				
			||||||
	if ((tp->tty_outleft -= count) == 0) {
 | 
						if ((tp->tty_outleft -= count) == 0) {
 | 
				
			||||||
@ -322,20 +307,11 @@ 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 (pp->rdsafe) {
 | 
						if((s = sys_safecopyto(pp->rdproc, pp->rdgrant,
 | 
				
			||||||
	  if((s = sys_safecopyto(pp->rdproc, pp->rdvir_g,
 | 
							pp->rdoffset, (vir_bytes) pp->otail, count, D)) != OK) {
 | 
				
			||||||
		pp->rdvir_offset, (vir_bytes) pp->otail, count, D)) != OK) {
 | 
					 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
 	  }
 | 
					 	}
 | 
				
			||||||
	  pp->rdvir_offset += count;
 | 
						pp->rdoffset += count;
 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
	  if ((s = sys_vircopy(SELF, D, (vir_bytes)pp->otail,
 | 
					 | 
				
			||||||
		(vir_bytes) pp->rdproc, D, (vir_bytes) pp->rdvir_g, (phys_bytes) count)) != OK) {
 | 
					 | 
				
			||||||
		printf("pty tty: copy failed (error %d)\n",  s);
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	  }
 | 
					 | 
				
			||||||
	  pp->rdvir_g += count;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Bookkeeping. */
 | 
						/* Bookkeeping. */
 | 
				
			||||||
	pp->ocount -= count;
 | 
						pp->ocount -= count;
 | 
				
			||||||
@ -400,21 +376,12 @@ PRIVATE int pty_read(tty_t *tp, int try)
 | 
				
			|||||||
  	int s;
 | 
					  	int s;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Transfer one character to 'c'. */
 | 
						/* Transfer one character to 'c'. */
 | 
				
			||||||
	if(pp->wrsafe) {
 | 
						if ((s = sys_safecopyfrom(pp->wrproc, pp->wrgrant, pp->wroffset,
 | 
				
			||||||
	   if ((s = sys_safecopyfrom(pp->wrproc, pp->wrvir_g,
 | 
							(vir_bytes) &c, 1, D)) != OK) {
 | 
				
			||||||
	     pp->wrvir_offset, (vir_bytes) &c, 1, D)) != OK) {
 | 
					 | 
				
			||||||
		printf("pty: safecopy failed (error %d)\n", s);
 | 
							printf("pty: safecopy failed (error %d)\n", s);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	   }
 | 
					 | 
				
			||||||
	  pp->wrvir_offset++;
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
  	  if ((s = sys_vircopy(pp->wrproc, D, (vir_bytes) pp->wrvir_g,
 | 
					 | 
				
			||||||
		SELF, D, (vir_bytes) &c, (phys_bytes) 1)) != OK) {
 | 
					 | 
				
			||||||
		printf("pty: copy failed (error %d)\n", s);
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	  }
 | 
					 | 
				
			||||||
	  pp->wrvir_g++;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						pp->wroffset++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Input processing. */
 | 
						/* Input processing. */
 | 
				
			||||||
	if (in_process(tp, &c, 1, -1) == 0) break;
 | 
						if (in_process(tp, &c, 1, -1) == 0) break;
 | 
				
			||||||
@ -534,7 +501,7 @@ PUBLIC int pty_status(message *m_ptr)
 | 
				
			|||||||
		{
 | 
							{
 | 
				
			||||||
			m_ptr->m_type = DEV_REVIVE;
 | 
								m_ptr->m_type = DEV_REVIVE;
 | 
				
			||||||
			m_ptr->REP_ENDPT = pp->rdproc;
 | 
								m_ptr->REP_ENDPT = pp->rdproc;
 | 
				
			||||||
			m_ptr->REP_IO_GRANT = pp->rdvir_g;
 | 
								m_ptr->REP_IO_GRANT = pp->rdgrant;
 | 
				
			||||||
			m_ptr->REP_STATUS = pp->rdcum;
 | 
								m_ptr->REP_STATUS = pp->rdcum;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			pp->rdleft = pp->rdcum = 0;
 | 
								pp->rdleft = pp->rdcum = 0;
 | 
				
			||||||
@ -548,7 +515,7 @@ PUBLIC int pty_status(message *m_ptr)
 | 
				
			|||||||
		{
 | 
							{
 | 
				
			||||||
			m_ptr->m_type = DEV_REVIVE;
 | 
								m_ptr->m_type = DEV_REVIVE;
 | 
				
			||||||
			m_ptr->REP_ENDPT = pp->wrproc;
 | 
								m_ptr->REP_ENDPT = pp->wrproc;
 | 
				
			||||||
			m_ptr->REP_IO_GRANT = pp->wrvir_g;
 | 
								m_ptr->REP_IO_GRANT = pp->wrgrant;
 | 
				
			||||||
			if (pp->wrcum == 0)
 | 
								if (pp->wrcum == 0)
 | 
				
			||||||
				m_ptr->REP_STATUS = EIO;
 | 
									m_ptr->REP_STATUS = EIO;
 | 
				
			||||||
			else
 | 
								else
 | 
				
			||||||
 | 
				
			|||||||
@ -248,13 +248,8 @@ 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. */
 | 
				
			||||||
	if(tp->tty_out_safe) {
 | 
						sys_safecopyfrom(tp->tty_outproc, tp->tty_outgrant, 
 | 
				
			||||||
	   sys_safecopyfrom(tp->tty_outproc, tp->tty_out_vir_g, 
 | 
							tp->tty_outoffset, (vir_bytes) rs->ohead, count, D);
 | 
				
			||||||
		tp->tty_out_vir_offset, (vir_bytes) rs->ohead, count, D);
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
	   sys_vircopy(tp->tty_outproc, D, (vir_bytes) tp->tty_out_vir_g, 
 | 
					 | 
				
			||||||
		SELF, D, (vir_bytes) rs->ohead, (phys_bytes) count);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Perform output processing on the output buffer. */
 | 
						/* Perform output processing on the output buffer. */
 | 
				
			||||||
	out_process(tp, rs->obuf, rs->ohead, bufend(rs->obuf), &count, &ocount);
 | 
						out_process(tp, rs->obuf, rs->ohead, bufend(rs->obuf), &count, &ocount);
 | 
				
			||||||
@ -270,11 +265,7 @@ PRIVATE int rs_write(register tty_t *tp, int try)
 | 
				
			|||||||
	unlock();
 | 
						unlock();
 | 
				
			||||||
	if ((rs->ohead += ocount) >= bufend(rs->obuf))
 | 
						if ((rs->ohead += ocount) >= bufend(rs->obuf))
 | 
				
			||||||
		rs->ohead -= buflen(rs->obuf);
 | 
							rs->ohead -= buflen(rs->obuf);
 | 
				
			||||||
	if(tp->tty_out_safe) {
 | 
						tp->tty_outoffset += count;
 | 
				
			||||||
		tp->tty_out_vir_offset += count;
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
		tp->tty_out_vir_g += count;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	tp->tty_outcum += count;
 | 
						tp->tty_outcum += count;
 | 
				
			||||||
	if ((tp->tty_outleft -= count) == 0) {
 | 
						if ((tp->tty_outleft -= count) == 0) {
 | 
				
			||||||
		/* Output is finished, reply to the writer. */
 | 
							/* Output is finished, reply to the writer. */
 | 
				
			||||||
 | 
				
			|||||||
@ -30,15 +30,15 @@
 | 
				
			|||||||
 *   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  ADDRESS
 | 
					 *    m_type      TTY_LINE   IO_ENDPT    COUNT   TTY_SPEKS IO_GRANT
 | 
				
			||||||
 * -----------------------------------------------------------------
 | 
					 * -----------------------------------------------------------------
 | 
				
			||||||
 * | HARD_INT    |         |         |         |         |         |
 | 
					 * | HARD_INT    |         |         |         |         |         |
 | 
				
			||||||
 * |-------------+---------+---------+---------+---------+---------|
 | 
					 * |-------------+---------+---------+---------+---------+---------|
 | 
				
			||||||
 * | SYS_SIG     | sig set |         |         |         |         |
 | 
					 * | SYS_SIG     | sig set |         |         |         |         |
 | 
				
			||||||
 * |-------------+---------+---------+---------+---------+---------|
 | 
					 * |-------------+---------+---------+---------+---------+---------|
 | 
				
			||||||
 * | DEV_READ    |minor dev| proc nr |  count  |         | buf ptr |
 | 
					 * | DEV_READ    |minor dev| proc nr |  count  |         |  grant  |
 | 
				
			||||||
 * |-------------+---------+---------+---------+---------+---------|
 | 
					 * |-------------+---------+---------+---------+---------+---------|
 | 
				
			||||||
 * | DEV_WRITE   |minor dev| proc nr |  count  |         | buf ptr |
 | 
					 * | DEV_WRITE   |minor dev| proc nr |  count  |         |  grant  |
 | 
				
			||||||
 * |-------------+---------+---------+---------+---------+---------|
 | 
					 * |-------------+---------+---------+---------+---------+---------|
 | 
				
			||||||
 * | DEV_IOCTL   |minor dev| proc nr |func code|erase etc|         |
 | 
					 * | DEV_IOCTL   |minor dev| proc nr |func code|erase etc|         |
 | 
				
			||||||
 * |-------------+---------+---------+---------+---------+---------|
 | 
					 * |-------------+---------+---------+---------+---------+---------|
 | 
				
			||||||
@ -104,11 +104,11 @@ struct kmessages kmess;
 | 
				
			|||||||
FORWARD _PROTOTYPE( void tty_timed_out, (timer_t *tp)			);
 | 
					FORWARD _PROTOTYPE( void tty_timed_out, (timer_t *tp)			);
 | 
				
			||||||
FORWARD _PROTOTYPE( void settimer, (tty_t *tty_ptr, int enable)		);
 | 
					FORWARD _PROTOTYPE( void settimer, (tty_t *tty_ptr, int enable)		);
 | 
				
			||||||
FORWARD _PROTOTYPE( void do_cancel, (tty_t *tp, message *m_ptr)		);
 | 
					FORWARD _PROTOTYPE( void do_cancel, (tty_t *tp, message *m_ptr)		);
 | 
				
			||||||
FORWARD _PROTOTYPE( void do_ioctl, (tty_t *tp, message *m_ptr, int s)	);
 | 
					FORWARD _PROTOTYPE( void do_ioctl, (tty_t *tp, message *m_ptr)		);
 | 
				
			||||||
FORWARD _PROTOTYPE( void do_open, (tty_t *tp, message *m_ptr)		);
 | 
					FORWARD _PROTOTYPE( void do_open, (tty_t *tp, message *m_ptr)		);
 | 
				
			||||||
FORWARD _PROTOTYPE( void do_close, (tty_t *tp, message *m_ptr)		);
 | 
					FORWARD _PROTOTYPE( void do_close, (tty_t *tp, message *m_ptr)		);
 | 
				
			||||||
FORWARD _PROTOTYPE( void do_read, (tty_t *tp, message *m_ptr, int s)	);
 | 
					FORWARD _PROTOTYPE( void do_read, (tty_t *tp, message *m_ptr)		);
 | 
				
			||||||
FORWARD _PROTOTYPE( void do_write, (tty_t *tp, message *m_ptr, int s)	);
 | 
					FORWARD _PROTOTYPE( void do_write, (tty_t *tp, message *m_ptr)		);
 | 
				
			||||||
FORWARD _PROTOTYPE( void do_select, (tty_t *tp, message *m_ptr)		);
 | 
					FORWARD _PROTOTYPE( void do_select, (tty_t *tp, message *m_ptr)		);
 | 
				
			||||||
FORWARD _PROTOTYPE( void do_status, (message *m_ptr)			);
 | 
					FORWARD _PROTOTYPE( void do_status, (message *m_ptr)			);
 | 
				
			||||||
FORWARD _PROTOTYPE( void in_transfer, (tty_t *tp)			);
 | 
					FORWARD _PROTOTYPE( void in_transfer, (tty_t *tp)			);
 | 
				
			||||||
@ -210,25 +210,6 @@ PUBLIC int main(void)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	switch (tty_mess.m_type) { 
 | 
						switch (tty_mess.m_type) { 
 | 
				
			||||||
	case DIAGNOSTICS_OLD: 		/* a server wants to print some */
 | 
					 | 
				
			||||||
#if 0
 | 
					 | 
				
			||||||
		if (tty_mess.m_source != LOG_PROC_NR)
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			printf("[%d ", tty_mess.m_source);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
		do_diagnostics(&tty_mess, 0);
 | 
					 | 
				
			||||||
		continue;
 | 
					 | 
				
			||||||
	case DIAGNOSTICS_S_OLD: 
 | 
					 | 
				
			||||||
	case ASYN_DIAGNOSTICS_OLD: 
 | 
					 | 
				
			||||||
		do_diagnostics(&tty_mess, 1);
 | 
					 | 
				
			||||||
		continue;
 | 
					 | 
				
			||||||
	case GET_KMESS:
 | 
					 | 
				
			||||||
		do_get_kmess(&tty_mess);
 | 
					 | 
				
			||||||
		continue;
 | 
					 | 
				
			||||||
	case GET_KMESS_S:
 | 
					 | 
				
			||||||
		do_get_kmess_s(&tty_mess);
 | 
					 | 
				
			||||||
		continue;
 | 
					 | 
				
			||||||
	case FKEY_CONTROL:		/* (un)register a fkey observer */
 | 
						case FKEY_CONTROL:		/* (un)register a fkey observer */
 | 
				
			||||||
		do_fkey_ctl(&tty_mess);
 | 
							do_fkey_ctl(&tty_mess);
 | 
				
			||||||
		continue;
 | 
							continue;
 | 
				
			||||||
@ -289,9 +270,9 @@ PUBLIC int main(void)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	/* Execute the requested device driver function. */
 | 
						/* Execute the requested device driver function. */
 | 
				
			||||||
	switch (tty_mess.m_type) {
 | 
						switch (tty_mess.m_type) {
 | 
				
			||||||
	    case DEV_READ_S:	 do_read(tp, &tty_mess, 1);	  break;
 | 
						    case DEV_READ_S:	 do_read(tp, &tty_mess);	  break;
 | 
				
			||||||
	    case DEV_WRITE_S:	 do_write(tp, &tty_mess, 1);	  break;
 | 
						    case DEV_WRITE_S:	 do_write(tp, &tty_mess);	  break;
 | 
				
			||||||
	    case DEV_IOCTL_S:	 do_ioctl(tp, &tty_mess, 1);	  break;
 | 
						    case DEV_IOCTL_S:	 do_ioctl(tp, &tty_mess);	  break;
 | 
				
			||||||
	    case DEV_OPEN:	 do_open(tp, &tty_mess);	  break;
 | 
						    case DEV_OPEN:	 do_open(tp, &tty_mess);	  break;
 | 
				
			||||||
	    case DEV_CLOSE:	 do_close(tp, &tty_mess);	  break;
 | 
						    case DEV_CLOSE:	 do_close(tp, &tty_mess);	  break;
 | 
				
			||||||
	    case DEV_SELECT:	 do_select(tp, &tty_mess);	  break;
 | 
						    case DEV_SELECT:	 do_select(tp, &tty_mess);	  break;
 | 
				
			||||||
@ -399,7 +380,7 @@ message *m_ptr;
 | 
				
			|||||||
		/* Suspended request finished. Send a REVIVE. */
 | 
							/* Suspended request finished. Send a REVIVE. */
 | 
				
			||||||
		m_ptr->m_type = DEV_REVIVE;
 | 
							m_ptr->m_type = DEV_REVIVE;
 | 
				
			||||||
  		m_ptr->REP_ENDPT = tp->tty_inproc;
 | 
					  		m_ptr->REP_ENDPT = tp->tty_inproc;
 | 
				
			||||||
  		m_ptr->REP_IO_GRANT = tp->tty_in_vir_g;
 | 
					  		m_ptr->REP_IO_GRANT = tp->tty_ingrant;
 | 
				
			||||||
  		m_ptr->REP_STATUS = tp->tty_incum;
 | 
					  		m_ptr->REP_STATUS = tp->tty_incum;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		tp->tty_inleft = tp->tty_incum = 0;
 | 
							tp->tty_inleft = tp->tty_incum = 0;
 | 
				
			||||||
@ -412,7 +393,7 @@ message *m_ptr;
 | 
				
			|||||||
		/* Suspended request finished. Send a REVIVE. */
 | 
							/* Suspended request finished. Send a REVIVE. */
 | 
				
			||||||
		m_ptr->m_type = DEV_REVIVE;
 | 
							m_ptr->m_type = DEV_REVIVE;
 | 
				
			||||||
  		m_ptr->REP_ENDPT = tp->tty_outproc;
 | 
					  		m_ptr->REP_ENDPT = tp->tty_outproc;
 | 
				
			||||||
  		m_ptr->REP_IO_GRANT = tp->tty_out_vir_g;
 | 
					  		m_ptr->REP_IO_GRANT = tp->tty_outgrant;
 | 
				
			||||||
  		m_ptr->REP_STATUS = tp->tty_outcum;
 | 
					  		m_ptr->REP_STATUS = tp->tty_outcum;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		tp->tty_outcum = 0;
 | 
							tp->tty_outcum = 0;
 | 
				
			||||||
@ -424,7 +405,7 @@ message *m_ptr;
 | 
				
			|||||||
		/* Suspended request finished. Send a REVIVE. */
 | 
							/* Suspended request finished. Send a REVIVE. */
 | 
				
			||||||
		m_ptr->m_type = DEV_REVIVE;
 | 
							m_ptr->m_type = DEV_REVIVE;
 | 
				
			||||||
  		m_ptr->REP_ENDPT = tp->tty_ioproc;
 | 
					  		m_ptr->REP_ENDPT = tp->tty_ioproc;
 | 
				
			||||||
  		m_ptr->REP_IO_GRANT = tp->tty_iovir_g;
 | 
					  		m_ptr->REP_IO_GRANT = tp->tty_iogrant;
 | 
				
			||||||
  		m_ptr->REP_STATUS = tp->tty_iostatus;
 | 
					  		m_ptr->REP_STATUS = tp->tty_iostatus;
 | 
				
			||||||
		tp->tty_iorevived = 0;		/* unmark revive event */
 | 
							tp->tty_iorevived = 0;		/* unmark revive event */
 | 
				
			||||||
  		event_found = 1;
 | 
					  		event_found = 1;
 | 
				
			||||||
@ -455,10 +436,9 @@ message *m_ptr;
 | 
				
			|||||||
/*===========================================================================*
 | 
					/*===========================================================================*
 | 
				
			||||||
 *				do_read					     *
 | 
					 *				do_read					     *
 | 
				
			||||||
 *===========================================================================*/
 | 
					 *===========================================================================*/
 | 
				
			||||||
PRIVATE void do_read(tp, m_ptr, safe)
 | 
					PRIVATE void do_read(tp, m_ptr)
 | 
				
			||||||
register tty_t *tp;		/* pointer to tty struct */
 | 
					register tty_t *tp;		/* pointer to tty struct */
 | 
				
			||||||
register message *m_ptr;	/* pointer to message sent to the task */
 | 
					register message *m_ptr;	/* pointer to message sent to the task */
 | 
				
			||||||
int safe;			/* use safecopies? */
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
/* A process wants to read from a terminal. */
 | 
					/* A process wants to read from a terminal. */
 | 
				
			||||||
  int r;
 | 
					  int r;
 | 
				
			||||||
@ -476,9 +456,8 @@ int safe;			/* use safecopies? */
 | 
				
			|||||||
	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->IO_ENDPT;
 | 
				
			||||||
	tp->tty_in_vir_g = (vir_bytes) m_ptr->ADDRESS;
 | 
						tp->tty_ingrant = (cp_grant_id_t) m_ptr->IO_GRANT;
 | 
				
			||||||
	tp->tty_in_vir_offset = 0;
 | 
						tp->tty_inoffset = 0;
 | 
				
			||||||
	tp->tty_in_safe = safe;
 | 
					 | 
				
			||||||
	tp->tty_inleft = m_ptr->COUNT;
 | 
						tp->tty_inleft = m_ptr->COUNT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!(tp->tty_termios.c_lflag & ICANON)
 | 
						if (!(tp->tty_termios.c_lflag & ICANON)
 | 
				
			||||||
@ -524,10 +503,9 @@ int safe;			/* use safecopies? */
 | 
				
			|||||||
/*===========================================================================*
 | 
					/*===========================================================================*
 | 
				
			||||||
 *				do_write				     *
 | 
					 *				do_write				     *
 | 
				
			||||||
 *===========================================================================*/
 | 
					 *===========================================================================*/
 | 
				
			||||||
PRIVATE void do_write(tp, m_ptr, safe)
 | 
					PRIVATE void do_write(tp, m_ptr)
 | 
				
			||||||
register tty_t *tp;
 | 
					register tty_t *tp;
 | 
				
			||||||
register message *m_ptr;	/* pointer to message sent to the task */
 | 
					register message *m_ptr;	/* pointer to message sent to the task */
 | 
				
			||||||
int safe;
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
/* A process wants to write on a terminal. */
 | 
					/* A process wants to write on a terminal. */
 | 
				
			||||||
  int r;
 | 
					  int r;
 | 
				
			||||||
@ -545,9 +523,8 @@ int safe;
 | 
				
			|||||||
	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->IO_ENDPT;
 | 
				
			||||||
	tp->tty_out_vir_g = (vir_bytes) m_ptr->ADDRESS;
 | 
						tp->tty_outgrant = (cp_grant_id_t) m_ptr->IO_GRANT;
 | 
				
			||||||
	tp->tty_out_vir_offset = 0;
 | 
						tp->tty_outoffset = 0;
 | 
				
			||||||
	tp->tty_out_safe = safe;
 | 
					 | 
				
			||||||
	tp->tty_outleft = m_ptr->COUNT;
 | 
						tp->tty_outleft = m_ptr->COUNT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Try to write. */
 | 
						/* Try to write. */
 | 
				
			||||||
@ -567,10 +544,9 @@ int safe;
 | 
				
			|||||||
/*===========================================================================*
 | 
					/*===========================================================================*
 | 
				
			||||||
 *				do_ioctl				     *
 | 
					 *				do_ioctl				     *
 | 
				
			||||||
 *===========================================================================*/
 | 
					 *===========================================================================*/
 | 
				
			||||||
PRIVATE void do_ioctl(tp, m_ptr, safe)
 | 
					PRIVATE void do_ioctl(tp, m_ptr)
 | 
				
			||||||
register tty_t *tp;
 | 
					register tty_t *tp;
 | 
				
			||||||
message *m_ptr;			/* pointer to message sent to task */
 | 
					message *m_ptr;			/* pointer to message sent to task */
 | 
				
			||||||
int safe;
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
/* Perform an IOCTL on this terminal. Posix termios calls are handled
 | 
					/* Perform an IOCTL on this terminal. Posix termios calls are handled
 | 
				
			||||||
 * by the IOCTL system call
 | 
					 * by the IOCTL system call
 | 
				
			||||||
@ -622,14 +598,8 @@ int safe;
 | 
				
			|||||||
  switch (m_ptr->TTY_REQUEST) {
 | 
					  switch (m_ptr->TTY_REQUEST) {
 | 
				
			||||||
    case TCGETS:
 | 
					    case TCGETS:
 | 
				
			||||||
	/* Get the termios attributes. */
 | 
						/* Get the termios attributes. */
 | 
				
			||||||
	if(safe) {
 | 
						r = sys_safecopyto(m_ptr->IO_ENDPT, (cp_grant_id_t) m_ptr->IO_GRANT, 0,
 | 
				
			||||||
	    r = sys_safecopyto(m_ptr->IO_ENDPT, (vir_bytes) m_ptr->ADDRESS, 0,
 | 
					 | 
				
			||||||
		(vir_bytes) &tp->tty_termios, (vir_bytes) size, D);
 | 
							(vir_bytes) &tp->tty_termios, (vir_bytes) size, D);
 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
	    r = sys_vircopy(SELF, D, (vir_bytes) &tp->tty_termios,
 | 
					 | 
				
			||||||
		m_ptr->IO_ENDPT, D, (vir_bytes) m_ptr->ADDRESS, 
 | 
					 | 
				
			||||||
		(vir_bytes) size);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	break;
 | 
						break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    case TCSETSW:
 | 
					    case TCSETSW:
 | 
				
			||||||
@ -640,8 +610,7 @@ int safe;
 | 
				
			|||||||
		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->IO_ENDPT;
 | 
				
			||||||
		tp->tty_ioreq = m_ptr->REQUEST;
 | 
							tp->tty_ioreq = m_ptr->REQUEST;
 | 
				
			||||||
		tp->tty_iovir_g = (vir_bytes) m_ptr->ADDRESS;
 | 
							tp->tty_iogrant = (cp_grant_id_t) m_ptr->IO_GRANT;
 | 
				
			||||||
		tp->tty_io_safe = safe;
 | 
					 | 
				
			||||||
		r = SUSPEND;
 | 
							r = SUSPEND;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@ -650,25 +619,15 @@ int safe;
 | 
				
			|||||||
	/*FALL THROUGH*/
 | 
						/*FALL THROUGH*/
 | 
				
			||||||
    case TCSETS:
 | 
					    case TCSETS:
 | 
				
			||||||
	/* Set the termios attributes. */
 | 
						/* Set the termios attributes. */
 | 
				
			||||||
	if(safe) {
 | 
						r = sys_safecopyfrom(m_ptr->IO_ENDPT, (cp_grant_id_t) m_ptr->IO_GRANT,
 | 
				
			||||||
	    r = sys_safecopyfrom(m_ptr->IO_ENDPT, (vir_bytes) m_ptr->ADDRESS, 0,
 | 
							0, (vir_bytes) &tp->tty_termios, (vir_bytes) size, D);
 | 
				
			||||||
		(vir_bytes) &tp->tty_termios, (vir_bytes) size, D);
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
	    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;
 | 
						if (r != OK) break;
 | 
				
			||||||
	setattr(tp);
 | 
						setattr(tp);
 | 
				
			||||||
	break;
 | 
						break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    case TCFLSH:
 | 
					    case TCFLSH:
 | 
				
			||||||
	if(safe) {
 | 
						r = sys_safecopyfrom(m_ptr->IO_ENDPT, (cp_grant_id_t) m_ptr->IO_GRANT,
 | 
				
			||||||
	   r = sys_safecopyfrom(m_ptr->IO_ENDPT, (vir_bytes) m_ptr->ADDRESS, 0,
 | 
							0, (vir_bytes) ¶m.i, (vir_bytes) size, D);
 | 
				
			||||||
		(vir_bytes) ¶m.i, (vir_bytes) size, D);
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
	   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;
 | 
						if (r != OK) break;
 | 
				
			||||||
	switch (param.i) {
 | 
						switch (param.i) {
 | 
				
			||||||
	    case TCIFLUSH:	tty_icancel(tp);		 	    break;
 | 
						    case TCIFLUSH:	tty_icancel(tp);		 	    break;
 | 
				
			||||||
@ -679,13 +638,8 @@ int safe;
 | 
				
			|||||||
	break;
 | 
						break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    case TCFLOW:
 | 
					    case TCFLOW:
 | 
				
			||||||
	if(safe) {
 | 
						r = sys_safecopyfrom(m_ptr->IO_ENDPT, (cp_grant_id_t) m_ptr->IO_GRANT,
 | 
				
			||||||
	   r = sys_safecopyfrom(m_ptr->IO_ENDPT, (vir_bytes) m_ptr->ADDRESS, 0,
 | 
							0, (vir_bytes) ¶m.i, (vir_bytes) size, D);
 | 
				
			||||||
		(vir_bytes) ¶m.i, (vir_bytes) size, D);
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
	    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;
 | 
						if (r != OK) break;
 | 
				
			||||||
	switch (param.i) {
 | 
						switch (param.i) {
 | 
				
			||||||
	    case TCOOFF:
 | 
						    case TCOOFF:
 | 
				
			||||||
@ -709,31 +663,20 @@ int safe;
 | 
				
			|||||||
	break;
 | 
						break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    case TIOCGWINSZ:
 | 
					    case TIOCGWINSZ:
 | 
				
			||||||
	if(safe) {
 | 
						r = sys_safecopyto(m_ptr->IO_ENDPT, (cp_grant_id_t) m_ptr->IO_GRANT, 0,
 | 
				
			||||||
	   r = sys_safecopyto(m_ptr->IO_ENDPT, (vir_bytes) m_ptr->ADDRESS, 0,
 | 
					 | 
				
			||||||
		(vir_bytes) &tp->tty_winsize, (vir_bytes) size, D);
 | 
							(vir_bytes) &tp->tty_winsize, (vir_bytes) size, D);
 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
	   r = sys_vircopy(SELF, D, (vir_bytes) &tp->tty_winsize,
 | 
					 | 
				
			||||||
		m_ptr->IO_ENDPT, D, (vir_bytes) m_ptr->ADDRESS, 
 | 
					 | 
				
			||||||
		(vir_bytes) size);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	break;
 | 
						break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    case TIOCSWINSZ:
 | 
					    case TIOCSWINSZ:
 | 
				
			||||||
	if(safe) {
 | 
						r = sys_safecopyfrom(m_ptr->IO_ENDPT, (cp_grant_id_t) m_ptr->IO_GRANT,
 | 
				
			||||||
	   r = sys_safecopyfrom(m_ptr->IO_ENDPT, (vir_bytes) m_ptr->ADDRESS, 0,
 | 
							0, (vir_bytes) &tp->tty_winsize, (vir_bytes) size, D);
 | 
				
			||||||
		(vir_bytes) &tp->tty_winsize, (vir_bytes) size, D);
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
	   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, 0);
 | 
						sigchar(tp, SIGWINCH, 0);
 | 
				
			||||||
	break;
 | 
						break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if (MACHINE == IBM_PC)
 | 
					#if (MACHINE == IBM_PC)
 | 
				
			||||||
    case KIOCSMAP:
 | 
					    case KIOCSMAP:
 | 
				
			||||||
	/* Load a new keymap (only /dev/console). */
 | 
						/* Load a new keymap (only /dev/console). */
 | 
				
			||||||
	if (isconsole(tp)) r = kbd_loadmap(m_ptr, safe);
 | 
						if (isconsole(tp)) r = kbd_loadmap(m_ptr);
 | 
				
			||||||
	break;
 | 
						break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    case TIOCSFON_OLD:
 | 
					    case TIOCSFON_OLD:
 | 
				
			||||||
@ -745,12 +688,6 @@ int safe;
 | 
				
			|||||||
	break;
 | 
						break;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if (MACHINE == ATARI)
 | 
					 | 
				
			||||||
    case VDU_LOADFONT:
 | 
					 | 
				
			||||||
	r = vdu_loadfont(m_ptr);
 | 
					 | 
				
			||||||
	break;
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* These Posix functions are allowed to fail if _POSIX_JOB_CONTROL is 
 | 
					/* These Posix functions are allowed to fail if _POSIX_JOB_CONTROL is 
 | 
				
			||||||
 * not defined.
 | 
					 * not defined.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@ -830,14 +767,14 @@ message *m_ptr;			/* pointer to message sent to task */
 | 
				
			|||||||
  proc_nr = m_ptr->IO_ENDPT;
 | 
					  proc_nr = m_ptr->IO_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_in_safe || tp->tty_in_vir_g==(vir_bytes)m_ptr->IO_GRANT)) {
 | 
						tp->tty_ingrant == (cp_grant_id_t) m_ptr->IO_GRANT) {
 | 
				
			||||||
	/* Process was reading when killed.  Clean up input. */
 | 
						/* Process was reading when killed.  Clean up input. */
 | 
				
			||||||
	tty_icancel(tp); 
 | 
						tty_icancel(tp); 
 | 
				
			||||||
	r = tp->tty_incum > 0 ? tp->tty_incum : EAGAIN;
 | 
						r = tp->tty_incum > 0 ? tp->tty_incum : EAGAIN;
 | 
				
			||||||
	tp->tty_inleft = tp->tty_incum = tp->tty_inrevived = 0;
 | 
						tp->tty_inleft = tp->tty_incum = tp->tty_inrevived = 0;
 | 
				
			||||||
  } 
 | 
					  } 
 | 
				
			||||||
  if ((mode & W_BIT) && tp->tty_outleft != 0 && proc_nr == tp->tty_outproc &&
 | 
					  if ((mode & W_BIT) && tp->tty_outleft != 0 && proc_nr == tp->tty_outproc &&
 | 
				
			||||||
	(!tp->tty_out_safe || tp->tty_out_vir_g==(vir_bytes)m_ptr->IO_GRANT)) {
 | 
						tp->tty_outgrant == (cp_grant_id_t) m_ptr->IO_GRANT) {
 | 
				
			||||||
	/* Process was writing when killed.  Clean up output. */
 | 
						/* Process was writing when killed.  Clean up output. */
 | 
				
			||||||
	r = tp->tty_outcum > 0 ? tp->tty_outcum : EAGAIN;
 | 
						r = tp->tty_outcum > 0 ? tp->tty_outcum : EAGAIN;
 | 
				
			||||||
	tp->tty_outleft = tp->tty_outcum = tp->tty_outrevived = 0;
 | 
						tp->tty_outleft = tp->tty_outcum = tp->tty_outrevived = 0;
 | 
				
			||||||
@ -976,18 +913,11 @@ 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. */
 | 
				
			||||||
			if(tp->tty_in_safe) {
 | 
								sys_safecopyto(tp->tty_inproc,
 | 
				
			||||||
				sys_safecopyto(tp->tty_inproc,
 | 
									tp->tty_ingrant, tp->tty_inoffset,
 | 
				
			||||||
					tp->tty_in_vir_g, tp->tty_in_vir_offset,
 | 
									(vir_bytes) buf,
 | 
				
			||||||
					(vir_bytes) buf,
 | 
									(vir_bytes) buflen(buf), D);
 | 
				
			||||||
					(vir_bytes) buflen(buf), D);
 | 
								tp->tty_inoffset += buflen(buf);
 | 
				
			||||||
				tp->tty_in_vir_offset += buflen(buf);
 | 
					 | 
				
			||||||
			} else {
 | 
					 | 
				
			||||||
				sys_vircopy(SELF, D, (vir_bytes) buf, 
 | 
					 | 
				
			||||||
					tp->tty_inproc, D, tp->tty_in_vir_g,
 | 
					 | 
				
			||||||
					(vir_bytes) buflen(buf));
 | 
					 | 
				
			||||||
				tp->tty_in_vir_g += buflen(buf);
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			tp->tty_incum += buflen(buf);
 | 
								tp->tty_incum += buflen(buf);
 | 
				
			||||||
			bp = buf;
 | 
								bp = buf;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@ -1007,16 +937,10 @@ 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;
 | 
				
			||||||
	if(tp->tty_in_safe) {
 | 
						sys_safecopyto(tp->tty_inproc,
 | 
				
			||||||
		sys_safecopyto(tp->tty_inproc,
 | 
							tp->tty_ingrant, tp->tty_inoffset,
 | 
				
			||||||
			tp->tty_in_vir_g, tp->tty_in_vir_offset,
 | 
							(vir_bytes) buf, (vir_bytes) count, D);
 | 
				
			||||||
			(vir_bytes) buf, (vir_bytes) count, D);
 | 
						tp->tty_inoffset += count;
 | 
				
			||||||
		tp->tty_in_vir_offset += count;
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
		sys_vircopy(SELF, D, (vir_bytes) buf, 
 | 
					 | 
				
			||||||
			tp->tty_inproc, D, tp->tty_in_vir_g, (vir_bytes) count);
 | 
					 | 
				
			||||||
		tp->tty_in_vir_g += count;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	tp->tty_incum += count;
 | 
						tp->tty_incum += count;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1453,16 +1377,10 @@ 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);
 | 
				
			||||||
	if(tp->tty_io_safe) {
 | 
						result = sys_safecopyfrom(tp->tty_ioproc, tp->tty_iogrant, 0,
 | 
				
			||||||
	   result = sys_safecopyfrom(tp->tty_ioproc, tp->tty_iovir_g, 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);
 | 
				
			||||||
	} else {
 | 
						if (result == OK) setattr(tp);
 | 
				
			||||||
	    result = sys_vircopy(tp->tty_ioproc, D, tp->tty_iovir_g,
 | 
					 | 
				
			||||||
			SELF, D, (vir_bytes) &tp->tty_termios,
 | 
					 | 
				
			||||||
			(vir_bytes) sizeof(tp->tty_termios));
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	setattr(tp);
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  tp->tty_ioreq = 0;
 | 
					  tp->tty_ioreq = 0;
 | 
				
			||||||
  notify(tp->tty_iocaller);
 | 
					  notify(tp->tty_iocaller);
 | 
				
			||||||
 | 
				
			|||||||
@ -66,18 +66,16 @@ typedef struct tty {
 | 
				
			|||||||
  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) */
 | 
					  int tty_incaller;		/* process that made the call (usually FS) */
 | 
				
			||||||
  int tty_inproc;		/* process that wants to read from tty */
 | 
					  int tty_inproc;		/* process that wants to read from tty */
 | 
				
			||||||
  vir_bytes tty_in_vir_g;	/* address or grant where data is to go */
 | 
					  cp_grant_id_t tty_ingrant;	/* grant where data is to go */
 | 
				
			||||||
  vir_bytes tty_in_vir_offset;	/* offset into grant */
 | 
					  vir_bytes tty_inoffset;	/* offset into grant */
 | 
				
			||||||
  int tty_in_safe;		/* nonzero: safecopies (in_vir is grantid) */
 | 
					 | 
				
			||||||
  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) */
 | 
					  int tty_outcaller;		/* process that made the call (usually FS) */
 | 
				
			||||||
  int tty_outproc;		/* process that wants to write to tty */
 | 
					  int tty_outproc;		/* process that wants to write to tty */
 | 
				
			||||||
  vir_bytes tty_out_vir_g;	/* address or grant where data comes from */
 | 
					  cp_grant_id_t tty_outgrant;	/* grant where data comes from */
 | 
				
			||||||
  vir_bytes tty_out_vir_offset;	/* offset into grant */
 | 
					  vir_bytes tty_outoffset;	/* offset into grant */
 | 
				
			||||||
  int tty_out_safe;		/* nonzero: safecopies (out_vir is grantid) */
 | 
					 | 
				
			||||||
  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) */
 | 
					  int tty_iocaller;		/* process that made the call (usually FS) */
 | 
				
			||||||
@ -85,8 +83,7 @@ typedef struct tty {
 | 
				
			|||||||
  int tty_ioproc;		/* process that wants to do an ioctl */
 | 
					  int 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 */
 | 
				
			||||||
  int tty_io_safe;		/* safe copy mode? (iovir is grant id) */
 | 
					  cp_grant_id_t tty_iogrant;	/* virtual address of ioctl buffer or grant */
 | 
				
			||||||
  vir_bytes tty_iovir_g;	/* 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 */
 | 
				
			||||||
@ -163,9 +160,6 @@ _PROTOTYPE( void rs_interrupt, (message *m)				);
 | 
				
			|||||||
_PROTOTYPE( void kputc, (int c)						);
 | 
					_PROTOTYPE( void kputc, (int c)						);
 | 
				
			||||||
_PROTOTYPE( void cons_stop, (void)					);
 | 
					_PROTOTYPE( void cons_stop, (void)					);
 | 
				
			||||||
_PROTOTYPE( void do_new_kmess, (void)					);
 | 
					_PROTOTYPE( void do_new_kmess, (void)					);
 | 
				
			||||||
_PROTOTYPE( void do_diagnostics, (message *m, int safe)			);
 | 
					 | 
				
			||||||
_PROTOTYPE( void do_get_kmess, (message *m)				);
 | 
					 | 
				
			||||||
_PROTOTYPE( void do_get_kmess_s, (message *m)				);
 | 
					 | 
				
			||||||
_PROTOTYPE( void scr_init, (struct tty *tp)				);
 | 
					_PROTOTYPE( void scr_init, (struct tty *tp)				);
 | 
				
			||||||
_PROTOTYPE( void toggle_scroll, (void)					);
 | 
					_PROTOTYPE( void toggle_scroll, (void)					);
 | 
				
			||||||
_PROTOTYPE( int con_loadfont, (message *m)				);
 | 
					_PROTOTYPE( int con_loadfont, (message *m)				);
 | 
				
			||||||
@ -176,7 +170,7 @@ _PROTOTYPE( void do_video, (message *m)					);
 | 
				
			|||||||
/* keyboard.c */
 | 
					/* keyboard.c */
 | 
				
			||||||
_PROTOTYPE( void kb_init, (struct tty *tp)				);
 | 
					_PROTOTYPE( void kb_init, (struct tty *tp)				);
 | 
				
			||||||
_PROTOTYPE( void kb_init_once, (void)					);
 | 
					_PROTOTYPE( void kb_init_once, (void)					);
 | 
				
			||||||
_PROTOTYPE( int kbd_loadmap, (message *m, int safe)			);
 | 
					_PROTOTYPE( int kbd_loadmap, (message *m)				);
 | 
				
			||||||
_PROTOTYPE( void do_fkey_ctl, (message *m)				);
 | 
					_PROTOTYPE( void do_fkey_ctl, (message *m)				);
 | 
				
			||||||
_PROTOTYPE( void kbd_interrupt, (message *m)				);
 | 
					_PROTOTYPE( void kbd_interrupt, (message *m)				);
 | 
				
			||||||
_PROTOTYPE( void do_kbd, (message *m)					);
 | 
					_PROTOTYPE( void do_kbd, (message *m)					);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user