Index: trunk/minix/drivers/tty/.depend
===================================================================
--- trunk/minix/drivers/tty/.depend	(revision 9)
+++ 	(revision )
@@ -1,214 +1,0 @@
-
-console.o:	../../kernel/config.h
-console.o:	../../kernel/const.h
-console.o:	../../kernel/type.h
-console.o:	../drivers.h
-console.o:	/usr/include/ansi.h
-console.o:	/usr/include/errno.h
-console.o:	/usr/include/ibm/bios.h
-console.o:	/usr/include/ibm/cpu.h
-console.o:	/usr/include/ibm/interrupt.h
-console.o:	/usr/include/ibm/ports.h
-console.o:	/usr/include/limits.h
-console.o:	/usr/include/minix/bitmap.h
-console.o:	/usr/include/minix/callnr.h
-console.o:	/usr/include/minix/com.h
-console.o:	/usr/include/minix/config.h
-console.o:	/usr/include/minix/const.h
-console.o:	/usr/include/minix/devio.h
-console.o:	/usr/include/minix/dmap.h
-console.o:	/usr/include/minix/ioctl.h
-console.o:	/usr/include/minix/ipc.h
-console.o:	/usr/include/minix/sys_config.h
-console.o:	/usr/include/minix/syslib.h
-console.o:	/usr/include/minix/sysutil.h
-console.o:	/usr/include/minix/type.h
-console.o:	/usr/include/net/ioctl.h
-console.o:	/usr/include/signal.h
-console.o:	/usr/include/stddef.h
-console.o:	/usr/include/stdlib.h
-console.o:	/usr/include/string.h
-console.o:	/usr/include/sys/dir.h
-console.o:	/usr/include/sys/ioc_cmos.h
-console.o:	/usr/include/sys/ioc_disk.h
-console.o:	/usr/include/sys/ioc_file.h
-console.o:	/usr/include/sys/ioc_memory.h
-console.o:	/usr/include/sys/ioc_scsi.h
-console.o:	/usr/include/sys/ioc_sound.h
-console.o:	/usr/include/sys/ioc_tape.h
-console.o:	/usr/include/sys/ioc_tty.h
-console.o:	/usr/include/sys/ioctl.h
-console.o:	/usr/include/sys/types.h
-console.o:	/usr/include/sys/vm.h
-console.o:	/usr/include/termios.h
-console.o:	/usr/include/timers.h
-console.o:	/usr/include/unistd.h
-console.o:	console.c
-console.o:	tty.h
-
-keyboard.o:	../../kernel/config.h
-keyboard.o:	../../kernel/const.h
-keyboard.o:	../../kernel/priv.h
-keyboard.o:	../../kernel/proc.h
-keyboard.o:	../../kernel/protect.h
-keyboard.o:	../../kernel/type.h
-keyboard.o:	../drivers.h
-keyboard.o:	/usr/include/ansi.h
-keyboard.o:	/usr/include/errno.h
-keyboard.o:	/usr/include/ibm/bios.h
-keyboard.o:	/usr/include/ibm/cpu.h
-keyboard.o:	/usr/include/ibm/interrupt.h
-keyboard.o:	/usr/include/ibm/ports.h
-keyboard.o:	/usr/include/limits.h
-keyboard.o:	/usr/include/minix/bitmap.h
-keyboard.o:	/usr/include/minix/callnr.h
-keyboard.o:	/usr/include/minix/com.h
-keyboard.o:	/usr/include/minix/config.h
-keyboard.o:	/usr/include/minix/const.h
-keyboard.o:	/usr/include/minix/devio.h
-keyboard.o:	/usr/include/minix/dmap.h
-keyboard.o:	/usr/include/minix/ioctl.h
-keyboard.o:	/usr/include/minix/ipc.h
-keyboard.o:	/usr/include/minix/keymap.h
-keyboard.o:	/usr/include/minix/sys_config.h
-keyboard.o:	/usr/include/minix/syslib.h
-keyboard.o:	/usr/include/minix/sysutil.h
-keyboard.o:	/usr/include/minix/type.h
-keyboard.o:	/usr/include/net/ioctl.h
-keyboard.o:	/usr/include/signal.h
-keyboard.o:	/usr/include/stddef.h
-keyboard.o:	/usr/include/stdlib.h
-keyboard.o:	/usr/include/string.h
-keyboard.o:	/usr/include/sys/dir.h
-keyboard.o:	/usr/include/sys/ioc_cmos.h
-keyboard.o:	/usr/include/sys/ioc_disk.h
-keyboard.o:	/usr/include/sys/ioc_file.h
-keyboard.o:	/usr/include/sys/ioc_memory.h
-keyboard.o:	/usr/include/sys/ioc_scsi.h
-keyboard.o:	/usr/include/sys/ioc_sound.h
-keyboard.o:	/usr/include/sys/ioc_tape.h
-keyboard.o:	/usr/include/sys/ioc_tty.h
-keyboard.o:	/usr/include/sys/ioctl.h
-keyboard.o:	/usr/include/sys/kbdio.h
-keyboard.o:	/usr/include/sys/select.h
-keyboard.o:	/usr/include/sys/time.h
-keyboard.o:	/usr/include/sys/types.h
-keyboard.o:	/usr/include/termios.h
-keyboard.o:	/usr/include/timers.h
-keyboard.o:	/usr/include/unistd.h
-keyboard.o:	keyboard.c
-keyboard.o:	keymaps/us-std.src
-keyboard.o:	tty.h
-
-pty.o:	../../kernel/config.h
-pty.o:	../../kernel/const.h
-pty.o:	../../kernel/type.h
-pty.o:	../drivers.h
-pty.o:	/usr/include/ansi.h
-pty.o:	/usr/include/assert.h
-pty.o:	/usr/include/errno.h
-pty.o:	/usr/include/ibm/bios.h
-pty.o:	/usr/include/ibm/cpu.h
-pty.o:	/usr/include/ibm/interrupt.h
-pty.o:	/usr/include/ibm/ports.h
-pty.o:	/usr/include/limits.h
-pty.o:	/usr/include/minix/bitmap.h
-pty.o:	/usr/include/minix/callnr.h
-pty.o:	/usr/include/minix/com.h
-pty.o:	/usr/include/minix/config.h
-pty.o:	/usr/include/minix/const.h
-pty.o:	/usr/include/minix/devio.h
-pty.o:	/usr/include/minix/dmap.h
-pty.o:	/usr/include/minix/ipc.h
-pty.o:	/usr/include/minix/sys_config.h
-pty.o:	/usr/include/minix/syslib.h
-pty.o:	/usr/include/minix/sysutil.h
-pty.o:	/usr/include/minix/type.h
-pty.o:	/usr/include/signal.h
-pty.o:	/usr/include/stddef.h
-pty.o:	/usr/include/stdlib.h
-pty.o:	/usr/include/string.h
-pty.o:	/usr/include/sys/dir.h
-pty.o:	/usr/include/sys/select.h
-pty.o:	/usr/include/sys/time.h
-pty.o:	/usr/include/sys/types.h
-pty.o:	/usr/include/termios.h
-pty.o:	/usr/include/timers.h
-pty.o:	/usr/include/unistd.h
-pty.o:	pty.c
-pty.o:	tty.h
-
-rs232.o:	../../kernel/config.h
-rs232.o:	../../kernel/const.h
-rs232.o:	../../kernel/type.h
-rs232.o:	../drivers.h
-rs232.o:	/usr/include/ansi.h
-rs232.o:	/usr/include/errno.h
-rs232.o:	/usr/include/ibm/bios.h
-rs232.o:	/usr/include/ibm/cpu.h
-rs232.o:	/usr/include/ibm/interrupt.h
-rs232.o:	/usr/include/ibm/ports.h
-rs232.o:	/usr/include/limits.h
-rs232.o:	/usr/include/minix/bitmap.h
-rs232.o:	/usr/include/minix/callnr.h
-rs232.o:	/usr/include/minix/com.h
-rs232.o:	/usr/include/minix/config.h
-rs232.o:	/usr/include/minix/const.h
-rs232.o:	/usr/include/minix/devio.h
-rs232.o:	/usr/include/minix/dmap.h
-rs232.o:	/usr/include/minix/ipc.h
-rs232.o:	/usr/include/minix/sys_config.h
-rs232.o:	/usr/include/minix/syslib.h
-rs232.o:	/usr/include/minix/sysutil.h
-rs232.o:	/usr/include/minix/type.h
-rs232.o:	/usr/include/signal.h
-rs232.o:	/usr/include/stddef.h
-rs232.o:	/usr/include/stdlib.h
-rs232.o:	/usr/include/string.h
-rs232.o:	/usr/include/sys/dir.h
-rs232.o:	/usr/include/sys/types.h
-rs232.o:	/usr/include/termios.h
-rs232.o:	/usr/include/timers.h
-rs232.o:	/usr/include/unistd.h
-rs232.o:	rs232.c
-rs232.o:	tty.h
-
-tty.o:	../../kernel/config.h
-tty.o:	../../kernel/const.h
-tty.o:	../../kernel/type.h
-tty.o:	../drivers.h
-tty.o:	/usr/include/ansi.h
-tty.o:	/usr/include/errno.h
-tty.o:	/usr/include/ibm/bios.h
-tty.o:	/usr/include/ibm/cpu.h
-tty.o:	/usr/include/ibm/interrupt.h
-tty.o:	/usr/include/ibm/ports.h
-tty.o:	/usr/include/limits.h
-tty.o:	/usr/include/minix/bitmap.h
-tty.o:	/usr/include/minix/callnr.h
-tty.o:	/usr/include/minix/com.h
-tty.o:	/usr/include/minix/config.h
-tty.o:	/usr/include/minix/const.h
-tty.o:	/usr/include/minix/devio.h
-tty.o:	/usr/include/minix/dmap.h
-tty.o:	/usr/include/minix/ioctl.h
-tty.o:	/usr/include/minix/ipc.h
-tty.o:	/usr/include/minix/keymap.h
-tty.o:	/usr/include/minix/sys_config.h
-tty.o:	/usr/include/minix/syslib.h
-tty.o:	/usr/include/minix/sysutil.h
-tty.o:	/usr/include/minix/type.h
-tty.o:	/usr/include/signal.h
-tty.o:	/usr/include/stddef.h
-tty.o:	/usr/include/stdlib.h
-tty.o:	/usr/include/string.h
-tty.o:	/usr/include/sys/dir.h
-tty.o:	/usr/include/sys/ioc_tty.h
-tty.o:	/usr/include/sys/select.h
-tty.o:	/usr/include/sys/time.h
-tty.o:	/usr/include/sys/types.h
-tty.o:	/usr/include/termios.h
-tty.o:	/usr/include/timers.h
-tty.o:	/usr/include/unistd.h
-tty.o:	tty.c
-tty.o:	tty.h
Index: trunk/minix/drivers/tty/Makefile
===================================================================
--- trunk/minix/drivers/tty/Makefile	(revision 9)
+++ 	(revision )
@@ -1,45 +1,0 @@
-# Makefile for terminal driver (TTY)
-DRIVER = tty
-
-# directories
-u = /usr
-i = $u/include
-s = $i/sys
-m = $i/minix
-b = $i/ibm
-d = ..
-
-# programs, flags, etc.
-MAKE = exec make
-CC =	exec cc
-CFLAGS = -I$i
-LDFLAGS = -i
-LIBS = -lsys -lsysutil -ltimers
-
-OBJ = tty.o console.o vidcopy.o keyboard.o pty.o rs232.o 
-
-# build local binary 
-all build:	$(DRIVER)
-$(DRIVER):	$(OBJ) 
-	$(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBS)
-	install -S 256w $(DRIVER)
-
-# install with other drivers
-install:	
-	cd keymaps && $(MAKE) -$(MAKEFLAGS) install
-
-#/sbin/$(DRIVER):	$(DRIVER)
-#	install -o root -cs $? $@
-
-# clean up local files
-clean:
-	cd keymaps && $(MAKE) -$(MAKEFLAGS) $@
-	rm -f $(DRIVER) *.o *.bak 
-
-depend: 
-	/usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c > .depend
-
-# Include generated dependencies.
-include .depend
-
-
Index: trunk/minix/drivers/tty/console.c
===================================================================
--- trunk/minix/drivers/tty/console.c	(revision 9)
+++ 	(revision )
@@ -1,1271 +1,0 @@
-/* Code and data for the IBM console driver.
- *
- * The 6845 video controller used by the IBM PC shares its video memory with
- * the CPU somewhere in the 0xB0000 memory bank.  To the 6845 this memory
- * consists of 16-bit words.  Each word has a character code in the low byte
- * and a so-called attribute byte in the high byte.  The CPU directly modifies
- * video memory to display characters, and sets two registers on the 6845 that
- * specify the video origin and the cursor position.  The video origin is the
- * place in video memory where the first character (upper left corner) can
- * be found.  Moving the origin is a fast way to scroll the screen.  Some
- * video adapters wrap around the top of video memory, so the origin can
- * move without bounds.  For other adapters screen memory must sometimes be
- * moved to reset the origin.  All computations on video memory use character
- * (word) addresses for simplicity and assume there is no wrapping.  The
- * assembly support functions translate the word addresses to byte addresses
- * and the scrolling function worries about wrapping.
- */
-
-#include "../drivers.h"
-#include <termios.h>
-#include <sys/ioctl.h>
-#include <sys/vm.h>
-#include <minix/callnr.h>
-#include <minix/com.h>
-#include "tty.h"
-
-#include "../../kernel/const.h"
-#include "../../kernel/config.h"
-#include "../../kernel/type.h"
-
-/* Definitions used by the console driver. */
-#define MONO_BASE    0xB0000L	/* base of mono video memory */
-#define COLOR_BASE   0xB8000L	/* base of color video memory */
-#define MONO_SIZE     0x1000	/* 4K mono video memory */
-#define COLOR_SIZE    0x4000	/* 16K color video memory */
-#define EGA_SIZE      0x8000	/* EGA & VGA have at least 32K */
-#define BLANK_COLOR   0x0700	/* determines cursor color on blank screen */
-#define SCROLL_UP          0	/* scroll forward */
-#define SCROLL_DOWN        1	/* scroll backward */
-#define BLANK_MEM ((u16_t *) 0)	/* tells mem_vid_copy() to blank the screen */
-#define CONS_RAM_WORDS    80	/* video ram buffer size */
-#define MAX_ESC_PARMS      4	/* number of escape sequence params allowed */
-
-/* Constants relating to the controller chips. */
-#define M_6845         0x3B4	/* port for 6845 mono */
-#define C_6845         0x3D4	/* port for 6845 color */
-#define INDEX              0	/* 6845's index register */
-#define DATA               1	/* 6845's data register */
-#define STATUS             6	/* 6845's status register */
-#define VID_ORG           12	/* 6845's origin register */
-#define CURSOR            14	/* 6845's cursor register */
-
-/* The clock task should provide an interface for this */
-#define TIMER_FREQ  1193182L    /* clock frequency for timer in PC and AT */
-
-/* Beeper. */
-#define BEEP_FREQ     0x0533	/* value to put into timer to set beep freq */
-#define B_TIME		   3	/* length of CTRL-G beep is ticks */
-
-/* definitions used for font management */
-#define GA_SEQUENCER_INDEX	0x3C4
-#define GA_SEQUENCER_DATA	0x3C5
-#define GA_GRAPHICS_INDEX	0x3CE
-#define GA_GRAPHICS_DATA	0x3CF
-#define GA_VIDEO_ADDRESS	0xA0000L
-#define GA_FONT_SIZE		8192
-
-/* Global variables used by the console driver and assembly support. */
-PUBLIC int vid_index;		/* index of video segment in remote mem map */
-PUBLIC u16_t vid_seg;
-PUBLIC vir_bytes vid_off;	/* video ram is found at vid_seg:vid_off */
-PUBLIC unsigned vid_size;	/* 0x2000 for color or 0x0800 for mono */
-PUBLIC unsigned vid_mask;	/* 0x1FFF for color or 0x07FF for mono */
-PUBLIC unsigned blank_color = BLANK_COLOR; /* display code for blank */
-
-/* Private variables used by the console driver. */
-PRIVATE int vid_port;		/* I/O port for accessing 6845 */
-PRIVATE int wrap;		/* hardware can wrap? */
-PRIVATE int softscroll;		/* 1 = software scrolling, 0 = hardware */
-PRIVATE int beeping;		/* speaker is beeping? */
-PRIVATE unsigned font_lines;	/* font lines per character */
-PRIVATE unsigned scr_width;	/* # characters on a line */
-PRIVATE unsigned scr_lines;	/* # lines on the screen */
-PRIVATE unsigned scr_size;	/* # characters on the screen */
-
-/* Per console data. */
-typedef struct console {
-  tty_t *c_tty;			/* associated TTY struct */
-  int c_column;			/* current column number (0-origin) */
-  int c_row;			/* current row (0 at top of screen) */
-  int c_rwords;			/* number of WORDS (not bytes) in outqueue */
-  unsigned c_start;		/* start of video memory of this console */
-  unsigned c_limit;		/* limit of this console's video memory */
-  unsigned c_org;		/* location in RAM where 6845 base points */
-  unsigned c_cur;		/* current position of cursor in video RAM */
-  unsigned c_attr;		/* character attribute */
-  unsigned c_blank;		/* blank attribute */
-  char c_reverse;		/* reverse video */
-  char c_esc_state;		/* 0=normal, 1=ESC, 2=ESC[ */
-  char c_esc_intro;		/* Distinguishing character following ESC */
-  int *c_esc_parmp;		/* pointer to current escape parameter */
-  int c_esc_parmv[MAX_ESC_PARMS];	/* list of escape parameters */
-  u16_t c_ramqueue[CONS_RAM_WORDS];	/* buffer for video RAM */
-} console_t;
-
-PRIVATE int nr_cons= 1;		/* actual number of consoles */
-PRIVATE console_t cons_table[NR_CONS];
-PRIVATE console_t *curcons;	/* currently visible */
-
-/* Color if using a color controller. */
-#define color	(vid_port == C_6845)
-
-/* Map from ANSI colors to the attributes used by the PC */
-PRIVATE int ansi_colors[8] = {0, 4, 2, 6, 1, 5, 3, 7};
-
-/* Structure used for font management */
-struct sequence {
-	unsigned short index;
-	unsigned char port;
-	unsigned char value;
-};
-
-FORWARD _PROTOTYPE( int cons_write, (struct tty *tp, int try)		);
-FORWARD _PROTOTYPE( void cons_echo, (tty_t *tp, int c)			);
-FORWARD _PROTOTYPE( void out_char, (console_t *cons, int c)		);
-FORWARD _PROTOTYPE( void cons_putk, (int c)				);
-FORWARD _PROTOTYPE( void beep, (void)					);
-FORWARD _PROTOTYPE( void do_escape, (console_t *cons, int c)		);
-FORWARD _PROTOTYPE( void flush, (console_t *cons)			);
-FORWARD _PROTOTYPE( void parse_escape, (console_t *cons, int c)		);
-FORWARD _PROTOTYPE( void scroll_screen, (console_t *cons, int dir)	);
-FORWARD _PROTOTYPE( void set_6845, (int reg, unsigned val)		);
-FORWARD _PROTOTYPE( void get_6845, (int reg, unsigned *val)		);
-FORWARD _PROTOTYPE( void stop_beep, (timer_t *tmrp)			);
-FORWARD _PROTOTYPE( void cons_org0, (void)				);
-FORWARD _PROTOTYPE( int ga_program, (struct sequence *seq)		);
-FORWARD _PROTOTYPE( int cons_ioctl, (tty_t *tp, int)			);
-PRIVATE _PROTOTYPE( void ser_putc, (char c)				);
-
-/*===========================================================================*
- *				cons_write				     *
- *===========================================================================*/
-PRIVATE int cons_write(tp, try)
-register struct tty *tp;	/* tells which terminal is to be used */
-int try;
-{
-/* Copy as much data as possible to the output queue, then start I/O.  On
- * memory-mapped terminals, such as the IBM console, the I/O will also be
- * finished, and the counts updated.  Keep repeating until all I/O done.
- */
-
-  int count;
-  int result;
-  register char *tbuf;
-  char buf[64];
-  console_t *cons = tp->tty_priv;
-
-  if (try) return 1;	/* we can always write to console */
-
-  /* Check quickly for nothing to do, so this can be called often without
-   * unmodular tests elsewhere.
-   */
-  if ((count = tp->tty_outleft) == 0 || tp->tty_inhibited) return;
-
-  /* Copy the user bytes to buf[] for decent addressing. Loop over the
-   * copies, since the user buffer may be much larger than buf[].
-   */
-  do {
-	if (count > sizeof(buf)) count = sizeof(buf);
-	if ((result = sys_vircopy(tp->tty_outproc, D, tp->tty_out_vir, 
-			SELF, D, (vir_bytes) buf, (vir_bytes) count)) != OK)
-		break;
-	tbuf = buf;
-
-	/* Update terminal data structure. */
-	tp->tty_out_vir += count;
-	tp->tty_outcum += count;
-	tp->tty_outleft -= count;
-
-	/* Output each byte of the copy to the screen.  Avoid calling
-	 * out_char() for the "easy" characters, put them into the buffer
-	 * directly.
-	 */
-	do {
-		if ((unsigned) *tbuf < ' ' || cons->c_esc_state > 0
-			|| cons->c_column >= scr_width
-			|| cons->c_rwords >= buflen(cons->c_ramqueue))
-		{
-			out_char(cons, *tbuf++);
-		} else {
-			cons->c_ramqueue[cons->c_rwords++] =
-					cons->c_attr | (*tbuf++ & BYTE);
-			cons->c_column++;
-		}
-	} while (--count != 0);
-  } while ((count = tp->tty_outleft) != 0 && !tp->tty_inhibited);
-
-  flush(cons);			/* transfer anything buffered to the screen */
-
-  /* Reply to the writer if all output is finished or if an error occured. */
-  if (tp->tty_outleft == 0 || result != OK) {
-	/* REVIVE is not possible. I/O on memory mapped consoles finishes. */
-	tty_reply(tp->tty_outrepcode, tp->tty_outcaller, tp->tty_outproc,
-							tp->tty_outcum);
-	tp->tty_outcum = 0;
-  }
-}
-
-/*===========================================================================*
- *				cons_echo				     *
- *===========================================================================*/
-PRIVATE void cons_echo(tp, c)
-register tty_t *tp;		/* pointer to tty struct */
-int c;				/* character to be echoed */
-{
-/* Echo keyboard input (print & flush). */
-  console_t *cons = tp->tty_priv;
-
-  out_char(cons, c);
-  flush(cons);
-}
-
-/*===========================================================================*
- *				out_char				     *
- *===========================================================================*/
-PRIVATE void out_char(cons, c)
-register console_t *cons;	/* pointer to console struct */
-int c;				/* character to be output */
-{
-/* Output a character on the console.  Check for escape sequences first. */
-  if (cons->c_esc_state > 0) {
-	parse_escape(cons, c);
-	return;
-  }
-
-  switch(c) {
-	case 000:		/* null is typically used for padding */
-		return;		/* better not do anything */
-
-	case 007:		/* ring the bell */
-		flush(cons);	/* print any chars queued for output */
-		beep();
-		return;
-
-	case '\b':		/* backspace */
-		if (--cons->c_column < 0) {
-			if (--cons->c_row >= 0) cons->c_column += scr_width;
-		}
-		flush(cons);
-		return;
-
-	case '\n':		/* line feed */
-		if ((cons->c_tty->tty_termios.c_oflag & (OPOST|ONLCR))
-						== (OPOST|ONLCR)) {
-			cons->c_column = 0;
-		}
-		/*FALL THROUGH*/
-	case 013:		/* CTRL-K */
-	case 014:		/* CTRL-L */
-		if (cons->c_row == scr_lines-1) {
-			scroll_screen(cons, SCROLL_UP);
-		} else {
-			cons->c_row++;
-		}
-		flush(cons);
-		return;
-
-	case '\r':		/* carriage return */
-		cons->c_column = 0;
-		flush(cons);
-		return;
-
-	case '\t':		/* tab */
-		cons->c_column = (cons->c_column + TAB_SIZE) & ~TAB_MASK;
-		if (cons->c_column > scr_width) {
-			cons->c_column -= scr_width;
-			if (cons->c_row == scr_lines-1) {
-				scroll_screen(cons, SCROLL_UP);
-			} else {
-				cons->c_row++;
-			}
-		}
-		flush(cons);
-		return;
-
-	case 033:		/* ESC - start of an escape sequence */
-		flush(cons);	/* print any chars queued for output */
-		cons->c_esc_state = 1;	/* mark ESC as seen */
-		return;
-
-	default:		/* printable chars are stored in ramqueue */
-		if (cons->c_column >= scr_width) {
-			if (!LINEWRAP) return;
-			if (cons->c_row == scr_lines-1) {
-				scroll_screen(cons, SCROLL_UP);
-			} else {
-				cons->c_row++;
-			}
-			cons->c_column = 0;
-			flush(cons);
-		}
-		if (cons->c_rwords == buflen(cons->c_ramqueue)) flush(cons);
-		cons->c_ramqueue[cons->c_rwords++] = cons->c_attr | (c & BYTE);
-		cons->c_column++;			/* next column */
-		return;
-  }
-}
-
-/*===========================================================================*
- *				scroll_screen				     *
- *===========================================================================*/
-PRIVATE void scroll_screen(cons, dir)
-register console_t *cons;	/* pointer to console struct */
-int dir;			/* SCROLL_UP or SCROLL_DOWN */
-{
-  unsigned new_line, new_org, chars;
-
-  flush(cons);
-  chars = scr_size - scr_width;		/* one screen minus one line */
-
-  /* Scrolling the screen is a real nuisance due to the various incompatible
-   * video cards.  This driver supports software scrolling (Hercules?),
-   * hardware scrolling (mono and CGA cards) and hardware scrolling without
-   * wrapping (EGA cards).  In the latter case we must make sure that
-   *		c_start <= c_org && c_org + scr_size <= c_limit
-   * holds, because EGA doesn't wrap around the end of video memory.
-   */
-  if (dir == SCROLL_UP) {
-	/* Scroll one line up in 3 ways: soft, avoid wrap, use origin. */
-	if (softscroll) {
-		vid_vid_copy(cons->c_start + scr_width, cons->c_start, chars);
-	} else
-	if (!wrap && cons->c_org + scr_size + scr_width >= cons->c_limit) {
-		vid_vid_copy(cons->c_org + scr_width, cons->c_start, chars);
-		cons->c_org = cons->c_start;
-	} else {
-		cons->c_org = (cons->c_org + scr_width) & vid_mask;
-	}
-	new_line = (cons->c_org + chars) & vid_mask;
-  } else {
-	/* Scroll one line down in 3 ways: soft, avoid wrap, use origin. */
-	if (softscroll) {
-		vid_vid_copy(cons->c_start, cons->c_start + scr_width, chars);
-	} else
-	if (!wrap && cons->c_org < cons->c_start + scr_width) {
-		new_org = cons->c_limit - scr_size;
-		vid_vid_copy(cons->c_org, new_org + scr_width, chars);
-		cons->c_org = new_org;
-	} else {
-		cons->c_org = (cons->c_org - scr_width) & vid_mask;
-	}
-	new_line = cons->c_org;
-  }
-  /* Blank the new line at top or bottom. */
-  blank_color = cons->c_blank;
-  mem_vid_copy(BLANK_MEM, new_line, scr_width);
-
-  /* Set the new video origin. */
-  if (cons == curcons) set_6845(VID_ORG, cons->c_org);
-  flush(cons);
-}
-
-/*===========================================================================*
- *				flush					     *
- *===========================================================================*/
-PRIVATE void flush(cons)
-register console_t *cons;	/* pointer to console struct */
-{
-/* Send characters buffered in 'ramqueue' to screen memory, check the new
- * cursor position, compute the new hardware cursor position and set it.
- */
-  unsigned cur;
-  tty_t *tp = cons->c_tty;
-
-  /* Have the characters in 'ramqueue' transferred to the screen. */
-  if (cons->c_rwords > 0) {
-	mem_vid_copy(cons->c_ramqueue, cons->c_cur, cons->c_rwords);
-	cons->c_rwords = 0;
-
-	/* TTY likes to know the current column and if echoing messed up. */
-	tp->tty_position = cons->c_column;
-	tp->tty_reprint = TRUE;
-  }
-
-  /* Check and update the cursor position. */
-  if (cons->c_column < 0) cons->c_column = 0;
-  if (cons->c_column > scr_width) cons->c_column = scr_width;
-  if (cons->c_row < 0) cons->c_row = 0;
-  if (cons->c_row >= scr_lines) cons->c_row = scr_lines - 1;
-  cur = cons->c_org + cons->c_row * scr_width + cons->c_column;
-  if (cur != cons->c_cur) {
-	if (cons == curcons) set_6845(CURSOR, cur);
-	cons->c_cur = cur;
-  }
-}
-
-/*===========================================================================*
- *				parse_escape				     *
- *===========================================================================*/
-PRIVATE void parse_escape(cons, c)
-register console_t *cons;	/* pointer to console struct */
-char c;				/* next character in escape sequence */
-{
-/* The following ANSI escape sequences are currently supported.
- * If n and/or m are omitted, they default to 1.
- *   ESC [nA moves up n lines
- *   ESC [nB moves down n lines
- *   ESC [nC moves right n spaces
- *   ESC [nD moves left n spaces
- *   ESC [m;nH" moves cursor to (m,n)
- *   ESC [J clears screen from cursor
- *   ESC [K clears line from cursor
- *   ESC [nL inserts n lines ar cursor
- *   ESC [nM deletes n lines at cursor
- *   ESC [nP deletes n chars at cursor
- *   ESC [n@ inserts n chars at cursor
- *   ESC [nm enables rendition n (0=normal, 4=bold, 5=blinking, 7=reverse)
- *   ESC M scrolls the screen backwards if the cursor is on the top line
- */
-
-  switch (cons->c_esc_state) {
-    case 1:			/* ESC seen */
-	cons->c_esc_intro = '\0';
-	cons->c_esc_parmp = bufend(cons->c_esc_parmv);
-	do {
-		*--cons->c_esc_parmp = 0;
-	} while (cons->c_esc_parmp > cons->c_esc_parmv);
-	switch (c) {
-	    case '[':	/* Control Sequence Introducer */
-		cons->c_esc_intro = c;
-		cons->c_esc_state = 2;
-		break;
-	    case 'M':	/* Reverse Index */
-		do_escape(cons, c);
-		break;
-	    default:
-		cons->c_esc_state = 0;
-	}
-	break;
-
-    case 2:			/* ESC [ seen */
-	if (c >= '0' && c <= '9') {
-		if (cons->c_esc_parmp < bufend(cons->c_esc_parmv))
-			*cons->c_esc_parmp = *cons->c_esc_parmp * 10 + (c-'0');
-	} else
-	if (c == ';') {
-		if (cons->c_esc_parmp < bufend(cons->c_esc_parmv))
-			cons->c_esc_parmp++;
-	} else {
-		do_escape(cons, c);
-	}
-	break;
-  }
-}
-
-/*===========================================================================*
- *				do_escape				     *
- *===========================================================================*/
-PRIVATE void do_escape(cons, c)
-register console_t *cons;	/* pointer to console struct */
-char c;				/* next character in escape sequence */
-{
-  int value, n;
-  unsigned src, dst, count;
-  int *parmp;
-
-  /* Some of these things hack on screen RAM, so it had better be up to date */
-  flush(cons);
-
-  if (cons->c_esc_intro == '\0') {
-	/* Handle a sequence beginning with just ESC */
-	switch (c) {
-	    case 'M':		/* Reverse Index */
-		if (cons->c_row == 0) {
-			scroll_screen(cons, SCROLL_DOWN);
-		} else {
-			cons->c_row--;
-		}
-		flush(cons);
-		break;
-
-	    default: break;
-	}
-  } else
-  if (cons->c_esc_intro == '[') {
-	/* Handle a sequence beginning with ESC [ and parameters */
-	value = cons->c_esc_parmv[0];
-	switch (c) {
-	    case 'A':		/* ESC [nA moves up n lines */
-		n = (value == 0 ? 1 : value);
-		cons->c_row -= n;
-		flush(cons);
-		break;
-
-	    case 'B':		/* ESC [nB moves down n lines */
-		n = (value == 0 ? 1 : value);
-		cons->c_row += n;
-		flush(cons);
-		break;
-
-	    case 'C':		/* ESC [nC moves right n spaces */
-		n = (value == 0 ? 1 : value);
-		cons->c_column += n;
-		flush(cons);
-		break;
-
-	    case 'D':		/* ESC [nD moves left n spaces */
-		n = (value == 0 ? 1 : value);
-		cons->c_column -= n;
-		flush(cons);
-		break;
-
-	    case 'H':		/* ESC [m;nH" moves cursor to (m,n) */
-		cons->c_row = cons->c_esc_parmv[0] - 1;
-		cons->c_column = cons->c_esc_parmv[1] - 1;
-		flush(cons);
-		break;
-
-	    case 'J':		/* ESC [sJ clears in display */
-		switch (value) {
-		    case 0:	/* Clear from cursor to end of screen */
-			count = scr_size - (cons->c_cur - cons->c_org);
-			dst = cons->c_cur;
-			break;
-		    case 1:	/* Clear from start of screen to cursor */
-			count = cons->c_cur - cons->c_org;
-			dst = cons->c_org;
-			break;
-		    case 2:	/* Clear entire screen */
-			count = scr_size;
-			dst = cons->c_org;
-			break;
-		    default:	/* Do nothing */
-			count = 0;
-			dst = cons->c_org;
-		}
-		blank_color = cons->c_blank;
-		mem_vid_copy(BLANK_MEM, dst, count);
-		break;
-
-	    case 'K':		/* ESC [sK clears line from cursor */
-		switch (value) {
-		    case 0:	/* Clear from cursor to end of line */
-			count = scr_width - cons->c_column;
-			dst = cons->c_cur;
-			break;
-		    case 1:	/* Clear from beginning of line to cursor */
-			count = cons->c_column;
-			dst = cons->c_cur - cons->c_column;
-			break;
-		    case 2:	/* Clear entire line */
-			count = scr_width;
-			dst = cons->c_cur - cons->c_column;
-			break;
-		    default:	/* Do nothing */
-			count = 0;
-			dst = cons->c_cur;
-		}
-		blank_color = cons->c_blank;
-		mem_vid_copy(BLANK_MEM, dst, count);
-		break;
-
-	    case 'L':		/* ESC [nL inserts n lines at cursor */
-		n = value;
-		if (n < 1) n = 1;
-		if (n > (scr_lines - cons->c_row))
-			n = scr_lines - cons->c_row;
-
-		src = cons->c_org + cons->c_row * scr_width;
-		dst = src + n * scr_width;
-		count = (scr_lines - cons->c_row - n) * scr_width;
-		vid_vid_copy(src, dst, count);
-		blank_color = cons->c_blank;
-		mem_vid_copy(BLANK_MEM, src, n * scr_width);
-		break;
-
-	    case 'M':		/* ESC [nM deletes n lines at cursor */
-		n = value;
-		if (n < 1) n = 1;
-		if (n > (scr_lines - cons->c_row))
-			n = scr_lines - cons->c_row;
-
-		dst = cons->c_org + cons->c_row * scr_width;
-		src = dst + n * scr_width;
-		count = (scr_lines - cons->c_row - n) * scr_width;
-		vid_vid_copy(src, dst, count);
-		blank_color = cons->c_blank;
-		mem_vid_copy(BLANK_MEM, dst + count, n * scr_width);
-		break;
-
-	    case '@':		/* ESC [n@ inserts n chars at cursor */
-		n = value;
-		if (n < 1) n = 1;
-		if (n > (scr_width - cons->c_column))
-			n = scr_width - cons->c_column;
-
-		src = cons->c_cur;
-		dst = src + n;
-		count = scr_width - cons->c_column - n;
-		vid_vid_copy(src, dst, count);
-		blank_color = cons->c_blank;
-		mem_vid_copy(BLANK_MEM, src, n);
-		break;
-
-	    case 'P':		/* ESC [nP deletes n chars at cursor */
-		n = value;
-		if (n < 1) n = 1;
-		if (n > (scr_width - cons->c_column))
-			n = scr_width - cons->c_column;
-
-		dst = cons->c_cur;
-		src = dst + n;
-		count = scr_width - cons->c_column - n;
-		vid_vid_copy(src, dst, count);
-		blank_color = cons->c_blank;
-		mem_vid_copy(BLANK_MEM, dst + count, n);
-		break;
-
-	    case 'm':		/* ESC [nm enables rendition n */
-		for (parmp = cons->c_esc_parmv; parmp <= cons->c_esc_parmp
-				&& parmp < bufend(cons->c_esc_parmv); parmp++) {
-			if (cons->c_reverse) {
-				/* Unswap fg and bg colors */
-				cons->c_attr =	((cons->c_attr & 0x7000) >> 4) |
-						((cons->c_attr & 0x0700) << 4) |
-						((cons->c_attr & 0x8800));
-			}
-			switch (n = *parmp) {
-			    case 0:	/* NORMAL */
-				cons->c_attr = cons->c_blank = BLANK_COLOR;
-				cons->c_reverse = FALSE;
-				break;
-
-			    case 1:	/* BOLD  */
-				/* Set intensity bit */
-				cons->c_attr |= 0x0800;
-				break;
-
-			    case 4:	/* UNDERLINE */
-				if (color) {
-					/* Change white to cyan, i.e. lose red
-					 */
-					cons->c_attr = (cons->c_attr & 0xBBFF);
-				} else {
-					/* Set underline attribute */
-					cons->c_attr = (cons->c_attr & 0x99FF);
-				}
-				break;
-
-			    case 5:	/* BLINKING */
-				/* Set the blink bit */
-				cons->c_attr |= 0x8000;
-				break;
-
-			    case 7:	/* REVERSE */
-				cons->c_reverse = TRUE;
-				break;
-
-			    default:	/* COLOR */
-				if (n == 39) n = 37;	/* set default color */
-				if (n == 49) n = 40;
-
-				if (!color) {
-					/* Don't mess up a monochrome screen */
-				} else
-				if (30 <= n && n <= 37) {
-					/* Foreground color */
-					cons->c_attr =
-						(cons->c_attr & 0xF8FF) |
-						(ansi_colors[(n - 30)] << 8);
-					cons->c_blank =
-						(cons->c_blank & 0xF8FF) |
-						(ansi_colors[(n - 30)] << 8);
-				} else
-				if (40 <= n && n <= 47) {
-					/* Background color */
-					cons->c_attr =
-						(cons->c_attr & 0x8FFF) |
-						(ansi_colors[(n - 40)] << 12);
-					cons->c_blank =
-						(cons->c_blank & 0x8FFF) |
-						(ansi_colors[(n - 40)] << 12);
-				}
-			}
-			if (cons->c_reverse) {
-				/* Swap fg and bg colors */
-				cons->c_attr =	((cons->c_attr & 0x7000) >> 4) |
-						((cons->c_attr & 0x0700) << 4) |
-						((cons->c_attr & 0x8800));
-			}
-		}
-		break;
-	}
-  }
-  cons->c_esc_state = 0;
-}
-
-/*===========================================================================*
- *				set_6845				     *
- *===========================================================================*/
-PRIVATE void set_6845(reg, val)
-int reg;			/* which register pair to set */
-unsigned val;			/* 16-bit value to set it to */
-{
-/* Set a register pair inside the 6845.
- * Registers 12-13 tell the 6845 where in video ram to start
- * Registers 14-15 tell the 6845 where to put the cursor
- */
-  pvb_pair_t char_out[4];
-  pv_set(char_out[0], vid_port + INDEX, reg);	/* set index register */
-  pv_set(char_out[1], vid_port + DATA, (val>>8) & BYTE);    /* high byte */
-  pv_set(char_out[2], vid_port + INDEX, reg + 1);	    /* again */
-  pv_set(char_out[3], vid_port + DATA, val&BYTE);	    /* low byte */
-  sys_voutb(char_out, 4);			/* do actual output */
-}
-
-/*===========================================================================*
- *				get_6845				     *
- *===========================================================================*/
-PRIVATE void get_6845(reg, val)
-int reg;			/* which register pair to set */
-unsigned *val;			/* 16-bit value to set it to */
-{
-  char v1, v2;
-  unsigned long v;
-/* Get a register pair inside the 6845.  */
-  sys_outb(vid_port + INDEX, reg); 
-  sys_inb(vid_port + DATA, &v); 
-  v1 = v;
-  sys_outb(vid_port + INDEX, reg+1); 
-  sys_inb(vid_port + DATA, &v); 
-  v2 = v;
-  *val = (v1 << 8) | v2;
-}
-
-/*===========================================================================*
- *				beep					     *
- *===========================================================================*/
-PRIVATE void beep()
-{
-/* Making a beeping sound on the speaker (output for CRTL-G).
- * This routine works by turning on the bits 0 and 1 in port B of the 8255
- * chip that drive the speaker.
- */
-  static timer_t tmr_stop_beep;
-  pvb_pair_t char_out[3];
-  clock_t now;
-  unsigned long port_b_val;
-  int s;
-  
-  /* Fetch current time in advance to prevent beeping delay. */
-  if ((s=getuptime(&now)) != OK)
-  	panic("TTY","Console couldn't get clock's uptime.", s);
-  if (!beeping) {
-	/* Set timer channel 2, square wave, with given frequency. */
-        pv_set(char_out[0], TIMER_MODE, 0xB6);	
-        pv_set(char_out[1], TIMER2, (BEEP_FREQ >> 0) & BYTE);
-        pv_set(char_out[2], TIMER2, (BEEP_FREQ >> 8) & BYTE);
-        if (sys_voutb(char_out, 3)==OK) {
-        	if (sys_inb(PORT_B, &port_b_val)==OK &&
-        	    sys_outb(PORT_B, (port_b_val|3))==OK)
-        	    	beeping = TRUE;
-        }
-  }
-  /* Add a timer to the timers list. Possibly reschedule the alarm. */
-  tmrs_settimer(&tty_timers, &tmr_stop_beep, now+B_TIME, stop_beep, NULL);
-  if (tty_timers->tmr_exp_time != tty_next_timeout) {
-  	tty_next_timeout = tty_timers->tmr_exp_time;
-  	if ((s=sys_setalarm(tty_next_timeout, 1)) != OK)
-  		panic("TTY","Console couldn't set alarm.", s);
-  }
-}
-
-
-/*===========================================================================*
- *				do_video				     *
- *===========================================================================*/
-PUBLIC void do_video(message *m)
-{
-	int i, n, r, ops, watch;
-	unsigned char c;
-
-	/* Execute the requested device driver function. */
-	r= EINVAL;	/* just in case */
-	switch (m->m_type) {
-	    case DEV_OPEN:
-		/* Should grant IOPL */
-		r= OK;
-		break;
-	    case DEV_CLOSE:
-		r= OK;
-		break;
-	    case DEV_IOCTL:
-		if (m->TTY_REQUEST == MIOCMAP || m->TTY_REQUEST == MIOCUNMAP)
-		{
-			int r, do_map;
-			struct mapreq mapreq;
-
-			do_map= (m->REQUEST == MIOCMAP);	/* else unmap */
-
-			/* Get request structure */
-			r= sys_vircopy(m->IO_ENDPT, D,
-				(vir_bytes)m->ADDRESS,
-				SELF, D, (vir_bytes)&mapreq, sizeof(mapreq));
-			if (r != OK)
-			{
-				tty_reply(TASK_REPLY, m->m_source, m->IO_ENDPT,
-					r);
-				return;
-			}
-			r= sys_vm_map(m->IO_ENDPT, do_map,
-				(phys_bytes)mapreq.base, mapreq.size,
-				mapreq.offset);
-			tty_reply(TASK_REPLY, m->m_source, m->IO_ENDPT, r);
-			return;
-		}
-		r= ENOTTY;
-		break;
-
-	    default:		
-		printf(
-		"Warning, TTY(video) got unexpected request %d from %d\n",
-			m->m_type, m->m_source);
-		r= EINVAL;
-	}
-	tty_reply(TASK_REPLY, m->m_source, m->IO_ENDPT, r);
-}
-
-
-/*===========================================================================*
- *				beep_x					     *
- *===========================================================================*/
-PUBLIC void beep_x(freq, dur)
-unsigned freq;
-clock_t dur;
-{
-/* Making a beeping sound on the speaker.
- * This routine works by turning on the bits 0 and 1 in port B of the 8255
- * chip that drive the speaker.
- */
-  static timer_t tmr_stop_beep;
-  pvb_pair_t char_out[3];
-  clock_t now;
-  unsigned long port_b_val;
-  int s;
-  
-  unsigned long ival= TIMER_FREQ / freq;
-  if (ival == 0 || ival > 0xffff)
-	return;	/* Frequency out of range */
-
-  /* Fetch current time in advance to prevent beeping delay. */
-  if ((s=getuptime(&now)) != OK)
-  	panic("TTY","Console couldn't get clock's uptime.", s);
-  if (!beeping) {
-	/* Set timer channel 2, square wave, with given frequency. */
-        pv_set(char_out[0], TIMER_MODE, 0xB6);	
-        pv_set(char_out[1], TIMER2, (ival >> 0) & BYTE);
-        pv_set(char_out[2], TIMER2, (ival >> 8) & BYTE);
-        if (sys_voutb(char_out, 3)==OK) {
-        	if (sys_inb(PORT_B, &port_b_val)==OK &&
-        	    sys_outb(PORT_B, (port_b_val|3))==OK)
-        	    	beeping = TRUE;
-        }
-  }
-  /* Add a timer to the timers list. Possibly reschedule the alarm. */
-  tmrs_settimer(&tty_timers, &tmr_stop_beep, now+dur, stop_beep, NULL);
-  if (tty_timers->tmr_exp_time != tty_next_timeout) {
-  	tty_next_timeout = tty_timers->tmr_exp_time;
-  	if ((s=sys_setalarm(tty_next_timeout, 1)) != OK)
-  		panic("TTY","Console couldn't set alarm.", s);
-  }
-}
-
-/*===========================================================================*
- *				stop_beep				     *
- *===========================================================================*/
-PRIVATE void stop_beep(tmrp)
-timer_t *tmrp;
-{
-/* Turn off the beeper by turning off bits 0 and 1 in PORT_B. */
-  unsigned long port_b_val;
-  if (sys_inb(PORT_B, &port_b_val)==OK && 
-	sys_outb(PORT_B, (port_b_val & ~3))==OK)
-		beeping = FALSE;
-}
-
-/*===========================================================================*
- *				scr_init				     *
- *===========================================================================*/
-PUBLIC void scr_init(tp)
-tty_t *tp;
-{
-/* Initialize the screen driver. */
-  console_t *cons;
-  phys_bytes vid_base;
-  u16_t bios_columns, bios_crtbase, bios_fontlines;
-  u8_t bios_rows;
-  int line;
-  int s;
-  static int vdu_initialized = 0;
-  unsigned page_size;
-
-  /* Associate console and TTY. */
-  line = tp - &tty_table[0];
-  if (line >= nr_cons) return;
-  cons = &cons_table[line];
-  cons->c_tty = tp;
-  tp->tty_priv = cons;
-
-  /* Fill in TTY function hooks. */
-  tp->tty_devwrite = cons_write;
-  tp->tty_echo = cons_echo;
-  tp->tty_ioctl = cons_ioctl;
-
-  /* Get the BIOS parameters that describe the VDU. */
-  if (! vdu_initialized++) {
-
-	/* How about error checking? What to do on failure??? */
-  	s=sys_vircopy(SELF, BIOS_SEG, (vir_bytes) VDU_SCREEN_COLS_ADDR,
-  		SELF, D, (vir_bytes) &bios_columns, VDU_SCREEN_COLS_SIZE);
-  	s=sys_vircopy(SELF, BIOS_SEG, (vir_bytes) VDU_CRT_BASE_ADDR, 
-  		SELF, D, (vir_bytes) &bios_crtbase, VDU_CRT_BASE_SIZE);
-  	s=sys_vircopy(SELF, BIOS_SEG, (vir_bytes) VDU_SCREEN_ROWS_ADDR, 
-  		SELF, D, (vir_bytes) &bios_rows, VDU_SCREEN_ROWS_SIZE);
-  	s=sys_vircopy(SELF, BIOS_SEG, (vir_bytes) VDU_FONTLINES_ADDR, 
-  		SELF, D, (vir_bytes) &bios_fontlines, VDU_FONTLINES_SIZE);
-
-  	vid_port = bios_crtbase;
-  	scr_width = bios_columns;
-  	font_lines = bios_fontlines;
-  	scr_lines = machine.vdu_ega ? bios_rows+1 : 25;
-
-  	if (color) {
-		vid_base = COLOR_BASE;
-		vid_size = COLOR_SIZE;
-  	} else {
-		vid_base = MONO_BASE;
-		vid_size = MONO_SIZE;
-  	}
-  	if (machine.vdu_ega) vid_size = EGA_SIZE;
-  	wrap = ! machine.vdu_ega;
-
-  	s = sys_segctl(&vid_index, &vid_seg, &vid_off, vid_base, vid_size);
-
-  	vid_size >>= 1;		/* word count */
-  	vid_mask = vid_size - 1;
-
-  	/* Size of the screen (number of displayed characters.) */
-  	scr_size = scr_lines * scr_width;
-
-  	/* There can be as many consoles as video memory allows. */
-  	nr_cons = vid_size / scr_size;
-  	if (nr_cons > NR_CONS) nr_cons = NR_CONS;
-  	if (nr_cons > 1) wrap = 0;
-  	page_size = vid_size / nr_cons;
-  }
-
-  cons->c_start = line * page_size;
-  cons->c_limit = cons->c_start + page_size;
-  cons->c_cur = cons->c_org = cons->c_start;
-  cons->c_attr = cons->c_blank = BLANK_COLOR;
-
-  if (line != 0) {
-        /* Clear the non-console vtys. */
-  	blank_color = BLANK_COLOR;
-	mem_vid_copy(BLANK_MEM, cons->c_start, scr_size);
-  } else {
-	int i, n;
-	/* Set the cursor of the console vty at the bottom. c_cur
-	 * is updated automatically later.
-	 */
-	scroll_screen(cons, SCROLL_UP);
-	cons->c_row = scr_lines - 1;
-	cons->c_column = 0;
-  }
-  select_console(0);
-  cons_ioctl(tp, 0);
-}
-
-/*===========================================================================*
- *				kputc					     *
- *===========================================================================*/
-PUBLIC void kputc(c)
-int c;
-{
-/* Accumulate a single character for a kernel message. Send a notification
- * the to output driver if an END_OF_KMESS is encountered. 
- */
-#if 0
-  ser_putc(c);
-  return;
-#endif
-
-  if (panicing)
-	cons_putk(c);
-  if (c != 0) {
-      kmess.km_buf[kmess.km_next] = c;	/* put normal char in buffer */
-      if (kmess.km_size < KMESS_BUF_SIZE)
-          kmess.km_size += 1;		
-      kmess.km_next = (kmess.km_next + 1) % KMESS_BUF_SIZE;
-  } else {
-      notify(LOG_PROC_NR);
-  }
-}
-
-/*===========================================================================*
- *				do_new_kmess				     *
- *===========================================================================*/
-PUBLIC void do_new_kmess(m)
-message *m;
-{
-/* Notification for a new kernel message. */
-  struct kmessages kmess;			/* kmessages structure */
-  static int prev_next = 0;			/* previous next seen */
-  int size, next;
-  int bytes;
-  int r;
-
-  /* Try to get a fresh copy of the buffer with kernel messages. */
-#if DEAD_CODE	
-  /* During shutdown, the reply is garbled because new notifications arrive
-   * while the system task makes a copy of the kernel messages buffer.
-   * Hence, don't check the return value. 
-   */
-  if ((r=sys_getkmessages(&kmess)) != OK) {
-  	printf("TTY: couldn't get copy of kmessages: %d, 0x%x\n", r,r);
-  	return;
-  }
-#endif
-  sys_getkmessages(&kmess);
-
-  /* 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
-   * buffer is circular. This works fine if less then KMESS_BUF_SIZE bytes
-   * is new data; else we miss % KMESS_BUF_SIZE here.  
-   * Check for size being positive, the buffer might as well be emptied!
-   */
-  if (kmess.km_size > 0) {
-      bytes = ((kmess.km_next + KMESS_BUF_SIZE) - prev_next) % KMESS_BUF_SIZE;
-      r=prev_next;				/* start at previous old */ 
-      while (bytes > 0) {			
-          cons_putk( kmess.km_buf[(r%KMESS_BUF_SIZE)] );
-          bytes --;
-          r ++;
-      }
-      cons_putk(0);			/* terminate to flush output */
-  }
-
-  /* Almost done, store 'next' so that we can determine what part of the
-   * kernel messages buffer to print next time a notification arrives.
-   */
-  prev_next = kmess.km_next;
-}
-
-/*===========================================================================*
- *				do_diagnostics				     *
- *===========================================================================*/
-PUBLIC void do_diagnostics(m_ptr)
-message *m_ptr;			/* pointer to request message */
-{
-/* Print a string for a server. */
-  char c;
-  vir_bytes src;
-  int count;
-  int result = OK;
-  int proc_nr = m_ptr->DIAG_ENDPT;
-  if (proc_nr == SELF) proc_nr = m_ptr->m_source;
-
-  src = (vir_bytes) m_ptr->DIAG_PRINT_BUF;
-  for (count = m_ptr->DIAG_BUF_COUNT; count > 0; count--) {
-	if (sys_vircopy(proc_nr, D, src++, SELF, D, (vir_bytes) &c, 1) != OK) {
-		result = EFAULT;
-		break;
-	}
-	cons_putk(c);
-  }
-  cons_putk(0);			/* always terminate, even with EFAULT */
-  m_ptr->m_type = 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);
-}
-
-/*===========================================================================*
- *				cons_putk				     *
- *===========================================================================*/
-PRIVATE void cons_putk(c)
-int c;				/* character to print */
-{
-/* This procedure is used to print a character on the console.
- */
-  if (c != 0) {
-	if (c == '\n') cons_putk('\r');
-	out_char(&cons_table[0], (int) c);
-  } else {
-	flush(&cons_table[0]);
-  }
-}
-
-/*===========================================================================*
- *				toggle_scroll				     *
- *===========================================================================*/
-PUBLIC void toggle_scroll()
-{
-/* Toggle between hardware and software scroll. */
-
-  cons_org0();
-  softscroll = !softscroll;
-  printf("%sware scrolling enabled.\n", softscroll ? "Soft" : "Hard");
-}
-
-/*===========================================================================*
- *				cons_stop				     *
- *===========================================================================*/
-PUBLIC void cons_stop()
-{
-/* Prepare for halt or reboot. */
-  cons_org0();
-  softscroll = 1;
-  select_console(0);
-  cons_table[0].c_attr = cons_table[0].c_blank = BLANK_COLOR;
-}
-
-/*===========================================================================*
- *				cons_org0				     *
- *===========================================================================*/
-PRIVATE void cons_org0()
-{
-/* Scroll video memory back to put the origin at 0. */
-  int cons_line;
-  console_t *cons;
-  unsigned n;
-
-  for (cons_line = 0; cons_line < nr_cons; cons_line++) {
-	cons = &cons_table[cons_line];
-	while (cons->c_org > cons->c_start) {
-		n = vid_size - scr_size;	/* amount of unused memory */
-		if (n > cons->c_org - cons->c_start)
-			n = cons->c_org - cons->c_start;
-		vid_vid_copy(cons->c_org, cons->c_org - n, scr_size);
-		cons->c_org -= n;
-	}
-	flush(cons);
-  }
-  select_console(ccurrent);
-}
-
-/*===========================================================================*
- *				select_console				     *
- *===========================================================================*/
-PUBLIC void select_console(int cons_line)
-{
-/* Set the current console to console number 'cons_line'. */
-
-  if (cons_line < 0 || cons_line >= nr_cons) return;
-  ccurrent = cons_line;
-  curcons = &cons_table[cons_line];
-  set_6845(VID_ORG, curcons->c_org);
-  set_6845(CURSOR, curcons->c_cur);
-}
-
-/*===========================================================================*
- *				con_loadfont				     *
- *===========================================================================*/
-PUBLIC int con_loadfont(m)
-message *m;
-{
-/* Load a font into the EGA or VGA adapter. */
-  int result;
-  static struct sequence seq1[7] = {
-	{ GA_SEQUENCER_INDEX, 0x00, 0x01 },
-	{ GA_SEQUENCER_INDEX, 0x02, 0x04 },
-	{ GA_SEQUENCER_INDEX, 0x04, 0x07 },
-	{ GA_SEQUENCER_INDEX, 0x00, 0x03 },
-	{ GA_GRAPHICS_INDEX, 0x04, 0x02 },
-	{ GA_GRAPHICS_INDEX, 0x05, 0x00 },
-	{ GA_GRAPHICS_INDEX, 0x06, 0x00 },
-  };
-  static struct sequence seq2[7] = {
-	{ GA_SEQUENCER_INDEX, 0x00, 0x01 },
-	{ GA_SEQUENCER_INDEX, 0x02, 0x03 },
-	{ GA_SEQUENCER_INDEX, 0x04, 0x03 },
-	{ GA_SEQUENCER_INDEX, 0x00, 0x03 },
-	{ GA_GRAPHICS_INDEX, 0x04, 0x00 },
-	{ GA_GRAPHICS_INDEX, 0x05, 0x10 },
-	{ GA_GRAPHICS_INDEX, 0x06,    0 },
-  };
-
-  seq2[6].value= color ? 0x0E : 0x0A;
-
-  if (!machine.vdu_ega) return(ENOTTY);
-  result = ga_program(seq1);	/* bring font memory into view */
-
-  result = sys_physcopy(m->IO_ENDPT, D, (vir_bytes) m->ADDRESS, 
-  	NONE, PHYS_SEG, (phys_bytes) GA_VIDEO_ADDRESS, (phys_bytes)GA_FONT_SIZE);
-
-  result = ga_program(seq2);	/* restore */
-
-  return(result);
-}
-
-/*===========================================================================*
- *				ga_program				     *
- *===========================================================================*/
-PRIVATE int ga_program(seq)
-struct sequence *seq;
-{
-  pvb_pair_t char_out[14];
-  int i;
-  for (i=0; i<7; i++) {
-      pv_set(char_out[2*i], seq->index, seq->port);
-      pv_set(char_out[2*i+1], seq->index+1, seq->value);
-      seq++;
-  } 
-  return sys_voutb(char_out, 14);
-}
-
-/*===========================================================================*
- *				cons_ioctl				     *
- *===========================================================================*/
-PRIVATE int cons_ioctl(tp, try)
-tty_t *tp;
-int try;
-{
-/* Set the screen dimensions. */
-
-  tp->tty_winsize.ws_row= scr_lines;
-  tp->tty_winsize.ws_col= scr_width;
-  tp->tty_winsize.ws_xpixel= scr_width * 8;
-  tp->tty_winsize.ws_ypixel= scr_lines * font_lines;
-}
-
-#define COM1_BASE	0x3F8
-#define COM1_THR	(COM1_BASE + 0)
-#define		LSR_THRE	0x20
-#define COM1_LSR	(COM1_BASE + 5)
-
-PRIVATE void ser_putc(char c)
-{
-	unsigned long b;
-	int i;
-	int lsr, thr;
-
-	lsr= COM1_LSR;
-	thr= COM1_THR;
-	for (i= 0; i<100; i++)
-	{
-		sys_inb(lsr, &b);
-		if (b & LSR_THRE)
-			break;
-	}
-	sys_outb(thr, c);
-}
Index: trunk/minix/drivers/tty/keyboard.c
===================================================================
--- trunk/minix/drivers/tty/keyboard.c	(revision 9)
+++ 	(revision )
@@ -1,1214 +1,0 @@
-/* Keyboard driver for PC's and AT's.
- *
- * Changes: 
- *   Jul 13, 2004   processes can observe function keys  (Jorrit N. Herder)
- *   Jun 15, 2004   removed wreboot(), except panic dumps (Jorrit N. Herder)
- *   Feb 04, 1994   loadable keymaps  (Marcus Hampel)
- */
-
-#include "../drivers.h"
-#include <sys/ioctl.h>
-#include <sys/kbdio.h>
-#include <sys/time.h>
-#include <sys/select.h>
-#include <termios.h>
-#include <signal.h>
-#include <unistd.h>
-#include <minix/callnr.h>
-#include <minix/com.h>
-#include <minix/keymap.h>
-#include "tty.h"
-#include "keymaps/us-std.src"
-#include "../../kernel/const.h"
-#include "../../kernel/config.h"
-#include "../../kernel/type.h"
-#include "../../kernel/proc.h"
-
-int irq_hook_id = -1;
-int aux_irq_hook_id = -1;
-
-/* Standard and AT keyboard.  (PS/2 MCA implies AT throughout.) */
-#define KEYBD		0x60	/* I/O port for keyboard data */
-
-/* AT keyboard. */
-#define KB_COMMAND	0x64	/* I/O port for commands on AT */
-#define KB_STATUS	0x64	/* I/O port for status on AT */
-#define KB_ACK		0xFA	/* keyboard ack response */
-#define KB_AUX_BYTE	0x20	/* Auxiliary Device Output Buffer Full */
-#define KB_OUT_FULL	0x01	/* status bit set when keypress char pending */
-#define KB_IN_FULL	0x02	/* status bit set when not ready to receive */
-#define KBC_RD_RAM_CCB	0x20	/* Read controller command byte */
-#define KBC_WR_RAM_CCB	0x60	/* Write controller command byte */
-#define KBC_DI_AUX	0xA7	/* Disable Auxiliary Device */
-#define KBC_EN_AUX	0xA8	/* Enable Auxiliary Device */
-#define KBC_DI_KBD	0xAD	/* Disable Keybard Interface */
-#define KBC_EN_KBD	0xAE	/* Enable Keybard Interface */
-#define KBC_WRITE_AUX	0xD4	/* Write to Auxiliary Device */
-#define LED_CODE	0xED	/* command to keyboard to set LEDs */
-#define MAX_KB_ACK_RETRIES 0x1000	/* max #times to wait for kb ack */
-#define MAX_KB_BUSY_RETRIES 0x1000	/* max #times to loop while kb busy */
-#define KBIT		0x80	/* bit used to ack characters to keyboard */
-
-#define KBC_IN_DELAY	7	/* wait 7 microseconds when polling */
-
-/* Miscellaneous. */
-#define ESC_SCAN	0x01	/* reboot key when panicking */
-#define SLASH_SCAN	0x35	/* to recognize numeric slash */
-#define RSHIFT_SCAN	0x36	/* to distinguish left and right shift */
-#define HOME_SCAN	0x47	/* first key on the numeric keypad */
-#define INS_SCAN	0x52	/* INS for use in CTRL-ALT-INS reboot */
-#define DEL_SCAN	0x53	/* DEL for use in CTRL-ALT-DEL reboot */
-
-#define KBD_BUFSZ	1024	/* Buffer size for raw scan codes */
-#define KBD_OUT_BUFSZ	16	/* Output buffer to sending data to the
-				 * keyboard.
-				 */
-
-#define MICROS_TO_TICKS(m)  (((m)*HZ/1000000)+1)
-
-#define CONSOLE		   0	/* line number for console */
-#define KB_IN_BYTES	  32	/* size of keyboard input buffer */
-PRIVATE char ibuf[KB_IN_BYTES];	/* input buffer */
-PRIVATE char *ihead = ibuf;	/* next free spot in input buffer */
-PRIVATE char *itail = ibuf;	/* scan code to return to TTY */
-PRIVATE int icount;		/* # codes in buffer */
-
-PRIVATE int esc;		/* escape scan code detected? */
-PRIVATE int alt_l;		/* left alt key state */
-PRIVATE int alt_r;		/* right alt key state */
-PRIVATE int alt;		/* either alt key */
-PRIVATE int ctrl_l;		/* left control key state */
-PRIVATE int ctrl_r;		/* right control key state */
-PRIVATE int ctrl;		/* either control key */
-PRIVATE int shift_l;		/* left shift key state */
-PRIVATE int shift_r;		/* right shift key state */
-PRIVATE int shift;		/* either shift key */
-PRIVATE int num_down;		/* num lock key depressed */
-PRIVATE int caps_down;		/* caps lock key depressed */
-PRIVATE int scroll_down;	/* scroll lock key depressed */
-PRIVATE int locks[NR_CONS];	/* per console lock keys state */
-
-/* Lock key active bits.  Chosen to be equal to the keyboard LED bits. */
-#define SCROLL_LOCK	0x01
-#define NUM_LOCK	0x02
-#define CAPS_LOCK	0x04
-
-PRIVATE char numpad_map[] =
-		{'H', 'Y', 'A', 'B', 'D', 'C', 'V', 'U', 'G', 'S', 'T', '@'};
-
-/* Variables and definition for observed function keys. */
-typedef struct observer { int proc_nr; int events; } obs_t;
-PRIVATE obs_t  fkey_obs[12];	/* observers for F1-F12 */
-PRIVATE obs_t sfkey_obs[12];	/* observers for SHIFT F1-F12 */
-
-PRIVATE struct kbd
-{
-	int minor;
-	int nr_open;
-	char buf[KBD_BUFSZ];
-	int offset;
-	int avail;
-	int req_size;
-	int req_proc;
-	vir_bytes req_addr;
-	int incaller;
-	int select_ops;
-	int select_proc;
-} kbd, kbdaux;
-
-/* Data that is to be sent to the keyboard. Each byte is ACKed by the
- * keyboard.
- */
-PRIVATE struct kbd_outack
-{
-	unsigned char buf[KBD_OUT_BUFSZ];
-	int offset;
-	int avail;
-	int expect_ack;
-} kbdout;
-
-PRIVATE int kbd_watchdog_set= 0;
-PRIVATE int kbd_alive= 1;
-PRIVATE timer_t tmr_kbd_wd;
-
-FORWARD _PROTOTYPE( void handle_req, (struct kbd *kbdp, message *m)	);
-FORWARD _PROTOTYPE( int handle_status, (struct kbd *kbdp, message *m)	);
-FORWARD _PROTOTYPE( void kbc_cmd0, (int cmd)				);
-FORWARD _PROTOTYPE( void kbc_cmd1, (int cmd, int data)			);
-FORWARD _PROTOTYPE( int kbc_read, (void)				);
-FORWARD _PROTOTYPE( void kbd_send, (void)				);
-FORWARD _PROTOTYPE( int kb_ack, (void) 					);
-FORWARD _PROTOTYPE( int kb_wait, (void)				 	);
-FORWARD _PROTOTYPE( int func_key, (int scode) 				);
-FORWARD _PROTOTYPE( int scan_keyboard, (unsigned char *bp, int *isauxp)	);
-FORWARD _PROTOTYPE( unsigned make_break, (int scode) 			);
-FORWARD _PROTOTYPE( void set_leds, (void) 				);
-FORWARD _PROTOTYPE( void show_key_mappings, (void) 			);
-FORWARD _PROTOTYPE( int kb_read, (struct tty *tp, int try) 		);
-FORWARD _PROTOTYPE( unsigned map_key, (int scode) 			);
-FORWARD _PROTOTYPE( void micro_delay, (unsigned long usecs)		);
-FORWARD _PROTOTYPE( void kbd_watchdog, (timer_t *tmrp)			);
-
-/*===========================================================================*
- *				do_kbd					     *
- *===========================================================================*/
-PUBLIC void do_kbd(message *m)
-{
-	handle_req(&kbd, m);
-}
-
-
-/*===========================================================================*
- *				kbd_status				     *
- *===========================================================================*/
-PUBLIC int kbd_status(message *m)
-{
-	int r;
-
-	r= handle_status(&kbd, m);
-	if (r)
-		return r;
-	return handle_status(&kbdaux, m);
-}
-
-
-/*===========================================================================*
- *				do_kbdaux				     *
- *===========================================================================*/
-PUBLIC void do_kbdaux(message *m)
-{
-	handle_req(&kbdaux, m);
-}
-
-
-/*===========================================================================*
- *				handle_req				     *
- *===========================================================================*/
-PRIVATE void handle_req(kbdp, m)
-struct kbd *kbdp;
-message *m;
-{
-	int i, n, r, ops, watch;
-	unsigned char c;
-
-	/* Execute the requested device driver function. */
-	r= EINVAL;	/* just in case */
-	switch (m->m_type) {
-	    case DEV_OPEN:
-		kbdp->nr_open++;
-		r= OK;
-		break;
-	    case DEV_CLOSE:
-		kbdp->nr_open--;
-		if (kbdp->nr_open < 0)
-		{
-			printf("TTY(kbd): open count is negative\n");
-			kbdp->nr_open= 0;
-		}
-		if (kbdp->nr_open == 0)
-			kbdp->avail= 0;
-		r= OK;
-		break;
-	    case DEV_READ:	 
-		if (kbdp->req_size)
-		{
-			/* We handle only request at a time */
-			r= EIO;
-			break;
-		}
-		if (kbdp->avail == 0)
-		{
-			/* Should record proc */
-			kbdp->req_size= m->COUNT;
-			kbdp->req_proc= m->IO_ENDPT;
-			kbdp->req_addr= (vir_bytes)m->ADDRESS;
-			kbdp->incaller= m->m_source;
-			r= SUSPEND;
-			break;
-		}
-
-		/* Handle read request */
-		n= kbdp->avail;
-		if (n > m->COUNT)
-			n= m->COUNT;
-		if (kbdp->offset + n > KBD_BUFSZ)
-			n= KBD_BUFSZ-kbdp->offset;
-		if (n <= 0)
-			panic("TTY", "do_kbd(READ): bad n", n);
-		r= sys_vircopy(SELF, D, (vir_bytes)&kbdp->buf[kbdp->offset], 
-			m->IO_ENDPT, D, (vir_bytes) m->ADDRESS, n);
-		if (r == OK)
-		{
-			kbdp->offset= (kbdp->offset+n) % KBD_BUFSZ;
-			kbdp->avail -= n;
-			r= n;
-		}
-
-		break;
-
-	    case DEV_WRITE:
-		if (kbdp != &kbdaux)
-		{
-			printf("write to keyboard not implemented\n");
-			r= EINVAL;
-			break;
-		}
-
-		/* Assume that output to AUX only happens during
-		 * initialization and we can afford to lose input. This should
-		 * be fixed at a later time.
-		 */
-		for (i= 0; i<m->COUNT; i++)
-		{
-			r= sys_vircopy(m->IO_ENDPT, D, (vir_bytes) m->ADDRESS+i,
-				SELF, D, (vir_bytes)&c, 1);
-			if (r != OK)
-				break;
-			kbc_cmd1(KBC_WRITE_AUX, c);
-		}
-		r= i;
-		break;
-
-	    case CANCEL:
-		kbdp->req_size= 0;
-		r= OK;
-		break;
-	    case DEV_SELECT:
-		ops = m->IO_ENDPT & (SEL_RD|SEL_WR|SEL_ERR);
-		watch = (m->IO_ENDPT & SEL_NOTIFY) ? 1 : 0;
-		
-		r= 0;
-		if (kbdp->avail && (ops & SEL_RD))
-		{
-			r |= SEL_RD;
-			break;
-		}
-
-		if (ops && watch)
-		{
-			kbdp->select_ops |= ops;
-			kbdp->select_proc= m->m_source;
-		}
-		break;
-	    case DEV_IOCTL:
-		if (kbdp == &kbd && m->TTY_REQUEST == KIOCSLEDS)
-		{
-			kio_leds_t leds;
-			unsigned char b;
-
-			r= sys_vircopy(m->IO_ENDPT, D, (vir_bytes) m->ADDRESS,
-				SELF, D, (vir_bytes)&leds, sizeof(leds));
-			if (r != OK)
-				break;
-			b= 0;
-			if (leds.kl_bits & KBD_LEDS_NUM) b |= NUM_LOCK;
-			if (leds.kl_bits & KBD_LEDS_CAPS) b |= CAPS_LOCK;
-			if (leds.kl_bits & KBD_LEDS_SCROLL) b |= SCROLL_LOCK;
-			if (kbdout.avail == 0)
-				kbdout.offset= 0;
-			if (kbdout.offset + kbdout.avail + 2 > KBD_OUT_BUFSZ)
-			{
-				/* Output buffer is full. Ignore this command.
-				 * Reset ACK flag.
-				 */
-				kbdout.expect_ack= 0;
-			}
-			else
-			{
-				kbdout.buf[kbdout.offset+kbdout.avail]=
-					LED_CODE;
-				kbdout.buf[kbdout.offset+kbdout.avail+1]= b;
-				kbdout.avail += 2;
-			 }
-			 if (!kbdout.expect_ack)
-				kbd_send();
-			 r= OK;
-			 break;
-		}
-		if (kbdp == &kbd && m->TTY_REQUEST == KIOCBELL)
-		{
-			kio_bell_t bell;
-			clock_t ticks;
-
-			r= sys_vircopy(m->IO_ENDPT, D, (vir_bytes) m->ADDRESS,
-				SELF, D, (vir_bytes)&bell, sizeof(bell));
-			if (r != OK)
-				break;
-
-			ticks= bell.kb_duration.tv_usec * HZ / 1000000;
-			ticks += bell.kb_duration.tv_sec * HZ;
-			if (!ticks)
-				ticks++;
-			beep_x(bell.kb_pitch, ticks);
-
-			r= OK;
-			break;
-		}
-		r= ENOTTY;
-		break;
-
-	    default:		
-		printf("Warning, TTY(kbd) got unexpected request %d from %d\n",
-			m->m_type, m->m_source);
-		r= EINVAL;
-	}
-	tty_reply(TASK_REPLY, m->m_source, m->IO_ENDPT, r);
-}
-
-
-/*===========================================================================*
- *				handle_status				     *
- *===========================================================================*/
-PRIVATE int handle_status(kbdp, m)
-struct kbd *kbdp;
-message *m;
-{
-	int n, r;
-
-	if (kbdp->avail && kbdp->req_size && m->m_source == kbdp->incaller)
-	{
-		/* Handle read request */
-		n= kbdp->avail;
-		if (n > kbdp->req_size)
-			n= kbdp->req_size;
-		if (kbdp->offset + n > KBD_BUFSZ)
-			n= KBD_BUFSZ-kbdp->offset;
-		if (n <= 0)
-			panic("TTY", "kbd_status: bad n", n);
-		kbdp->req_size= 0;
-		r= sys_vircopy(SELF, D, (vir_bytes)&kbdp->buf[kbdp->offset], 
-			kbdp->req_proc, D, kbdp->req_addr, n);
-		if (r == OK)
-		{
-			kbdp->offset= (kbdp->offset+n) % KBD_BUFSZ;
-			kbdp->avail -= n;
-			r= n;
-		}
-
-		m->m_type = DEV_REVIVE;
-  		m->REP_ENDPT= kbdp->req_proc;
-  		m->REP_STATUS= r;
-		return 1;
-	}
-	if (kbdp->avail && (kbdp->select_ops & SEL_RD) &&
-		m->m_source == kbdp->select_proc)
-	{
-		m->m_type = DEV_IO_READY;
-		m->DEV_MINOR = kbdp->minor;
-		m->DEV_SEL_OPS = SEL_RD;
-
-		kbdp->select_ops &= ~SEL_RD;
-		return 1;
-	}
-
-	return 0;
-}
-
-
-/*===========================================================================*
- *				map_key0				     *
- *===========================================================================*/
-/* Map a scan code to an ASCII code ignoring modifiers. */
-#define map_key0(scode)	 \
-	((unsigned) keymap[(scode) * MAP_COLS])
-
-/*===========================================================================*
- *				map_key					     *
- *===========================================================================*/
-PRIVATE unsigned map_key(scode)
-int scode;
-{
-/* Map a scan code to an ASCII code. */
-
-  int caps, column, lk;
-  u16_t *keyrow;
-
-  if (scode == SLASH_SCAN && esc) return '/';	/* don't map numeric slash */
-
-  keyrow = &keymap[scode * MAP_COLS];
-
-  caps = shift;
-  lk = locks[ccurrent];
-  if ((lk & NUM_LOCK) && HOME_SCAN <= scode && scode <= DEL_SCAN) caps = !caps;
-  if ((lk & CAPS_LOCK) && (keyrow[0] & HASCAPS)) caps = !caps;
-
-  if (alt) {
-	column = 2;
-	if (ctrl || alt_r) column = 3;	/* Ctrl + Alt == AltGr */
-	if (caps) column = 4;
-  } else {
-	column = 0;
-	if (caps) column = 1;
-	if (ctrl) column = 5;
-  }
-  return keyrow[column] & ~HASCAPS;
-}
-
-/*===========================================================================*
- *				kbd_interrupt				     *
- *===========================================================================*/
-PUBLIC void kbd_interrupt(m_ptr)
-message *m_ptr;
-{
-/* A keyboard interrupt has occurred.  Process it. */
-  int o, isaux;
-  unsigned char scode;
-  struct kbd *kbdp;
-  static timer_t timer;		/* timer must be static! */
-
-  /* Fetch the character from the keyboard hardware and acknowledge it. */
-  if (!scan_keyboard(&scode, &isaux))
-	return;
-
-  if (isaux)
-	kbdp= &kbdaux;
-  else if (kbd.nr_open && !panicing)
-	kbdp= &kbd;
-  else
-	kbdp= NULL;
-
-  if (kbdp)
-  {
-	/* raw scan codes or aux data */
-	if (kbdp->avail >= KBD_BUFSZ)
-	{
-		printf("kbd_interrupt: %s buffer is full\n",
-			isaux ? "kbdaux" : "keyboard");
-		return;	/* Buffer is full */
-	}
-	 o= (kbdp->offset + kbdp->avail) % KBD_BUFSZ;
-	 kbdp->buf[o]= scode;
-	 kbdp->avail++;
-	 if (kbdp->req_size)
-		notify(kbdp->incaller);
-	 if (kbdp->select_ops & SEL_RD)
-		notify(kbdp->select_proc);
-	 return;
-  }
-
-  /* Store the scancode in memory so the task can get at it later. */
-  if (icount < KB_IN_BYTES) {
-	*ihead++ = scode;
-	if (ihead == ibuf + KB_IN_BYTES) ihead = ibuf;
-	icount++;
-	tty_table[ccurrent].tty_events = 1;
-	if (tty_table[ccurrent].tty_select_ops & SEL_RD) {
-		select_retry(&tty_table[ccurrent]);
-	}
-  }
-}
-
-/*===========================================================================*
- *				kb_read					     *
- *===========================================================================*/
-PRIVATE int kb_read(tp, try)
-tty_t *tp;
-int try;
-{
-/* Process characters from the circular keyboard buffer. */
-  char buf[3];
-  int scode;
-  unsigned ch;
-
-  tp = &tty_table[ccurrent];		/* always use the current console */
-
-  if (try) {
-  	if (icount > 0) return 1;
-  	return 0;
-  }
-
-  while (icount > 0) {
-	scode = *itail++;			/* take one key scan code */
-	if (itail == ibuf + KB_IN_BYTES) itail = ibuf;
-	icount--;
-
-	/* Function keys are being used for debug dumps. */
-	if (func_key(scode)) continue;
-
-	/* Perform make/break processing. */
-	ch = make_break(scode);
-
-	if (ch <= 0xFF) {
-		/* A normal character. */
-		buf[0] = ch;
-		(void) in_process(tp, buf, 1);
-	} else
-	if (HOME <= ch && ch <= INSRT) {
-		/* An ASCII escape sequence generated by the numeric pad. */
-		buf[0] = ESC;
-		buf[1] = '[';
-		buf[2] = numpad_map[ch - HOME];
-		(void) in_process(tp, buf, 3);
-	} else
-	if (ch == ALEFT) {
-		/* Choose lower numbered console as current console. */
-		select_console(ccurrent - 1);
-		set_leds();
-	} else
-	if (ch == ARIGHT) {
-		/* Choose higher numbered console as current console. */
-		select_console(ccurrent + 1);
-		set_leds();
-	} else
-	if (AF1 <= ch && ch <= AF12) {
-		/* Alt-F1 is console, Alt-F2 is ttyc1, etc. */
-		select_console(ch - AF1);
-		set_leds();
-	} else
-	if (CF1 <= ch && ch <= CF12) {
-	    switch(ch) {
-  		case CF1: show_key_mappings(); break; 
-  		case CF3: toggle_scroll(); break; /* hardware <-> software */	
-  		case CF7: sigchar(&tty_table[CONSOLE], SIGQUIT); break;
-  		case CF8: sigchar(&tty_table[CONSOLE], SIGINT); break;
-  		case CF9: sigchar(&tty_table[CONSOLE], SIGKILL); break;
-  	    }
-	}
-  }
-
-  return 1;
-}
-
-/*===========================================================================*
- *				kbd_send				     *
- *===========================================================================*/
-PRIVATE void kbd_send()
-{
-	unsigned long sb;
-	int r;
-	clock_t now;
-
-	if (!kbdout.avail)
-		return;
-	if (kbdout.expect_ack)
-		return;
-
-	sys_inb(KB_STATUS, &sb);
-	if (sb & (KB_OUT_FULL|KB_IN_FULL))
-	{
-		printf("not sending 1: sb = 0x%x\n", sb);
-		return;
-	}
-	micro_delay(KBC_IN_DELAY);
-	sys_inb(KB_STATUS, &sb);
-	if (sb & (KB_OUT_FULL|KB_IN_FULL))
-	{
-		printf("not sending 2: sb = 0x%x\n", sb);
-		return;
-	}
-
-	/* Okay, buffer is really empty */
-#if 0
-	printf("sending byte 0x%x to keyboard\n", kbdout.buf[kbdout.offset]);
-#endif
-	sys_outb(KEYBD, kbdout.buf[kbdout.offset]);
-	kbdout.offset++;
-	kbdout.avail--;
-	kbdout.expect_ack= 1;
-
-	kbd_alive= 1;
-	if (kbd_watchdog_set)
-	{
-		/* Add a timer to the timers list. Possibly reschedule the
-		 * alarm.
-		 */
-		if ((r= getuptime(&now)) != OK)
-			panic("TTY","Keyboard couldn't get clock's uptime.", r);
-		tmrs_settimer(&tty_timers, &tmr_kbd_wd, now+HZ, kbd_watchdog,
-			NULL);
-		if (tty_timers->tmr_exp_time != tty_next_timeout) {
-			tty_next_timeout = tty_timers->tmr_exp_time;
-			if ((r= sys_setalarm(tty_next_timeout, 1)) != OK)
-				panic("TTY","Keyboard couldn't set alarm.", r);
-		}
-		kbd_watchdog_set= 1;
-	 }
-}
-
-/*===========================================================================*
- *				make_break				     *
- *===========================================================================*/
-PRIVATE unsigned make_break(scode)
-int scode;			/* scan code of key just struck or released */
-{
-/* This routine can handle keyboards that interrupt only on key depression,
- * as well as keyboards that interrupt on key depression and key release.
- * For efficiency, the interrupt routine filters out most key releases.
- */
-  int ch, make, escape;
-  static int CAD_count = 0;
-
-  /* Check for CTRL-ALT-DEL, and if found, halt the computer. This would
-   * be better done in keyboard() in case TTY is hung, except control and
-   * alt are set in the high level code.
-   */
-  if (ctrl && alt && (scode == DEL_SCAN || scode == INS_SCAN))
-  {
-	if (++CAD_count == 3) sys_abort(RBT_HALT);
-	sys_kill(INIT_PROC_NR, SIGABRT);
-	return -1;
-  }
-
-  /* High-order bit set on key release. */
-  make = (scode & KEY_RELEASE) == 0;		/* true if pressed */
-
-  ch = map_key(scode &= ASCII_MASK);		/* map to ASCII */
-
-  escape = esc;		/* Key is escaped?  (true if added since the XT) */
-  esc = 0;
-
-  switch (ch) {
-  	case CTRL:		/* Left or right control key */
-		*(escape ? &ctrl_r : &ctrl_l) = make;
-		ctrl = ctrl_l | ctrl_r;
-		break;
-  	case SHIFT:		/* Left or right shift key */
-		*(scode == RSHIFT_SCAN ? &shift_r : &shift_l) = make;
-		shift = shift_l | shift_r;
-		break;
-  	case ALT:		/* Left or right alt key */
-		*(escape ? &alt_r : &alt_l) = make;
-		alt = alt_l | alt_r;
-		break;
-  	case CALOCK:		/* Caps lock - toggle on 0 -> 1 transition */
-		if (caps_down < make) {
-			locks[ccurrent] ^= CAPS_LOCK;
-			set_leds();
-		}
-		caps_down = make;
-		break;
-  	case NLOCK:		/* Num lock */
-		if (num_down < make) {
-			locks[ccurrent] ^= NUM_LOCK;
-			set_leds();
-		}
-		num_down = make;
-		break;
-  	case SLOCK:		/* Scroll lock */
-		if (scroll_down < make) {
-			locks[ccurrent] ^= SCROLL_LOCK;
-			set_leds();
-		}
-		scroll_down = make;
-		break;
-  	case EXTKEY:		/* Escape keycode */
-		esc = 1;		/* Next key is escaped */
-		return(-1);
-  	default:		/* A normal key */
-		if (make) return(ch);
-  }
-
-  /* Key release, or a shift type key. */
-  return(-1);
-}
-
-/*===========================================================================*
- *				set_leds				     *
- *===========================================================================*/
-PRIVATE void set_leds()
-{
-/* Set the LEDs on the caps, num, and scroll lock keys */
-  int s;
-  if (! machine.pc_at) return;	/* PC/XT doesn't have LEDs */
-
-  kb_wait();			/* wait for buffer empty  */
-  if ((s=sys_outb(KEYBD, LED_CODE)) != OK)
-      printf("Warning, sys_outb couldn't prepare for LED values: %d\n", s);
-   				/* prepare keyboard to accept LED values */
-  kb_ack();			/* wait for ack response  */
-
-  kb_wait();			/* wait for buffer empty  */
-  if ((s=sys_outb(KEYBD, locks[ccurrent])) != OK)
-      printf("Warning, sys_outb couldn't give LED values: %d\n", s);
-				/* give keyboard LED values */
-  kb_ack();			/* wait for ack response  */
-}
-
-/*===========================================================================*
- *				kbc_cmd0				     *
- *===========================================================================*/
-PRIVATE void kbc_cmd0(cmd)
-int cmd;
-{
-	kb_wait();
-	sys_outb(KB_COMMAND, cmd);
-}
-
-/*===========================================================================*
- *				kbc_cmd1				     *
- *===========================================================================*/
-PRIVATE void kbc_cmd1(cmd, data)
-int cmd;
-int data;
-{
-	kb_wait();
-	sys_outb(KB_COMMAND, cmd);
-	kb_wait();
-	sys_outb(KEYBD, data);
-}
-
-
-/*===========================================================================*
-*                              kbc_read                                     *
-*===========================================================================*/
-PRIVATE int kbc_read()
-{
-	int i;
-	unsigned long byte, st;
-#if 0
-	struct micro_state ms;
-#endif
-
-#if DEBUG
-	printf("in kbc_read\n");
-#endif
-
-	/* Wait at most 1 second for a byte from the keyboard or
-	* the kbd controller, return -1 on a timeout.
-	*/
-	for (i= 0; i<1000; i++)
- #if 0
-	micro_start(&ms);
-	do
-#endif
-	{
-		sys_inb(KB_STATUS, &st);
-		if (st & KB_OUT_FULL)
-		{
-			micro_delay(KBC_IN_DELAY);
-			sys_inb(KEYBD, &byte);
-			if (st & KB_AUX_BYTE)
-			{
-#if DEBUG
-				printf(
-		"keyboard`kbc_read: ignoring byte (0x%x) from aux device.\n",
-					byte);
-#endif
-				continue;
-			}
-#if DEBUG
-			printf("keyboard`kbc_read: returning byte 0x%x\n",
-				byte);
-#endif
-			return byte;
-		}
-	}
-#if 0
-	while (micro_elapsed(&ms) < 1000000);
-#endif
-	panic("TTY", "kbc_read failed to complete", NO_NUM);
-}
-
-
-
-/*===========================================================================*
- *				kb_wait					     *
- *===========================================================================*/
-PRIVATE int kb_wait()
-{
-/* Wait until the controller is ready; return zero if this times out. */
-
-  int retries;
-  unsigned long status, temp;
-  int s, isaux;
-  unsigned char byte;
-
-  retries = MAX_KB_BUSY_RETRIES + 1;	/* wait until not busy */
-  do {
-      s = sys_inb(KB_STATUS, &status);
-      if (status & KB_OUT_FULL) {
-	  if (scan_keyboard(&byte, &isaux))
-	  {
-#if 0
-		  printf("ignoring %sbyte in kb_wait\n", isaux ? "AUX " : "");
-#endif
-	  }
-      }
-      if (! (status & (KB_IN_FULL|KB_OUT_FULL)) )
-          break;			/* wait until ready */
-  } while (--retries != 0);		/* continue unless timeout */ 
-  return(retries);		/* zero on timeout, positive if ready */
-}
-
-/*===========================================================================*
- *				kb_ack					     *
- *===========================================================================*/
-PRIVATE int kb_ack()
-{
-/* Wait until kbd acknowledges last command; return zero if this times out. */
-
-  int retries, s;
-  unsigned long u8val;
-
-
-  retries = MAX_KB_ACK_RETRIES + 1;
-  do {
-      s = sys_inb(KEYBD, &u8val);
-      if (u8val == KB_ACK)	
-          break;		/* wait for ack */
-  } while(--retries != 0);	/* continue unless timeout */
-
-  return(retries);		/* nonzero if ack received */
-}
-
-/*===========================================================================*
- *				kb_init					     *
- *===========================================================================*/
-PUBLIC void kb_init(tp)
-tty_t *tp;
-{
-/* Initialize the keyboard driver. */
-
-  tp->tty_devread = kb_read;	/* input function */
-}
-
-/*===========================================================================*
- *				kb_init_once				     *
- *===========================================================================*/
-PUBLIC void kb_init_once(void)
-{
-  int i;
-  u8_t ccb;
-
-  set_leds();			/* turn off numlock led */
-  scan_keyboard(NULL, NULL);	/* discard leftover keystroke */
-
-      /* Clear the function key observers array. Also see func_key(). */
-      for (i=0; i<12; i++) {
-          fkey_obs[i].proc_nr = NONE;	/* F1-F12 observers */
-          fkey_obs[i].events = 0;	/* F1-F12 observers */
-          sfkey_obs[i].proc_nr = NONE;	/* Shift F1-F12 observers */
-          sfkey_obs[i].events = 0;	/* Shift F1-F12 observers */
-      }
-
-      kbd.minor= KBD_MINOR;
-      kbdaux.minor= KBDAUX_MINOR;
-
-      /* Set interrupt handler and enable keyboard IRQ. */
-      irq_hook_id = KEYBOARD_IRQ;	/* id to be returned on interrupt */
-      if ((i=sys_irqsetpolicy(KEYBOARD_IRQ, IRQ_REENABLE, &irq_hook_id)) != OK)
-          panic("TTY",  "Couldn't set keyboard IRQ policy", i);
-      if ((i=sys_irqenable(&irq_hook_id)) != OK)
-          panic("TTY", "Couldn't enable keyboard IRQs", i);
-      kbd_irq_set |= (1 << KEYBOARD_IRQ);
-
-      /* Set AUX interrupt handler and enable AUX IRQ. */
-      aux_irq_hook_id = KBD_AUX_IRQ;	/* id to be returned on interrupt */
-      if ((i=sys_irqsetpolicy(KBD_AUX_IRQ, IRQ_REENABLE,
-		&aux_irq_hook_id)) != OK)
-          panic("TTY",  "Couldn't set AUX IRQ policy", i);
-      if ((i=sys_irqenable(&aux_irq_hook_id)) != OK)
-          panic("TTY", "Couldn't enable AUX IRQs", i);
-      kbd_irq_set |= (1 << KBD_AUX_IRQ);
-
-	/* Disable the keyboard and aux */
-	kbc_cmd0(KBC_DI_KBD);
-	kbc_cmd0(KBC_DI_AUX);
-
-	/* Get the current configuration byte */
-	kbc_cmd0(KBC_RD_RAM_CCB);
-	ccb= kbc_read();
-
-	/* Enable both interrupts. */
-	kbc_cmd1(KBC_WR_RAM_CCB, ccb | 3);
-
-	/* Re-enable the keyboard device. */
-	kbc_cmd0(KBC_EN_KBD);
-
-	/* Enable the aux device. */
-	kbc_cmd0(KBC_EN_AUX);
-}
-
-/*===========================================================================*
- *				kbd_loadmap				     *
- *===========================================================================*/
-PUBLIC int kbd_loadmap(m)
-message *m;
-{
-/* Load a new keymap. */
-  int result;
-  result = sys_vircopy(m->IO_ENDPT, D, (vir_bytes) m->ADDRESS,
-  	SELF, D, (vir_bytes) keymap, 
-  	(vir_bytes) sizeof(keymap));
-  return(result);
-}
-
-/*===========================================================================*
- *				do_fkey_ctl				     *
- *===========================================================================*/
-PUBLIC void do_fkey_ctl(m_ptr)
-message *m_ptr;			/* pointer to the request message */
-{
-/* This procedure allows processes to register a function key to receive
- * notifications if it is pressed. At most one binding per key can exist.
- */
-  int i; 
-  int result;
-
-  switch (m_ptr->FKEY_REQUEST) {	/* see what we must do */
-  case FKEY_MAP:			/* request for new mapping */
-      result = OK;			/* assume everything will be ok*/
-      for (i=0; i < 12; i++) {		/* check F1-F12 keys */
-          if (bit_isset(m_ptr->FKEY_FKEYS, i+1) ) {
-#if DEAD_CODE
-	/* Currently, we don't check if the slot is in use, so that IS
-	 * can recover after a crash by overtaking its existing mappings.
-	 * In future, a better solution will be implemented.
-	 */
-              if (fkey_obs[i].proc_nr == NONE) { 
-#endif
-    	          fkey_obs[i].proc_nr = m_ptr->m_source;
-    	          fkey_obs[i].events = 0;
-    	          bit_unset(m_ptr->FKEY_FKEYS, i+1);
-#if DEAD_CODE
-    	      } else {
-    	          printf("WARNING, fkey_map failed F%d\n", i+1);
-    	          result = EBUSY;	/* report failure, but try rest */
-    	      }
-#endif
-    	  }
-      }
-      for (i=0; i < 12; i++) {		/* check Shift+F1-F12 keys */
-          if (bit_isset(m_ptr->FKEY_SFKEYS, i+1) ) {
-#if DEAD_CODE
-              if (sfkey_obs[i].proc_nr == NONE) { 
-#endif
-    	          sfkey_obs[i].proc_nr = m_ptr->m_source;
-    	          sfkey_obs[i].events = 0;
-    	          bit_unset(m_ptr->FKEY_SFKEYS, i+1);
-#if DEAD_CODE
-    	      } else {
-    	          printf("WARNING, fkey_map failed Shift F%d\n", i+1);
-    	          result = EBUSY;	/* report failure but try rest */
-    	      }
-#endif
-    	  }
-      }
-      break;
-  case FKEY_UNMAP:
-      result = OK;			/* assume everything will be ok*/
-      for (i=0; i < 12; i++) {		/* check F1-F12 keys */
-          if (bit_isset(m_ptr->FKEY_FKEYS, i+1) ) {
-              if (fkey_obs[i].proc_nr == m_ptr->m_source) { 
-    	          fkey_obs[i].proc_nr = NONE;
-    	          fkey_obs[i].events = 0;
-    	          bit_unset(m_ptr->FKEY_FKEYS, i+1);
-    	      } else {
-    	          result = EPERM;	/* report failure, but try rest */
-    	      }
-    	  }
-      }
-      for (i=0; i < 12; i++) {		/* check Shift+F1-F12 keys */
-          if (bit_isset(m_ptr->FKEY_SFKEYS, i+1) ) {
-              if (sfkey_obs[i].proc_nr == m_ptr->m_source) { 
-    	          sfkey_obs[i].proc_nr = NONE;
-    	          sfkey_obs[i].events = 0;
-    	          bit_unset(m_ptr->FKEY_SFKEYS, i+1);
-    	      } else {
-    	          result = EPERM;	/* report failure, but try rest */
-    	      }
-    	  }
-      }
-      break;
-  case FKEY_EVENTS:
-      m_ptr->FKEY_FKEYS = m_ptr->FKEY_SFKEYS = 0;
-      for (i=0; i < 12; i++) {		/* check (Shift+) F1-F12 keys */
-          if (fkey_obs[i].proc_nr == m_ptr->m_source) {
-              if (fkey_obs[i].events) { 
-                  bit_set(m_ptr->FKEY_FKEYS, i+1);
-                  fkey_obs[i].events = 0;
-              }
-          }
-          if (sfkey_obs[i].proc_nr == m_ptr->m_source) {
-              if (sfkey_obs[i].events) { 
-                  bit_set(m_ptr->FKEY_SFKEYS, i+1);
-                  sfkey_obs[i].events = 0;
-              }
-          }
-      }
-      break;
-  default:
-          result =  EINVAL;		/* key cannot be observed */
-  }
-
-  /* Almost done, return result to caller. */
-  m_ptr->m_type = result;
-  send(m_ptr->m_source, m_ptr);
-}
-
-/*===========================================================================*
- *				func_key				     *
- *===========================================================================*/
-PRIVATE int func_key(scode)
-int scode;			/* scan code for a function key */
-{
-/* This procedure traps function keys for debugging purposes. Observers of 
- * function keys are kept in a global array. If a subject (a key) is pressed
- * the observer is notified of the event. Initialization of the arrays is done
- * in kb_init, where NONE is set to indicate there is no interest in the key.
- * Returns FALSE on a key release or if the key is not observable.
- */
-  message m;
-  int key;
-  int proc_nr;
-  int i,s;
-
-  /* Ignore key releases. If this is a key press, get full key code. */
-  if (scode & KEY_RELEASE) return(FALSE);	/* key release */
-  key = map_key(scode);		 		/* include modifiers */
-
-  /* Key pressed, now see if there is an observer for the pressed key.
-   *	       F1-F12	observers are in fkey_obs array. 
-   *	SHIFT  F1-F12	observers are in sfkey_req array. 
-   *	CTRL   F1-F12	reserved (see kb_read)
-   *	ALT    F1-F12	reserved (see kb_read)
-   * Other combinations are not in use. Note that Alt+Shift+F1-F12 is yet
-   * defined in <minix/keymap.h>, and thus is easy for future extensions.
-   */
-  if (F1 <= key && key <= F12) {		/* F1-F12 */
-      proc_nr = fkey_obs[key - F1].proc_nr;	
-      fkey_obs[key - F1].events ++ ;	
-  } else if (SF1 <= key && key <= SF12) {	/* Shift F2-F12 */
-      proc_nr = sfkey_obs[key - SF1].proc_nr;	
-      sfkey_obs[key - SF1].events ++;	
-  }
-  else {
-      return(FALSE);				/* not observable */
-  }
-
-  /* See if an observer is registered and send it a message. */
-  if (proc_nr != NONE) { 
-      m.NOTIFY_TYPE = FKEY_PRESSED;
-      notify(proc_nr);
-  }
-  return(TRUE);
-}
-
-/*===========================================================================*
- *				show_key_mappings			     *
- *===========================================================================*/
-PRIVATE void show_key_mappings()
-{
-    int i,s;
-    struct proc proc;
-
-    printf("\n");
-    printf("System information.   Known function key mappings to request debug dumps:\n");
-    printf("-------------------------------------------------------------------------\n");
-    for (i=0; i<12; i++) {
-
-      printf(" %sF%d: ", i+1<10? " ":"", i+1);
-      if (fkey_obs[i].proc_nr != NONE) {
-          if ((s=sys_getproc(&proc, fkey_obs[i].proc_nr))!=OK)
-              printf("sys_getproc: %d\n", s);
-          printf("%-14.14s", proc.p_name);
-      } else {
-          printf("%-14.14s", "<none>");
-      }
-
-      printf("    %sShift-F%d: ", i+1<10? " ":"", i+1);
-      if (sfkey_obs[i].proc_nr != NONE) {
-          if ((s=sys_getproc(&proc, sfkey_obs[i].proc_nr))!=OK)
-              printf("sys_getproc: %d\n", s);
-          printf("%-14.14s", proc.p_name);
-      } else {
-          printf("%-14.14s", "<none>");
-      }
-      printf("\n");
-    }
-    printf("\n");
-    printf("Press one of the registered function keys to trigger a debug dump.\n");
-    printf("\n");
-}
-
-/*===========================================================================*
- *				scan_keyboard				     *
- *===========================================================================*/
-PRIVATE int scan_keyboard(bp, isauxp)
-unsigned char *bp;
-int *isauxp;
-{
-#if 0	/* Is this old XT code? It doesn't match the PS/2 hardware */
-/* Fetch the character from the keyboard hardware and acknowledge it. */
-  pvb_pair_t byte_in[2], byte_out[2];
-  
-  byte_in[0].port = KEYBD;	/* get the scan code for the key struck */
-  byte_in[1].port = PORT_B;	/* strobe the keyboard to ack the char */
-  sys_vinb(byte_in, 2);		/* request actual input */
-
-  pv_set(byte_out[0], PORT_B, byte_in[1].value | KBIT); /* strobe bit high */
-  pv_set(byte_out[1], PORT_B, byte_in[1].value);	/* then strobe low */
-  sys_voutb(byte_out, 2);	/* request actual output */
-
-  return(byte_in[0].value);		/* return scan code */
-#else
-  unsigned long b, sb;
-
-  sys_inb(KB_STATUS, &sb);
-  if (!(sb & KB_OUT_FULL))
-  {
-	if (kbdout.avail && !kbdout.expect_ack)
-		kbd_send();
-	return 0;
-  }
-  sys_inb(KEYBD, &b);
-#if 0
-  printf("got byte 0x%x from %s\n", b, (sb & KB_AUX_BYTE) ? "AUX" : "keyboard");
-#endif
-  if (!(sb & KB_AUX_BYTE) && b == KB_ACK && kbdout.expect_ack)
-  {
-#if 1
-	printf("got ACK from keyboard\n");
-#endif
-	kbdout.expect_ack= 0;
-	micro_delay(KBC_IN_DELAY);
-	kbd_send();
-	return 0;
-  }
-  if (bp)
-  	*bp= b;
-  if (isauxp)
-  	*isauxp= !!(sb & KB_AUX_BYTE);
-  if (kbdout.avail && !kbdout.expect_ack)
-  {
-	micro_delay(KBC_IN_DELAY);
-	kbd_send();
-  }
-  return 1;
-#endif
-}
-
-static void micro_delay(unsigned long usecs)
-{
-	tickdelay(MICROS_TO_TICKS(usecs));
-}
-
-/*===========================================================================*
- *				kbd_watchdog 				     *
- *===========================================================================*/
-PRIVATE void kbd_watchdog(tmrp)
-timer_t *tmrp;
-{
-	int r;
-	clock_t now;
-
-	kbd_watchdog_set= 0;
-	if (!kbdout.avail)
-		return;	/* Watchdog is no longer needed */
-	if (!kbd_alive)
-	{
-		printf("kbd_watchdog: should reset keyboard\n");
-	}
-	kbd_alive= 0;
-
-	if ((r= getuptime(&now)) != OK)
-		panic("TTY","Keyboard couldn't get clock's uptime.", r);
-	tmrs_settimer(&tty_timers, &tmr_kbd_wd, now+HZ, kbd_watchdog,
-		NULL);
-	if (tty_timers->tmr_exp_time != tty_next_timeout) {
-		tty_next_timeout = tty_timers->tmr_exp_time;
-		if ((r= sys_setalarm(tty_next_timeout, 1)) != OK)
-			panic("TTY","Keyboard couldn't set alarm.", r);
-	}
-	kbd_watchdog_set= 1;
-}
Index: trunk/minix/drivers/tty/keymaps/Makefile
===================================================================
--- trunk/minix/drivers/tty/keymaps/Makefile	(revision 9)
+++ 	(revision )
@@ -1,86 +1,0 @@
-# Generate binary keymaps.
-
-LK =	/usr/lib/keymaps
-
-.SUFFIXES:	.src .map
-
-.src.map:
-	$(CC) -DKEYSRC=\"$<\" genmap.c
-	./a.out > $@
-	@rm -f a.out
-
-all:	\
-	dvorak.map \
-	french.map \
-	german.map \
-	italian.map \
-	japanese.map \
-	latin-america.map \
-	olivetti.map \
-	polish.map \
-	scandinavian.map \
-	spanish.map \
-	uk.map \
-	us-std.map \
-	us-swap.map \
-
-install:	\
-	$(LK) \
-	$(LK)/dvorak.map \
-	$(LK)/french.map \
-	$(LK)/german.map \
-	$(LK)/italian.map \
-	$(LK)/japanese.map \
-	$(LK)/latin-america.map \
-	$(LK)/olivetti.map \
-	$(LK)/polish.map \
-	$(LK)/scandinavian.map \
-	$(LK)/spanish.map \
-	$(LK)/uk.map \
-	$(LK)/us-std.map \
-	$(LK)/us-swap.map \
-
-clean:
-	rm -f a.out *.map
-
-$(LK):
-	install -d $@
-
-$(LK)/dvorak.map:	dvorak.map
-	install -c $? $@
-
-$(LK)/french.map:	french.map
-	install -c $? $@
-
-$(LK)/german.map:	german.map
-	install -c $? $@
-
-$(LK)/italian.map:	italian.map
-	install -c $? $@
-
-$(LK)/japanese.map:	japanese.map
-	install -c $? $@
-
-$(LK)/latin-america.map:	latin-america.map
-	install -c $? $@
-
-$(LK)/olivetti.map:	olivetti.map
-	install -c $? $@
-
-$(LK)/polish.map:	polish.map
-	install -c $? $@
-
-$(LK)/scandinavian.map:	scandinavian.map
-	install -c $? $@
-
-$(LK)/spanish.map:	spanish.map
-	install -c $? $@
-
-$(LK)/uk.map:	uk.map
-	install -c $? $@
-
-$(LK)/us-std.map:	us-std.map
-	install -c $? $@
-
-$(LK)/us-swap.map:	us-swap.map
-	install -c $? $@
Index: trunk/minix/drivers/tty/keymaps/dvorak.src
===================================================================
--- trunk/minix/drivers/tty/keymaps/dvorak.src	(revision 9)
+++ 	(revision )
@@ -1,139 +1,0 @@
-
-/* Keymap for Dvorak keyboard. 
- * Contributed by: Ulrich Hobelmann <u.hobelmann@web.de>
- */
-
-u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
-
-/* scan-code		!Shift	Shift	Alt1	Alt2	Alt+Sh	Ctrl	*/
-/* ==================================================================== */
-/* 00 - none	*/	0,	0,	0,	0,	0,	0,	
-/* 01 - ESC	*/	C('['),	C('['),	CA('['),CA('['),CA('['),C('['),
-/* 02 - '1'	*/	'1',	'!',	A('1'),	A('1'),	A('!'),	C('A'),
-/* 03 - '2'	*/	'2',	'@',	A('2'),	A('2'),	A('@'),	C('@'),
-/* 04 - '3'	*/	'3',	'#',	A('3'),	A('3'),	A('#'),	C('C'),
-/* 05 - '4'	*/	'4',	'$',	A('4'),	A('4'),	A('$'),	C('D'),
-/* 06 - '5'	*/	'5',	'%',	A('5'),	A('5'),	A('%'),	C('E'),
-/* 07 - '6'	*/	'6',	'^',	A('6'),	A('6'),	A('^'),	C('^'),
-/* 08 - '7'	*/	'7',	'&',	A('7'),	A('7'),	A('&'),	C('G'),
-/* 09 - '8'	*/	'8',	'*',	A('8'),	A('8'),	A('*'),	C('H'),
-/* 10 - '9'	*/	'9',	'(',	A('9'),	A('9'),	A('('),	C('I'),
-/* 11 - '0'	*/	'0',	')',	A('0'),	A('0'),	A(')'),	C('@'),
-/* 12 - '-'	*/	'[',	'{',	A('['),	A('['),	A('}'),	C(']'),
-/* 13 - '='	*/	']',	'}',	A(']'),	A(']'),	A('}'),	C(']'),
-/* 14 - BS	*/	C('H'),	C('H'),	CA('H'),CA('H'),CA('H'),0177,	
-/* 15 - TAB	*/	C('I'),	C('I'),	CA('I'),CA('I'),CA('I'),C('I'),
-/* 16 - 'q'	*/	'\'',	'"',	A('\''),A('\''),A('"'),	C('@'),
-/* 17 - 'w'	*/	',',	'<',	A(','),	A(','),	A('<'),	C('@'),
-/* 18 - 'e'	*/	'.',	'>',	A('.'),	A('.'),	A('>'),	C('@'),
-/* 19 - 'r'	*/	L('p'),	'P',	A('p'),	A('p'),	A('P'),	C('P'),
-/* 20 - 't'	*/	L('y'),	'Y',	A('y'),	A('y'),	A('Y'),	C('Y'),
-/* 21 - 'y'	*/	L('f'),	'F',	A('f'),	A('f'),	A('F'),	C('F'),
-/* 22 - 'u'	*/	L('g'),	'G',	A('g'),	A('g'),	A('G'),	C('G'),
-/* 23 - 'i'	*/	L('c'),	'C',	A('c'),	A('c'),	A('C'),	C('C'),
-/* 24 - 'o'	*/	L('r'),	'R',	A('r'),	A('r'),	A('R'),	C('R'),
-/* 25 - 'p'	*/	L('l'),	'L',	A('l'),	A('l'),	A('L'),	C('L'),
-/* 26 - '['	*/	'/',	'?',	A('/'),	A('/'),	A('?'),	C('@'),
-/* 27 - ']'	*/	'=',	'+',	A('='),	A('='),	A('+'),	C('@'),
-/* 28 - CR/LF	*/	C('M'),	C('M'),	CA('M'),CA('M'),CA('M'),C('J'),
-/* 29 - Ctrl	*/	CTRL,	CTRL,	CTRL,	CTRL,	CTRL,	CTRL,
-/* 30 - 'a'	*/	L('a'),	'A',	A('a'),	A('a'),	A('A'),	C('A'),
-/* 31 - 's'	*/	L('o'),	'O',	A('o'),	A('o'),	A('O'),	C('O'),
-/* 32 - 'd'	*/	L('e'),	'E',	A('e'),	A('e'),	A('E'),	C('E'),
-/* 33 - 'f'	*/	L('u'),	'U',	A('u'),	A('u'),	A('U'),	C('U'),
-/* 34 - 'g'	*/	L('i'),	'I',	A('i'),	A('i'),	A('I'),	C('I'),
-/* 35 - 'h'	*/	L('d'),	'D',	A('d'),	A('d'),	A('D'),	C('D'),
-/* 36 - 'j'	*/	L('h'),	'H',	A('h'),	A('h'),	A('H'),	C('H'),
-/* 37 - 'k'	*/	L('t'),	'T',	A('t'),	A('t'),	A('T'),	C('T'),
-/* 38 - 'l'	*/	L('n'),	'N',	A('n'),	A('n'),	A('N'),	C('N'),
-/* 39 - ';'	*/	L('s'),	'S',	A('s'),	A('s'),	A('S'),	C('S'),
-/* 40 - '\''	*/	'-',	'_',	A('-'),	A('-'),	A('_'),	C('_'),
-/* 41 - '`'	*/	'`',	'~',	A('`'),	A('`'),	A('~'),	C('@'),
-/* 42 - l. SHIFT*/	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,
-/* 43 - '\\'	*/	'\\',	'|',	A('\\'),A('\\'),A('|'),	C('\\'),
-/* 44 - 'z'	*/	';',	':',	A(';'),	A(';'),	A(':'),	C('@'),
-/* 45 - 'x'	*/	L('q'),	'Q',	A('q'),	A('q'),	A('Q'),	C('Q'),
-/* 46 - 'c'	*/	L('j'),	'J',	A('j'),	A('j'),	A('J'),	C('J'),
-/* 47 - 'v'	*/	L('k'),	'K',	A('k'),	A('k'),	A('K'),	C('K'),
-/* 48 - 'b'	*/	L('x'),	'X',	A('x'),	A('x'),	A('X'),	C('X'),
-/* 49 - 'n'	*/	L('b'),	'B',	A('b'),	A('b'),	A('B'),	C('B'),
-/* 50 - 'm'	*/	L('m'),	'M',	A('m'),	A('m'),	A('M'),	C('M'),
-/* 51 - ','	*/	L('w'),	'W',	A('w'),	A('w'),	A('W'),	C('W'),
-/* 52 - '.'	*/	L('v'),	'V',	A('v'),	A('v'),	A('V'),	C('V'),
-/* 53 - '/'	*/	L('z'),	'Z',	A('z'),	A('z'),	A('Z'),	C('Z'),
-/* 54 - r. SHIFT*/	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,
-/* 55 - '*'	*/	'*',	'*',	A('*'),	A('*'),	A('*'),	C('@'),
-/* 56 - ALT	*/	ALT,	ALT,	ALT,	ALT,	ALT,	ALT,
-/* 57 - ' '	*/	' ',	' ',	A(' '),	A(' '),	A(' '),	C('@'),
-/* 58 - CapsLck	*/	CALOCK,	CALOCK,	CALOCK,	CALOCK,	CALOCK,	CALOCK,
-/* 59 - F1	*/	F1,	SF1,	AF1,	AF1,	ASF1,	CF1,
-/* 60 - F2	*/	F2,	SF2,	AF2,	AF2,	ASF2,	CF2,
-/* 61 - F3	*/	F3,	SF3,	AF3,	AF3,	ASF3,	CF3,
-/* 62 - F4	*/	F4,	SF4,	AF4,	AF4,	ASF4,	CF4,
-/* 63 - F5	*/	F5,	SF5,	AF5,	AF5,	ASF5,	CF5,
-/* 64 - F6	*/	F6,	SF6,	AF6,	AF6,	ASF6,	CF6,
-/* 65 - F7	*/	F7,	SF7,	AF7,	AF7,	ASF7,	CF7,
-/* 66 - F8	*/	F8,	SF8,	AF8,	AF8,	ASF8,	CF8,
-/* 67 - F9	*/	F9,	SF9,	AF9,	AF9,	ASF9,	CF9,
-/* 68 - F10	*/	F10,	SF10,	AF10,	AF10,	ASF10,	CF10,
-/* 69 - NumLock	*/	NLOCK,	NLOCK,	NLOCK,	NLOCK,	NLOCK,	NLOCK,
-/* 70 - ScrLock */	SLOCK,	SLOCK,	SLOCK,	SLOCK,	SLOCK,	SLOCK,
-/* 71 - Home	*/	HOME,	'7',	AHOME,	AHOME,	A('7'),	CHOME,	
-/* 72 - CurUp	*/	UP,	'8',	AUP,	AUP,	A('8'),	CUP,
-/* 73 - PgUp	*/	PGUP,	'9',	APGUP,	APGUP,	A('9'),	CPGUP,
-/* 74 - '-'	*/	NMIN,	'-',	ANMIN,	ANMIN,	A('-'),	CNMIN,
-/* 75 - Left	*/	LEFT,	'4',	ALEFT,	ALEFT,	A('4'),	CLEFT,
-/* 76 - MID	*/	MID,	'5',	AMID,	AMID,	A('5'),	CMID,
-/* 77 - Right	*/	RIGHT,	'6',	ARIGHT,	ARIGHT,	A('6'),	CRIGHT,
-/* 78 - '+'	*/	PLUS,	'+',	APLUS,	APLUS,	A('+'),	CPLUS,
-/* 79 - End	*/	END,	'1',	AEND,	AEND,	A('1'),	CEND,
-/* 80 - Down	*/	DOWN,	'2',	ADOWN,	ADOWN,	A('2'),	CDOWN,
-/* 81 - PgDown	*/	PGDN,	'3',	APGDN,	APGDN,	A('3'),	CPGDN,
-/* 82 - Insert	*/	INSRT,	'0',	AINSRT,	AINSRT,	A('0'),	CINSRT,
-/* 83 - Delete	*/	0177,	'.',	A(0177),A(0177),A('.'),	0177,
-/* 84 - Enter	*/	C('M'),	C('M'),	CA('M'),CA('M'),CA('M'),C('J'),
-/* 85 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 86 - ???	*/	'<',	'>',	A('<'),	A('|'),	A('>'),	C('@'),
-/* 87 - F11	*/	F11,	SF11,	AF11,	AF11,	ASF11,	CF11,
-/* 88 - F12	*/	F12,	SF12,	AF12,	AF12,	ASF12,	CF12,
-/* 89 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 90 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 91 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 92 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 93 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 94 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 95 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 96 - EXT_KEY	*/	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,
-/* 97 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 98 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 99 - ???	*/	0,	0,	0,	0,	0,	0,
-/*100 - ???	*/	0,	0,	0,	0,	0,	0,
-/*101 - ???	*/	0,	0,	0,	0,	0,	0,
-/*102 - ???	*/	0,	0,	0,	0,	0,	0,
-/*103 - ???	*/	0,	0,	0,	0,	0,	0,
-/*104 - ???	*/	0,	0,	0,	0,	0,	0,
-/*105 - ???	*/	0,	0,	0,	0,	0,	0,
-/*106 - ???	*/	0,	0,	0,	0,	0,	0,
-/*107 - ???	*/	0,	0,	0,	0,	0,	0,
-/*108 - ???	*/	0,	0,	0,	0,	0,	0,
-/*109 - ???	*/	0,	0,	0,	0,	0,	0,
-/*110 - ???	*/	0,	0,	0,	0,	0,	0,
-/*111 - ???	*/	0,	0,	0,	0,	0,	0,
-/*112 - ???	*/	0,	0,	0,	0,	0,	0,
-/*113 - ???	*/	0,	0,	0,	0,	0,	0,
-/*114 - ???	*/	0,	0,	0,	0,	0,	0,
-/*115 - ???	*/	0,	0,	0,	0,	0,	0,
-/*116 - ???	*/	0,	0,	0,	0,	0,	0,
-/*117 - ???	*/	0,	0,	0,	0,	0,	0,
-/*118 - ???	*/	0,	0,	0,	0,	0,	0,
-/*119 - ???	*/	0,	0,	0,	0,	0,	0,
-/*120 - ???	*/	0,	0,	0,	0,	0,	0,
-/*121 - ???	*/	0,	0,	0,	0,	0,	0,
-/*122 - ???	*/	0,	0,	0,	0,	0,	0,
-/*123 - ???	*/	0,	0,	0,	0,	0,	0,
-/*124 - ???	*/	0,	0,	0,	0,	0,	0,
-/*125 - ???	*/	0,	0,	0,	0,	0,	0,
-/*126 - ???	*/	0,	0,	0,	0,	0,	0,
-/*127 - ???	*/	0,	0,	0,	0,	0,	0
-};
-
Index: trunk/minix/drivers/tty/keymaps/french.src
===================================================================
--- trunk/minix/drivers/tty/keymaps/french.src	(revision 9)
+++ 	(revision )
@@ -1,135 +1,0 @@
-/* Keymap for the French keyboard. */
-
-u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
-
-/* scan-code		!Shift	Shift	Alt	AltGr	Alt+Sh	Ctrl	*/
-/* ==================================================================== */
-/* 00 - none	*/	0,	0,	0,	0,	0,	0,	
-/* 01 - ESC	*/	C('['),	C('['),	CA('['),C('['),	C('['),	C('['),
-/* 02 - '1'	*/	'&',	'1',	A('1'),	'&',	'1',	C('A'),
-/* 03 - '2'     */      0202,   '2',    A('2'), '~',    '2',    C('B'),
-/* 04 - '3'     */      '"',    '3',    A('3'), '#',    '3',    C('C'),
-/* 05 - '4'     */      '\'',   '4',    A('4'), '{',    '4',    C('D'),
-/* 06 - '5'     */      '(',    '5',    A('5'), '[',    '5',    C('E'),
-/* 07 - '6'     */      '-',    '6',    A('6'), '|',    '6',    C('F'),
-/* 08 - '7'     */      0212,   '7',    A('7'), '`',    '7',    C('G'),
-/* 09 - '8'     */      '_',    '8',    A('8'), '\\',   '8',    C('H'),
-/* 10 - '9'     */      0207,   '9',    A('9'), '^',    '9',    C('I'),
-/* 11 - '0'     */      0205,   '0',    A('0'), '@',    '0',    C('J'),
-/* 12 - '-'     */      ')',    0370,   A(')'), ']',    '-',    C('K'),
-/* 13 - '='     */      '=',    '+',    A('='), '}',    '=',    C('L'),
-/* 14 - BS	*/	C('H'),	C('H'),	CA('H'),C('H'),	C('H'),	0177,	
-/* 15 - TAB	*/	C('I'),	C('I'),	CA('I'),C('I'),	C('I'),	C('I'),
-/* 16 - 'q'	*/	L('a'),	'A',	A('a'),	'a',	'Q',	C('A'),
-/* 17 - 'w'	*/	L('z'),	'Z',	A('z'),	'z',	'W',	C('Z'),
-/* 18 - 'e'	*/	L('e'),	'E',	A('e'),	'e',	'E',	C('E'),
-/* 19 - 'r'	*/	L('r'),	'R',	A('r'),	'r',	'R',	C('R'),
-/* 20 - 't'	*/	L('t'),	'T',	A('t'),	't',	'T',	C('T'),
-/* 21 - 'y'	*/	L('y'),	'Y',	A('y'),	'y',	'Y',	C('Y'),
-/* 22 - 'u'	*/	L('u'),	'U',	A('u'),	'u',	'U',	C('U'),
-/* 23 - 'i'	*/	L('i'),	'I',	A('i'),	'i',	'I',	C('I'),
-/* 24 - 'o'	*/	L('o'),	'O',	A('o'),	'o',	'O',	C('O'),
-/* 25 - 'p'	*/	L('p'),	'P',	A('p'),	'p',	'P',	C('P'),
-/* 26 - '['     */      '^',    '"',    A('^'), '^',    '[',    C('^'),
-/* 27 - ']'     */      '$',    0234,   A('$'), '$',    ']',    C('$'),
-/* 28 - CR/LF	*/	C('M'),	C('M'),	CA('M'),C('M'),	C('M'),	C('J'),
-/* 29 - Ctrl	*/	CTRL,	CTRL,	CTRL,	CTRL,	CTRL,	CTRL,
-/* 30 - 'a'	*/	L('q'),	'Q',	A('q'),	'q',	'A',	C('Q'),
-/* 31 - 's'	*/	L('s'),	'S',	A('s'),	's',	'S',	C('S'),
-/* 32 - 'd'	*/	L('d'),	'D',	A('d'),	'd',	'D',	C('D'),
-/* 33 - 'f'	*/	L('f'),	'F',	A('f'),	'f',	'F',	C('F'),
-/* 34 - 'g'	*/	L('g'),	'G',	A('g'),	'g',	'G',	C('G'),
-/* 35 - 'h'	*/	L('h'),	'H',	A('h'),	'h',	'H',	C('H'),
-/* 36 - 'j'	*/	L('j'),	'J',	A('j'),	'j',	'J',	C('J'),
-/* 37 - 'k'	*/	L('k'),	'K',	A('k'),	'k',	'K',	C('K'),
-/* 38 - 'l'	*/	L('l'),	'L',	A('l'),	'l',	'L',	C('L'),
-/* 39 - ';'	*/	L('m'),	'M',	A('m'),	'm',	'M',	C('M'),
-/* 40 - '\''    */      0227,   '%',    A('%'), 0227,   '\\',   C('G'),
-/* 41 - '`'     */      0375,   0375,   0375,   0375,   '`',    C('['),
-/* 42 - l. SHIFT*/	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,
-/* 43 - '`'     */      '*',    0346,   A('*'), '*',    '`',    C('*'),
-/* 44 - 'z'	*/	L('w'),	'W',	A('w'),	'w',	'Z',	C('W'),
-/* 45 - 'x'	*/	L('x'),	'X',	A('x'),	'x',	'X',	C('X'),
-/* 46 - 'c'	*/	L('c'),	'C',	A('c'),	'c',	'C',	C('C'),
-/* 47 - 'v'	*/	L('v'),	'V',	A('v'),	'v',	'V',	C('V'),
-/* 48 - 'b'	*/	L('b'),	'B',	A('b'),	'b',	'B',	C('B'),
-/* 49 - 'n'	*/	L('n'),	'N',	A('n'),	'n',	'N',	C('N'),
-/* 50 - 'm'     */      ',',    '?',    A(','), ',',    'm',    C('@'),
-/* 51 - ','     */      ';',    '.',    A(';'), ';',    ',',    C('@'),
-/* 52 - '.'     */      ':',    '/',    A(':'), ':',    '.',    C('@'),
-/* 53 - '/'     */      '!', '$'/*025*/,A('!'), '!',    '/',    C('@'),
-/* 54 - r. SHIFT*/	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,
-/* 55 - '*'	*/	'*',	'*',	A('*'),	'*',	'*',	C('@'),
-/* 56 - ALT	*/	ALT,	ALT,	ALT,	ALT,	ALT,	ALT,
-/* 57 - ' '	*/	' ',	' ',	A(' '),	' ',	' ',	C('@'),
-/* 58 - CapsLck	*/	CALOCK,	CALOCK,	CALOCK,	CALOCK,	CALOCK,	CALOCK,
-/* 59 - F1	*/	F1,	SF1,	AF1,	AF1,	ASF1,	CF1,
-/* 60 - F2	*/	F2,	SF2,	AF2,	AF2,	ASF2,	CF2,
-/* 61 - F3	*/	F3,	SF3,	AF3,	AF3,	ASF3,	CF3,
-/* 62 - F4	*/	F4,	SF4,	AF4,	AF4,	ASF4,	CF4,
-/* 63 - F5	*/	F5,	SF5,	AF5,	AF5,	ASF5,	CF5,
-/* 64 - F6	*/	F6,	SF6,	AF6,	AF6,	ASF6,	CF6,
-/* 65 - F7	*/	F7,	SF7,	AF7,	AF7,	ASF7,	CF7,
-/* 66 - F8	*/	F8,	SF8,	AF8,	AF8,	ASF8,	CF8,
-/* 67 - F9	*/	F9,	SF9,	AF9,	AF9,	ASF9,	CF9,
-/* 68 - F10	*/	F10,	SF10,	AF10,	AF10,	ASF10,	CF10,
-/* 69 - NumLock	*/	NLOCK,	NLOCK,	NLOCK,	NLOCK,	NLOCK,	NLOCK,
-/* 70 - ScrLock */	SLOCK,	SLOCK,	SLOCK,	SLOCK,	SLOCK,	SLOCK,
-/* 71 - Home	*/	HOME,	'7',	AHOME,	AHOME,	'7',	CHOME,	
-/* 72 - CurUp	*/	UP,	'8',	AUP,	AUP,	'8',	CUP,
-/* 73 - PgUp	*/	PGUP,	'9',	APGUP,	APGUP,	'9',	CPGUP,
-/* 74 - '-'	*/	NMIN,	'-',	ANMIN,	ANMIN,	'-',	CNMIN,
-/* 75 - Left	*/	LEFT,	'4',	ALEFT,	ALEFT,	'4',	CLEFT,
-/* 76 - MID	*/	MID,	'5',	AMID,	AMID,	'5',	CMID,
-/* 77 - Right	*/	RIGHT,	'6',	ARIGHT,	ARIGHT,	'6',	CRIGHT,
-/* 78 - '+'	*/	PLUS,	'+',	APLUS,	APLUS,	'+',	CPLUS,
-/* 79 - End	*/	END,	'1',	AEND,	AEND,	'1',	CEND,
-/* 80 - Down	*/	DOWN,	'2',	ADOWN,	ADOWN,	'2',	CDOWN,
-/* 81 - PgDown	*/	PGDN,	'3',	APGDN,	APGDN,	'3',	CPGDN,
-/* 82 - Insert	*/	INSRT,	'0',	AINSRT,	AINSRT,	'0',	CINSRT,
-/* 83 - Delete	*/	0177,	'.',	A(0177),0177,	'.',	0177,
-/* 84 - Enter	*/	C('M'),	C('M'),	CA('M'),C('M'),	C('M'),	C('J'),
-/* 85 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 86 - ???	*/	'<',	'>',	A('<'),	'<',	'>',	C('@'),
-/* 87 - F11	*/	F11,	SF11,	AF11,	AF11,	ASF11,	CF11,
-/* 88 - F12	*/	F12,	SF12,	AF12,	AF12,	ASF12,	CF12,
-/* 89 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 90 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 91 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 92 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 93 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 94 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 95 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 96 - EXT_KEY	*/	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,
-/* 97 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 98 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 99 - ???	*/	0,	0,	0,	0,	0,	0,
-/*100 - ???	*/	0,	0,	0,	0,	0,	0,
-/*101 - ???	*/	0,	0,	0,	0,	0,	0,
-/*102 - ???	*/	0,	0,	0,	0,	0,	0,
-/*103 - ???	*/	0,	0,	0,	0,	0,	0,
-/*104 - ???	*/	0,	0,	0,	0,	0,	0,
-/*105 - ???	*/	0,	0,	0,	0,	0,	0,
-/*106 - ???	*/	0,	0,	0,	0,	0,	0,
-/*107 - ???	*/	0,	0,	0,	0,	0,	0,
-/*108 - ???	*/	0,	0,	0,	0,	0,	0,
-/*109 - ???	*/	0,	0,	0,	0,	0,	0,
-/*110 - ???	*/	0,	0,	0,	0,	0,	0,
-/*111 - ???	*/	0,	0,	0,	0,	0,	0,
-/*112 - ???	*/	0,	0,	0,	0,	0,	0,
-/*113 - ???	*/	0,	0,	0,	0,	0,	0,
-/*114 - ???	*/	0,	0,	0,	0,	0,	0,
-/*115 - ???	*/	0,	0,	0,	0,	0,	0,
-/*116 - ???	*/	0,	0,	0,	0,	0,	0,
-/*117 - ???	*/	0,	0,	0,	0,	0,	0,
-/*118 - ???	*/	0,	0,	0,	0,	0,	0,
-/*119 - ???	*/	0,	0,	0,	0,	0,	0,
-/*120 - ???	*/	0,	0,	0,	0,	0,	0,
-/*121 - ???	*/	0,	0,	0,	0,	0,	0,
-/*122 - ???	*/	0,	0,	0,	0,	0,	0,
-/*123 - ???	*/	0,	0,	0,	0,	0,	0,
-/*124 - ???	*/	0,	0,	0,	0,	0,	0,
-/*125 - ???	*/	0,	0,	0,	0,	0,	0,
-/*126 - ???	*/	0,	0,	0,	0,	0,	0,
-/*127 - ???	*/	0,	0,	0,	0,	0,	0
-};
Index: trunk/minix/drivers/tty/keymaps/genmap.c
===================================================================
--- trunk/minix/drivers/tty/keymaps/genmap.c	(revision 9)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*	genmap - output binary keymap			Author: Marcus Hampel
- */
-#include <sys/types.h>
-#include <minix/keymap.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-#include KEYSRC
-
-u8_t comprmap[4 + NR_SCAN_CODES * MAP_COLS * 9/8 * 2 + 1];
-
-void tell(const char *s)
-{
-  write(2, s, strlen(s));
-}
-
-int main(void)
-{
-  u8_t *cm, *fb;
-  u16_t *km;
-  int n;
-
-  /* Compress the keymap. */
-  memcpy(comprmap, KEY_MAGIC, 4);
-  cm = comprmap + 4;
-  n = 8;
-  for (km = keymap; km < keymap + NR_SCAN_CODES * MAP_COLS; km++) {
-	if (n == 8) {
-		/* Allocate a new flag byte. */
-		fb = cm;
-		*cm++ = 0;
-		n= 0;
-	}
-	*cm++ = (*km & 0x00FF);		/* Low byte. */
-	if (*km & 0xFF00) {
-		*cm++ = (*km >> 8);	/* High byte only when set. */
-		*fb |= (1 << n);	/* Set a flag if so. */
-	}
-	n++;
-  }
-
-  /* Don't store trailing zeros. */
-  while (cm > comprmap && cm[-1] == 0) cm--;
-
-  /* Emit the compressed keymap. */
-  if (write(1, comprmap, cm - comprmap) < 0) {
-	int err = errno;
-
-	tell("genmap: ");
-	tell(strerror(err));
-	tell("\n");
-	exit(1);
-  }
-  exit(0);
-}
Index: trunk/minix/drivers/tty/keymaps/german.src
===================================================================
--- trunk/minix/drivers/tty/keymaps/german.src	(revision 9)
+++ 	(revision )
@@ -1,135 +1,0 @@
-/* Keymap for German MF-2 keyboard. */
-
-u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
-
-/* scan-code		unsh	Shift	Alt	AltGr	Alt+Sh	Strg	*/
-/* ==================================================================== */
-/* 00 - none	*/	0,	0,	0,	0,	0,	0,	
-/* 01 - ESC	*/	C('['),	C('['),	CA('['),C('['),	C('['),	C('['),
-/* 02 - '1'	*/	'1',	'!',	A('1'),	'1',	'!',	C('A'),
-/* 03 - '2'	*/	'2',	'"',	A('2'),	0375,	'@',	C('@'),
-/* 04 - '3'	*/	'3',	025,	A('3'),	0374,	'#',	C('C'),
-/* 05 - '4'	*/	'4',	'$',	A('4'),	'4',	'$',	C('D'),
-/* 06 - '5'	*/	'5',	'%',	A('5'),	'5',	'%',	C('E'),
-/* 07 - '6'	*/	'6',	'&',	A('6'),	'6',	'^',	C('^'),
-/* 08 - '7'	*/	'7',	'/',	A('7'),	'{',	'&',	C('G'),
-/* 09 - '8'	*/	'8',	'(',	A('8'),	'[',	'*',	C('H'),
-/* 10 - '9'	*/	'9',	')',	A('9'),	']',	'(',	C('I'),
-/* 11 - '0'	*/	'0',	'=',	A('0'),	'}',	')',	C('@'),
-/* 12 - '-'	*/	0341,	'?',	0341,	'\\',	'_',	C('_'),
-/* 13 - '='	*/	'\'',	'`',	A('\''),'=',	'+',	C('@'),
-/* 14 - BS	*/	C('H'),	C('H'),	CA('H'),C('H'),	C('H'),	0177,	
-/* 15 - TAB	*/	C('I'),	C('I'),	CA('I'),C('I'),	C('I'),	C('I'),
-/* 16 - 'q'	*/	L('q'),	'Q',	A('q'),	'@',	'Q',	C('Q'),
-/* 17 - 'w'	*/	L('w'),	'W',	A('w'),	'w',	'W',	C('W'),
-/* 18 - 'e'	*/	L('e'),	'E',	A('e'),	'e',	'E',	C('E'),
-/* 19 - 'r'	*/	L('r'),	'R',	A('r'),	'r',	'R',	C('R'),
-/* 20 - 't'	*/	L('t'),	'T',	A('t'),	't',	'T',	C('T'),
-/* 21 - 'y'	*/	L('z'),	'Z',	A('z'),	'z',	'Z',	C('Z'),
-/* 22 - 'u'	*/	L('u'),	'U',	A('u'),	'u',	'U',	C('U'),
-/* 23 - 'i'	*/	L('i'),	'I',	A('i'),	'i',	'I',	C('I'),
-/* 24 - 'o'	*/	L('o'),	'O',	A('o'),	'o',	'O',	C('O'),
-/* 25 - 'p'	*/	L('p'),	'P',	A('p'),	'p',	'P',	C('P'),
-/* 26 - '['	*/	L(0201),0232,	0201,	'[',	'{',	C('['),
-/* 27 - ']'	*/	'+',	'*',	A('+'),	'~',	']',	C(']'),
-/* 28 - CR/LF	*/	C('M'),	C('M'),	CA('M'),C('M'),	C('M'),	C('J'),
-/* 29 - Strg;-) */	CTRL,	CTRL,	CTRL,	CTRL,	CTRL,	CTRL,
-/* 30 - 'a'	*/	L('a'),	'A',	A('a'),	'a',	'A',	C('A'),
-/* 31 - 's'	*/	L('s'),	'S',	A('s'),	's',	'S',	C('S'),
-/* 32 - 'd'	*/	L('d'),	'D',	A('d'),	'd',	'D',	C('D'),
-/* 33 - 'f'	*/	L('f'),	'F',	A('f'),	'f',	'F',	C('F'),
-/* 34 - 'g'	*/	L('g'),	'G',	A('g'),	'g',	'G',	C('G'),
-/* 35 - 'h'	*/	L('h'),	'H',	A('h'),	'h',	'H',	C('H'),
-/* 36 - 'j'	*/	L('j'),	'J',	A('j'),	'j',	'J',	C('J'),
-/* 37 - 'k'	*/	L('k'),	'K',	A('k'),	'k',	'K',	C('K'),
-/* 38 - 'l'	*/	L('l'),	'L',	A('l'),	'l',	'L',	C('L'),
-/* 39 - ';'	*/	L(0224),0231,	0224,	';',	':',	C('@'),
-/* 40 - '\''	*/	L(0204),0216,	0204,	'\'',	'"',	C('@'),
-/* 41 - '`'	*/	'^',	0370,	A('^'),	'`',	'~',	C('^'),
-/* 42 - SHIFT	*/	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,
-/* 43 - '\\'	*/	'#',	'\'',	A('#'),	'\\',	'|',	C('\\'),
-/* 44 - 'z'	*/	L('y'),	'Y',	A('y'),	'y',	'Y',	C('Y'),
-/* 45 - 'x'	*/	L('x'),	'X',	A('x'),	'x',	'X',	C('X'),
-/* 46 - 'c'	*/	L('c'),	'C',	A('c'),	'c',	'C',	C('C'),
-/* 47 - 'v'	*/	L('v'),	'V',	A('v'),	'v',	'V',	C('V'),
-/* 48 - 'b'	*/	L('b'),	'B',	A('b'),	'b',	'B',	C('B'),
-/* 49 - 'n'	*/	L('n'),	'N',	A('n'),	'n',	'N',	C('N'),
-/* 50 - 'm'	*/	L('m'),	'M',	A('m'),	0346,	'M',	C('M'),
-/* 51 - ','	*/	',',	';',	A(','),	',',	'<',	C('@'),
-/* 52 - '.'	*/	'.',	':',	A('.'),	'.',	'>',	C('@'),
-/* 53 - '/'	*/	'-',	'_',	A('-'),	'/',	'?',	C('_'),
-/* 54 - SHIFT	*/	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,
-/* 55 - '*'	*/	'*',	'*',	A('*'),	'*',	'*',	C('@'),
-/* 56 - ALT	*/	ALT,	ALT,	ALT,	ALT,	ALT,	ALT,
-/* 57 - ' '	*/	' ',	' ',	A(' '),	' ',	' ',	C('@'),
-/* 58 - CapsLck	*/	CALOCK,	CALOCK,	CALOCK,	CALOCK,	CALOCK,	CALOCK,
-/* 59 - F1	*/	F1,	SF1,	AF1,	AF1,	ASF1,	CF1,
-/* 60 - F2	*/	F2,	SF2,	AF2,	AF2,	ASF2,	CF2,
-/* 61 - F3	*/	F3,	SF3,	AF3,	AF3,	ASF3,	CF3,
-/* 62 - F4	*/	F4,	SF4,	AF4,	AF4,	ASF4,	CF4,
-/* 63 - F5	*/	F5,	SF5,	AF5,	AF5,	ASF5,	CF5,
-/* 64 - F6	*/	F6,	SF6,	AF6,	AF6,	ASF6,	CF6,
-/* 65 - F7	*/	F7,	SF7,	AF7,	AF7,	ASF7,	CF7,
-/* 66 - F8	*/	F8,	SF8,	AF8,	AF8,	ASF8,	CF8,
-/* 67 - F9	*/	F9,	SF9,	AF9,	AF9,	ASF9,	CF9,
-/* 68 - F10	*/	F10,	SF10,	AF10,	AF10,	ASF10,	CF10,
-/* 69 - NumLock	*/	NLOCK,	NLOCK,	NLOCK,	NLOCK,	NLOCK,	NLOCK,
-/* 70 - ScrLock */	SLOCK,	SLOCK,	SLOCK,	SLOCK,	SLOCK,	SLOCK,
-/* 71 - Home	*/	HOME,	'7',	AHOME,	AHOME,	'7',	CHOME,	
-/* 72 - CurUp	*/	UP,	'8',	AUP,	AUP,	'8',	CUP,
-/* 73 - PgUp	*/	PGUP,	'9',	APGUP,	APGUP,	'9',	CPGUP,
-/* 74 - '-'	*/	NMIN,	'-',	ANMIN,	ANMIN,	'-',	CNMIN,
-/* 75 - Left	*/	LEFT,	'4',	ALEFT,	ALEFT,	'4',	CLEFT,
-/* 76 - MID	*/	MID,	'5',	AMID,	AMID,	'5',	CMID,
-/* 77 - Right	*/	RIGHT,	'6',	ARIGHT,	ARIGHT,	'6',	CRIGHT,
-/* 78 - '+'	*/	PLUS,	'+',	APLUS,	APLUS,	'+',	CPLUS,
-/* 79 - End	*/	END,	'1',	AEND,	AEND,	'1',	CEND,
-/* 80 - Down	*/	DOWN,	'2',	ADOWN,	ADOWN,	'2',	CDOWN,
-/* 81 - PgDown	*/	PGDN,	'3',	APGDN,	APGDN,	'3',	CPGDN,
-/* 82 - Insert	*/	INSRT,	'0',	AINSRT,	AINSRT,	'0',	CINSRT,
-/* 83 - Delete	*/	0177,	'.',	A(0177),0177,	'.',	0177,
-/* 84 - Enter	*/	C('M'),	C('M'),	CA('M'),C('M'),	C('M'),	C('J'),
-/* 85 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 86 - ???	*/	'<',	'>',	A('<'),	'|',	'>',	C('@'),
-/* 87 - F11	*/	F11,	SF11,	AF11,	AF11,	ASF11,	CF11,
-/* 88 - F12	*/	F12,	SF12,	AF12,	AF12,	ASF12,	CF12,
-/* 89 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 90 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 91 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 92 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 93 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 94 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 95 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 96 - EXT_KEY	*/	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,
-/* 97 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 98 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 99 - ???	*/	0,	0,	0,	0,	0,	0,
-/*100 - ???	*/	0,	0,	0,	0,	0,	0,
-/*101 - ???	*/	0,	0,	0,	0,	0,	0,
-/*102 - ???	*/	0,	0,	0,	0,	0,	0,
-/*103 - ???	*/	0,	0,	0,	0,	0,	0,
-/*104 - ???	*/	0,	0,	0,	0,	0,	0,
-/*105 - ???	*/	0,	0,	0,	0,	0,	0,
-/*106 - ???	*/	0,	0,	0,	0,	0,	0,
-/*107 - ???	*/	0,	0,	0,	0,	0,	0,
-/*108 - ???	*/	0,	0,	0,	0,	0,	0,
-/*109 - ???	*/	0,	0,	0,	0,	0,	0,
-/*110 - ???	*/	0,	0,	0,	0,	0,	0,
-/*111 - ???	*/	0,	0,	0,	0,	0,	0,
-/*112 - ???	*/	0,	0,	0,	0,	0,	0,
-/*113 - ???	*/	0,	0,	0,	0,	0,	0,
-/*114 - ???	*/	0,	0,	0,	0,	0,	0,
-/*115 - ???	*/	0,	0,	0,	0,	0,	0,
-/*116 - ???	*/	0,	0,	0,	0,	0,	0,
-/*117 - ???	*/	0,	0,	0,	0,	0,	0,
-/*118 - ???	*/	0,	0,	0,	0,	0,	0,
-/*119 - ???	*/	0,	0,	0,	0,	0,	0,
-/*120 - ???	*/	0,	0,	0,	0,	0,	0,
-/*121 - ???	*/	0,	0,	0,	0,	0,	0,
-/*122 - ???	*/	0,	0,	0,	0,	0,	0,
-/*123 - ???	*/	0,	0,	0,	0,	0,	0,
-/*124 - ???	*/	0,	0,	0,	0,	0,	0,
-/*125 - ???	*/	0,	0,	0,	0,	0,	0,
-/*126 - ???	*/	0,	0,	0,	0,	0,	0,
-/*127 - ???	*/	0,	0,	0,	0,	0,	0
-};
Index: trunk/minix/drivers/tty/keymaps/italian.src
===================================================================
--- trunk/minix/drivers/tty/keymaps/italian.src	(revision 9)
+++ 	(revision )
@@ -1,137 +1,0 @@
-/* Keymap for Italian keyboard. */
-/* Modified by Ernesto Del Prete in October 1997 */
-/* ernesto@cclix1.polito.it or s84508@cclix1.polito.it */
-
-u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
-
-/* scan-code		!Shift	Shift	Alt	AltGr	Alt+Sh	Ctrl	*/
-/* ==================================================================== */
-/* 00 - none	*/	0,	0,	0,	0,	0,	0,	
-/* 01 - ESC	*/	C('['),	C('['),	CA('['),C('['),	C('['),	C('['),
-/* 02 - '1'	*/	'1',	'!',	A('1'),	'1',	'!',	C('A'),
-/* 03 - '2'	*/	'2',	'"',	A('2'),	'2',	'@',	C('@'),
-/* 04 - '3'	*/	'3',	0234,	A('3'),	'3',	0234,	C('C'),
-/* 05 - '4'	*/	'4',	'$',	A('4'),	'4',	'$',	C('D'),
-/* 06 - '5'	*/	'5',	'%',	A('5'),	'5',	'%',	C('E'),
-/* 07 - '6'	*/	'6',	'&',	A('6'),	'6',	'&',	C('F'),
-/* 08 - '7'	*/	'7',	'/',	A('7'),	'7',	'/',	C('G'),
-/* 09 - '8'	*/	'8',	'(',	A('8'),	'8',	'(',	C('H'),
-/* 10 - '9'	*/	'9',	')',	A('9'),	'8',	')',	C('I'),
-/* 11 - '0'	*/	'0',	'=',	A('0'),	'0',	'=',	C('@'),
-/* 12 - '-'	*/	'\'',	'?',	A('\''),'`',	'?',	C('@'),
-/* 13 - '='	*/	0215,	'^',	A('|'),	0215,	'^',	C('^'),
-/* 14 - BS	*/	C('H'),	C('H'),	CA('H'),C('H'),	C('H'),	0177,	
-/* 15 - TAB	*/	C('I'),	C('I'),	CA('I'),C('I'),	C('I'),	C('I'),
-/* 16 - 'q'	*/	L('q'),	'Q',	A('q'),	'q',	'Q',	C('Q'),
-/* 17 - 'w'	*/	L('w'),	'W',	A('w'),	'w',	'W',	C('W'),
-/* 18 - 'e'	*/	L('e'),	'E',	A('e'),	'e',	'E',	C('E'),
-/* 19 - 'r'	*/	L('r'),	'R',	A('r'),	'r',	'R',	C('R'),
-/* 20 - 't'	*/	L('t'),	'T',	A('t'),	't',	'T',	C('T'),
-/* 21 - 'y'	*/	L('y'),	'Y',	A('y'),	'y',	'Y',	C('Y'),
-/* 22 - 'u'	*/	L('u'),	'U',	A('u'),	'u',	'U',	C('U'),
-/* 23 - 'i'	*/	L('i'),	'I',	A('i'),	'i',	'I',	C('I'),
-/* 24 - 'o'	*/	L('o'),	'O',	A('o'),	'o',	'O',	C('O'),
-/* 25 - 'p'	*/	L('p'),	'P',	A('p'),	'p',	'P',	C('P'),
-/* 26 - '['	*/	0212,	0202,	0212,	'[',	'{',	C('['),
-/* 27 - ']'	*/	'+',	'*',	A('+'),	']',	'}',	C(']'),
-/* 28 - CR/LF	*/	C('M'),	C('M'),	CA('M'),C('M'),	C('M'),	C('J'),
-/* 29 - Ctrl	*/	CTRL,	CTRL,	CTRL,	CTRL,	CTRL,	CTRL,
-/* 30 - 'a'	*/	L('a'),	'A',	A('a'),	'a',	'A',	C('A'),
-/* 31 - 's'	*/	L('s'),	'S',	A('s'),	's',	'S',	C('S'),
-/* 32 - 'd'	*/	L('d'),	'D',	A('d'),	'd',	'D',	C('D'),
-/* 33 - 'f'	*/	L('f'),	'F',	A('f'),	'f',	'F',	C('F'),
-/* 34 - 'g'	*/	L('g'),	'G',	A('g'),	'g',	'G',	C('G'),
-/* 35 - 'h'	*/	L('h'),	'H',	A('h'),	'h',	'H',	C('H'),
-/* 36 - 'j'	*/	L('j'),	'J',	A('j'),	'j',	'J',	C('J'),
-/* 37 - 'k'	*/	L('k'),	'K',	A('k'),	'k',	'K',	C('K'),
-/* 38 - 'l'	*/	L('l'),	'L',	A('l'),	'l',	'L',	C('L'),
-/* 39 - ';'	*/	0225,	0207,	0225,	'@',	'@',	C('@'),
-/* 40 - '\''	*/	0205,	0370,	0205,	'#',	0276,	C('@'),
-/* 41 - '`'	*/	'\\',	'|',	A('\\'),0176,	'|',	C('\\'),
-/* 42 - l. SHIFT*/	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,
-/* 43 - '\\'	*/	0227,	025,	0227,	0227,	025,	C('@'),
-/* 44 - 'z'	*/	L('z'),	'Z',	A('z'),	'z',	'Z',	C('Z'),
-/* 45 - 'x'	*/	L('x'),	'X',	A('x'),	'x',	'X',	C('X'),
-/* 46 - 'c'	*/	L('c'),	'C',	A('c'),	'c',	'C',	C('C'),
-/* 47 - 'v'	*/	L('v'),	'V',	A('v'),	'v',	'V',	C('V'),
-/* 48 - 'b'	*/	L('b'),	'B',	A('b'),	'b',	'B',	C('B'),
-/* 49 - 'n'	*/	L('n'),	'N',	A('n'),	'n',	'N',	C('N'),
-/* 50 - 'm'	*/	L('m'),	'M',	A('m'),	'm',	'M',	C('M'),
-/* 51 - ','	*/	',',	';',	A(','),	',',	';',	C('@'),
-/* 52 - '.'	*/	'.',	':',	A('.'),	'.',	':',	C('@'),
-/* 53 - '/'	*/	'-',	'_',	A('-'),	'-',	'_',	C('_'),
-/* 54 - r. SHIFT*/	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,
-/* 55 - '*'	*/	'*',	'*',	A('*'),	'*',	'*',	C('M'),
-/* 56 - ALT	*/	ALT,	ALT,	ALT,	ALT,	ALT,	ALT,
-/* 57 - ' '	*/	' ',	' ',	A(' '),	' ',	' ',	C('@'),
-/* 58 - CapsLck	*/	CALOCK,	CALOCK,	CALOCK,	CALOCK,	CALOCK,	CALOCK,
-/* 59 - F1	*/	F1,	SF1,	AF1,	AF1,	ASF1,	CF1,
-/* 60 - F2	*/	F2,	SF2,	AF2,	AF2,	ASF2,	CF2,
-/* 61 - F3	*/	F3,	SF3,	AF3,	AF3,	ASF3,	CF3,
-/* 62 - F4	*/	F4,	SF4,	AF4,	AF4,	ASF4,	CF4,
-/* 63 - F5	*/	F5,	SF5,	AF5,	AF5,	ASF5,	CF5,
-/* 64 - F6	*/	F6,	SF6,	AF6,	AF6,	ASF6,	CF6,
-/* 65 - F7	*/	F7,	SF7,	AF7,	AF7,	ASF7,	CF7,
-/* 66 - F8	*/	F8,	SF8,	AF8,	AF8,	ASF8,	CF8,
-/* 67 - F9	*/	F9,	SF9,	AF9,	AF9,	ASF9,	CF9,
-/* 68 - F10	*/	F10,	SF10,	AF10,	AF10,	ASF10,	CF10,
-/* 69 - NumLock	*/	NLOCK,	NLOCK,	NLOCK,	NLOCK,	NLOCK,	NLOCK,
-/* 70 - ScrLock */	SLOCK,	SLOCK,	SLOCK,	SLOCK,	SLOCK,	SLOCK,
-/* 71 - Home	*/	HOME,	'7',	AHOME,	AHOME,	'7',	CHOME,	
-/* 72 - CurUp	*/	UP,	'8',	AUP,	AUP,	'8',	CUP,
-/* 73 - PgUp	*/	PGUP,	'9',	APGUP,	APGUP,	'9',	CPGUP,
-/* 74 - '-'	*/	NMIN,	'-',	ANMIN,	ANMIN,	'-',	CNMIN,
-/* 75 - Left	*/	LEFT,	'4',	ALEFT,	ALEFT,	'4',	CLEFT,
-/* 76 - MID	*/	MID,	'5',	AMID,	AMID,	'5',	CMID,
-/* 77 - Right	*/	RIGHT,	'6',	ARIGHT,	ARIGHT,	'6',	CRIGHT,
-/* 78 - '+'	*/	PLUS,	'+',	APLUS,	APLUS,	'+',	CPLUS,
-/* 79 - End	*/	END,	'1',	AEND,	AEND,	'1',	CEND,
-/* 80 - Down	*/	DOWN,	'2',	ADOWN,	ADOWN,	'2',	CDOWN,
-/* 81 - PgDown	*/	PGDN,	'3',	APGDN,	APGDN,	'3',	CPGDN,
-/* 82 - Insert	*/	INSRT,	'0',	AINSRT,	AINSRT,	'0',	CINSRT,
-/* 83 - Delete	*/	0177,	'.',	A(0177),0177,	'.',	0177,
-/* 84 - Enter	*/	C('M'),	C('M'),	CA('M'),C('M'),	C('M'),	C('J'),
-/* 85 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 86 - ???	*/	'<',	'>',	A('<'),	'|',	'>',	C('@'),
-/* 87 - F11	*/	F11,	SF11,	AF11,	AF11,	ASF11,	CF11,
-/* 88 - F12	*/	F12,	SF12,	AF12,	AF12,	ASF12,	CF12,
-/* 89 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 90 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 91 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 92 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 93 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 94 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 95 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 96 - EXT_KEY	*/	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,
-/* 97 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 98 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 99 - ???	*/	0,	0,	0,	0,	0,	0,
-/*100 - ???	*/	0,	0,	0,	0,	0,	0,
-/*101 - ???	*/	0,	0,	0,	0,	0,	0,
-/*102 - ???	*/	0,	0,	0,	0,	0,	0,
-/*103 - ???	*/	0,	0,	0,	0,	0,	0,
-/*104 - ???	*/	0,	0,	0,	0,	0,	0,
-/*105 - ???	*/	0,	0,	0,	0,	0,	0,
-/*106 - ???	*/	0,	0,	0,	0,	0,	0,
-/*107 - ???	*/	0,	0,	0,	0,	0,	0,
-/*108 - ???	*/	0,	0,	0,	0,	0,	0,
-/*109 - ???	*/	0,	0,	0,	0,	0,	0,
-/*110 - ???	*/	0,	0,	0,	0,	0,	0,
-/*111 - ???	*/	0,	0,	0,	0,	0,	0,
-/*112 - ???	*/	0,	0,	0,	0,	0,	0,
-/*113 - ???	*/	0,	0,	0,	0,	0,	0,
-/*114 - ???	*/	0,	0,	0,	0,	0,	0,
-/*115 - ???	*/	0,	0,	0,	0,	0,	0,
-/*116 - ???	*/	0,	0,	0,	0,	0,	0,
-/*117 - ???	*/	0,	0,	0,	0,	0,	0,
-/*118 - ???	*/	0,	0,	0,	0,	0,	0,
-/*119 - ???	*/	0,	0,	0,	0,	0,	0,
-/*120 - ???	*/	0,	0,	0,	0,	0,	0,
-/*121 - ???	*/	0,	0,	0,	0,	0,	0,
-/*122 - ???	*/	0,	0,	0,	0,	0,	0,
-/*123 - ???	*/	0,	0,	0,	0,	0,	0,
-/*124 - ???	*/	0,	0,	0,	0,	0,	0,
-/*125 - ???	*/	0,	0,	0,	0,	0,	0,
-/*126 - ???	*/	0,	0,	0,	0,	0,	0,
-/*127 - ???	*/	0,	0,	0,	0,	0,	0
-};
Index: trunk/minix/drivers/tty/keymaps/japanese.src
===================================================================
--- trunk/minix/drivers/tty/keymaps/japanese.src	(revision 9)
+++ 	(revision )
@@ -1,157 +1,0 @@
-/*
- *	Keymap for Japanese 106 keyboard.
- *		Dec. 31 1995
- *	Toshiya Ogawa	<ogw@shizuokanet.or.jp>
- *			<GCD02425@niftyserve.or.jp>
- */
-
-/*
- * Japanese 106 keyboard has following additional 5 scan codes
- * compared to US standard 101 keyboard.
- *
- *	scan-code	keytop	     effect in this keymap
- *	-------------------------------------------------------
- *	112(0x70)	KANA		(ignored)
- *	115(0x73)	BackSlash	mapped to '\\' and '_'
- *	121(0x79)	HENKAN		(ignored)
- *	123(0x7B)	MU-HENKAN	(ignored)
- *	125(0x7D)	YEN		mapped to '\\' and '|'
- */
-
-#if (NR_SCAN_CODES != 0x80) 
-#error NR_SCAN_CODES mis-match
-#endif
-
-u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
-
-/* scan-code		!Shift	Shift	Alt1	Alt2	Alt+Sh	Ctrl	*/
-/* ==================================================================== */
-/* 00 - none	*/	0,	0,	0,	0,	0,	0,	
-/* 01 - ESC	*/	C('['),	C('['),	CA('['),CA('['),CA('['),C('['),
-/* 02 - '1'	*/	'1',	'!',	A('1'),	A('1'),	A('!'),	C('A'),
-/* 03 - '2'	*/	'2',	'"',	A('2'),	A('2'),	A('"'),	C('B'),
-/* 04 - '3'	*/	'3',	'#',	A('3'),	A('3'),	A('#'),	C('C'),
-/* 05 - '4'	*/	'4',	'$',	A('4'),	A('4'),	A('$'),	C('D'),
-/* 06 - '5'	*/	'5',	'%',	A('5'),	A('5'),	A('%'),	C('E'),
-/* 07 - '6'	*/	'6',	'&',	A('6'),	A('6'),	A('&'),	C('F'),
-/* 08 - '7'	*/	'7',	'\'',	A('7'),	A('7'),	A('\''),C('G'),
-/* 09 - '8'	*/	'8',	'(',	A('8'),	A('8'),	A('('),	C('H'),
-/* 10 - '9'	*/	'9',	')',	A('9'),	A('9'),	A(')'),	C('I'),
-/* 11 - '0'	*/	'0',	'~',	A('0'),	A('0'),	A('~'),	C('@'),
-/* 12 - '-'	*/	'-',	'=',	A('-'),	A('-'),	A('='),	C('@'),
-/* 13 - '^'	*/	'^',	'~',	A('^'),	A('^'),	A('~'),	C('^'),
-/* 14 - BS	*/	C('H'),	C('H'),	CA('H'),CA('H'),CA('H'),0177,	
-/* 15 - TAB	*/	C('I'),	C('I'),	CA('I'),CA('I'),CA('I'),C('I'),
-/* 16 - 'q'	*/	L('q'),	'Q',	A('q'),	A('q'),	A('Q'),	C('Q'),
-/* 17 - 'w'	*/	L('w'),	'W',	A('w'),	A('w'),	A('W'),	C('W'),
-/* 18 - 'e'	*/	L('e'),	'E',	A('e'),	A('e'),	A('E'),	C('E'),
-/* 19 - 'r'	*/	L('r'),	'R',	A('r'),	A('r'),	A('R'),	C('R'),
-/* 20 - 't'	*/	L('t'),	'T',	A('t'),	A('t'),	A('T'),	C('T'),
-/* 21 - 'y'	*/	L('y'),	'Y',	A('y'),	A('y'),	A('Y'),	C('Y'),
-/* 22 - 'u'	*/	L('u'),	'U',	A('u'),	A('u'),	A('U'),	C('U'),
-/* 23 - 'i'	*/	L('i'),	'I',	A('i'),	A('i'),	A('I'),	C('I'),
-/* 24 - 'o'	*/	L('o'),	'O',	A('o'),	A('o'),	A('O'),	C('O'),
-/* 25 - 'p'	*/	L('p'),	'P',	A('p'),	A('p'),	A('P'),	C('P'),
-/* 26 - '@'	*/	'@',	'`',	A('@'),	A('@'),	A('`'),	C('@'),
-/* 27 - '['	*/	'[',	'{',	A('['),	A('['),	A('{'),	C('['),
-/* 28 - Enter	*/	C('M'),	C('M'),	CA('M'),CA('M'),CA('M'),C('J'),
-/* 29 - Ctrl	*/	CTRL,	CTRL,	CTRL,	CTRL,	CTRL,	CTRL,
-/* 30 - 'a'	*/	L('a'),	'A',	A('a'),	A('a'),	A('A'),	C('A'),
-/* 31 - 's'	*/	L('s'),	'S',	A('s'),	A('s'),	A('S'),	C('S'),
-/* 32 - 'd'	*/	L('d'),	'D',	A('d'),	A('d'),	A('D'),	C('D'),
-/* 33 - 'f'	*/	L('f'),	'F',	A('f'),	A('f'),	A('F'),	C('F'),
-/* 34 - 'g'	*/	L('g'),	'G',	A('g'),	A('g'),	A('G'),	C('G'),
-/* 35 - 'h'	*/	L('h'),	'H',	A('h'),	A('h'),	A('H'),	C('H'),
-/* 36 - 'j'	*/	L('j'),	'J',	A('j'),	A('j'),	A('J'),	C('J'),
-/* 37 - 'k'	*/	L('k'),	'K',	A('k'),	A('k'),	A('K'),	C('K'),
-/* 38 - 'l'	*/	L('l'),	'L',	A('l'),	A('l'),	A('L'),	C('L'),
-/* 39 - ';'	*/	';',	'+',	A(';'),	A(';'),	A('+'),	C('@'),
-/* 40 - ':'	*/	':',	'*',	A(':'),	A(':'),	A('*'),	C('@'),
-/* 41 - KANJI	*/	0,	0,	0,	0,	0,	0,	
-/* 42 - l. SHIFT*/	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,
-/* 43 - ']'	*/	']',	'}',	A(']'),	A(']'),	A('}'),	C(']'),
-/* 44 - 'z'	*/	L('z'),	'Z',	A('z'),	A('z'),	A('Z'),	C('Z'),
-/* 45 - 'x'	*/	L('x'),	'X',	A('x'),	A('x'),	A('X'),	C('X'),
-/* 46 - 'c'	*/	L('c'),	'C',	A('c'),	A('c'),	A('C'),	C('C'),
-/* 47 - 'v'	*/	L('v'),	'V',	A('v'),	A('v'),	A('V'),	C('V'),
-/* 48 - 'b'	*/	L('b'),	'B',	A('b'),	A('b'),	A('B'),	C('B'),
-/* 49 - 'n'	*/	L('n'),	'N',	A('n'),	A('n'),	A('N'),	C('N'),
-/* 50 - 'm'	*/	L('m'),	'M',	A('m'),	A('m'),	A('M'),	C('M'),
-/* 51 - ','	*/	',',	'<',	A(','),	A(','),	A('<'),	C('@'),
-/* 52 - '.'	*/	'.',	'>',	A('.'),	A('.'),	A('>'),	C('@'),
-/* 53 - '/'	*/	'/',	'?',	A('/'),	A('/'),	A('?'),	C('@'),
-/* 54 - r. SHIFT*/	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,
-/* 55 - '*'	*/	'*',	'*',	A('*'),	A('*'),	A('*'),	C('@'),
-/* 56 - ALT	*/	ALT,	ALT,	ALT,	ALT,	ALT,	ALT,
-/* 57 - ' '	*/	' ',	' ',	A(' '),	A(' '),	A(' '),	C('@'),
-/* 58 - CapsLck	*/	CALOCK,	CALOCK,	CALOCK,	CALOCK,	CALOCK,	CALOCK,
-/* 59 - F1	*/	F1,	SF1,	AF1,	AF1,	ASF1,	CF1,
-/* 60 - F2	*/	F2,	SF2,	AF2,	AF2,	ASF2,	CF2,
-/* 61 - F3	*/	F3,	SF3,	AF3,	AF3,	ASF3,	CF3,
-/* 62 - F4	*/	F4,	SF4,	AF4,	AF4,	ASF4,	CF4,
-/* 63 - F5	*/	F5,	SF5,	AF5,	AF5,	ASF5,	CF5,
-/* 64 - F6	*/	F6,	SF6,	AF6,	AF6,	ASF6,	CF6,
-/* 65 - F7	*/	F7,	SF7,	AF7,	AF7,	ASF7,	CF7,
-/* 66 - F8	*/	F8,	SF8,	AF8,	AF8,	ASF8,	CF8,
-/* 67 - F9	*/	F9,	SF9,	AF9,	AF9,	ASF9,	CF9,
-/* 68 - F10	*/	F10,	SF10,	AF10,	AF10,	ASF10,	CF10,
-/* 69 - NumLock	*/	NLOCK,	NLOCK,	NLOCK,	NLOCK,	NLOCK,	NLOCK,
-/* 70 - ScrLock */	SLOCK,	SLOCK,	SLOCK,	SLOCK,	SLOCK,	SLOCK,
-/* 71 - Home	*/	HOME,	'7',	AHOME,	AHOME,	A('7'),	CHOME,	
-/* 72 - CurUp	*/	UP,	'8',	AUP,	AUP,	A('8'),	CUP,
-/* 73 - PgUp	*/	PGUP,	'9',	APGUP,	APGUP,	A('9'),	CPGUP,
-/* 74 - '-'	*/	NMIN,	'-',	ANMIN,	ANMIN,	A('-'),	CNMIN,
-/* 75 - Left	*/	LEFT,	'4',	ALEFT,	ALEFT,	A('4'),	CLEFT,
-/* 76 - MID	*/	MID,	'5',	AMID,	AMID,	A('5'),	CMID,
-/* 77 - Right	*/	RIGHT,	'6',	ARIGHT,	ARIGHT,	A('6'),	CRIGHT,
-/* 78 - '+'	*/	PLUS,	'+',	APLUS,	APLUS,	A('+'),	CPLUS,
-/* 79 - End	*/	END,	'1',	AEND,	AEND,	A('1'),	CEND,
-/* 80 - Down	*/	DOWN,	'2',	ADOWN,	ADOWN,	A('2'),	CDOWN,
-/* 81 - PgDown	*/	PGDN,	'3',	APGDN,	APGDN,	A('3'),	CPGDN,
-/* 82 - Insert	*/	INSRT,	'0',	AINSRT,	AINSRT,	A('0'),	CINSRT,
-/* 83 - Delete	*/	0177,	'.',	A(0177),A(0177),A('.'),	0177,
-/* 84 - Enter	*/	C('M'),	C('M'),	CA('M'),CA('M'),CA('M'),C('J'),
-/* 85 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 86 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 87 - F11	*/	F11,	SF11,	AF11,	AF11,	ASF11,	CF11,
-/* 88 - F12	*/	F12,	SF12,	AF12,	AF12,	ASF12,	CF12,
-/* 89 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 90 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 91 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 92 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 93 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 94 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 95 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 96 - EXT_KEY	*/	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,
-/* 97 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 98 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 99 - ???	*/	0,	0,	0,	0,	0,	0,
-/*100 - ???	*/	0,	0,	0,	0,	0,	0,
-/*101 - ???	*/	0,	0,	0,	0,	0,	0,
-/*102 - ???	*/	0,	0,	0,	0,	0,	0,
-/*103 - ???	*/	0,	0,	0,	0,	0,	0,
-/*104 - ???	*/	0,	0,	0,	0,	0,	0,
-/*105 - ???	*/	0,	0,	0,	0,	0,	0,
-/*106 - ???	*/	0,	0,	0,	0,	0,	0,
-/*107 - ???	*/	0,	0,	0,	0,	0,	0,
-/*108 - ???	*/	0,	0,	0,	0,	0,	0,
-/*109 - ???	*/	0,	0,	0,	0,	0,	0,
-/*110 - ???	*/	0,	0,	0,	0,	0,	0,
-/*111 - ???	*/	0,	0,	0,	0,	0,	0,
-/*112 - KANA	*/	0,	0,	0,	0,	0,	0,
-/*113 - ???	*/	0,	0,	0,	0,	0,	0,
-/*114 - ???	*/	0,	0,	0,	0,	0,	0,
-/*115 - '\\'	*/	'\\',	'_',	A('\\'),A('\\'),A('_'),	C('_'),
-/*116 - ???	*/	0,	0,	0,	0,	0,	0,
-/*117 - ???	*/	0,	0,	0,	0,	0,	0,
-/*118 - ???	*/	0,	0,	0,	0,	0,	0,
-/*119 - ???	*/	0,	0,	0,	0,	0,	0,
-/*120 - ???	*/	0,	0,	0,	0,	0,	0,
-/*121 - HENKAN	*/	0,	0,	0,	0,	0,	0,
-/*122 - ???	*/	0,	0,	0,	0,	0,	0,
-/*123 - MU-HENKAN*/	0,	0,	0,	0,	0,	0,
-/*124 - ???	*/	0,	0,	0,	0,	0,	0,
-/*125 - YEN	*/	'\\',	'|',	A('\\'),A('\\'),A('|'),	C('\\'),
-/*126 - ???	*/	0,	0,	0,	0,	0,	0,
-/*127 - ???	*/	0,	0,	0,	0,	0,	0
-};
Index: trunk/minix/drivers/tty/keymaps/latin-america.src
===================================================================
--- trunk/minix/drivers/tty/keymaps/latin-america.src	(revision 9)
+++ 	(revision )
@@ -1,153 +1,0 @@
-/***
-   Keymap for Latin American keyboard. v1.02
-   Victor A. Rodriguez - El bit Fantasma - Bit-Man@Tasa.Com.AR
-
-   The Latin American keyboard makes differences between the left and
-   right ALT keys (the right one is so called ALT GR), and uses accent.
-
-   Release History 
-   ===============
-   v1.00     Initial version 
-   v1.01     Extended ASCII characters replaced by hex. equivalents
-   v1.02     NR_SCAN_CODES has grown to 0x80, required by Toshiya Ogawa
-             (ogw@shizuokanet.or.jp) and added by Kees J.Bot (kjb@cs.vu.nl)
-             in MINIX 1.7.2
-***/
-
-#if (NR_SCAN_CODES != 0x80) 
-#error NR_SCAN_CODES mis-match
-#endif
-
-u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
-
-/* scan-code            !Shift  Shift   Alt1    Alt2    Alt+Sh  Ctrl    */
-/* ==================================================================== */
-/* 00 - none    */      0,      0,      0,      0,      0,      0,      
-/* 01 - ESC     */      C('['), C('['), CA('['),CA('['),CA('['),C('['),
-/* 02 - '1'     */      '1',    '!',    A('1'), A('1'), A('!'), C('A'),
-/* 03 - '2'     */      '2',    '"',    A('2'), A('2'), A('"'), C('@'),
-/* 04 - '3'     */      '3',    '#',    A('3'), A('3'), A('#'), C('C'),
-/* 05 - '4'     */      '4',    '$',    A('4'), A('4'), A('$'), C('D'),
-/* 06 - '5'     */      '5',    '%',    A('5'), A('5'), A('%'), C('E'),
-/* 07 - '6'     */      '6',    '&',    A('6'), A('6'), A('$'), C('^'),
-/* 08 - '7'     */      '7',    '/',    A('7'), A('7'), A('/'), C('G'),
-/* 09 - '8'     */      '8',    '(',    A('8'), A('8'), A('('), C('H'),
-/* 10 - '9'     */      '9',    ')',    A('9'), A('9'), A(')'), C('I'),
-/* 11 - '0'     */      '0',    '=',    A('0'), A('0'), A('='), C('@'),
-/* 12 - '-'     */      '\'',   '?',    A('\''), 0x5c,   A('?'), C('?'),
-/* 13 - 'š'     */      0xa8,   0xad,   A(0xa8),A(0xa8),A(0xad), C('@'),
-/* 14 - BS      */      C('H'), C('H'), CA('H'),CA('H'),CA('H'),0177,   
-/* 15 - TAB     */      C('I'), C('I'), CA('I'),CA('I'),CA('I'),C('I'),
-/* 16 - 'q'     */      L('q'), 'Q',    A('q'), 0x40,   A('Q'), C('Q'),
-/* 17 - 'w'     */      L('w'), 'W',    A('w'), A('w'), A('W'), C('W'),
-/* 18 - 'e'     */      L('e'), 'E',    A('e'), A('e'), A('E'), C('E'),
-/* 19 - 'r'     */      L('r'), 'R',    A('r'), A('r'), A('R'), C('R'),
-/* 20 - 't'     */      L('t'), 'T',    A('t'), A('t'), A('T'), C('T'),
-/* 21 - 'y'     */      L('y'), 'Y',    A('y'), A('y'), A('Y'), C('Y'),
-/* 22 - 'u'     */      L('u'), 'U',    A('u'), A('u'), A('U'), C('U'),
-/* 23 - 'i'     */      L('i'), 'I',    A('i'), A('i'), A('I'), C('I'),
-/* 24 - 'o'     */      L('o'), 'O',    A('o'), A('o'), A('O'), C('O'),
-/* 25 - 'p'     */      L('p'), 'P',    A('p'), A('p'), A('P'), C('P'),
-/* 26 - 'ï'     */      0xef,   0xf9,   A(0xef),A(0xef),A(0xf9),C(0xef),
-/* 27 - '+'     */      '+',    '*',    A('+'), 0x7e,   A('*'), C('+'),
-/* 28 - CR/LF   */      C('M'), C('M'), CA('M'),CA('M'),CA('M'),C('J'),
-/* 29 - Ctrl    */      CTRL,   CTRL,   CTRL,   CTRL,   CTRL,   CTRL,
-/* 30 - 'a'     */      L('a'), 'A',    A('a'), A('a'), A('A'), C('A'),
-/* 31 - 's'     */      L('s'), 'S',    A('s'), A('s'), A('S'), C('S'),
-/* 32 - 'd'     */      L('d'), 'D',    A('d'), A('d'), A('D'), C('D'),
-/* 33 - 'f'     */      L('f'), 'F',    A('f'), A('f'), A('F'), C('F'),
-/* 34 - 'g'     */      L('g'), 'G',    A('g'), A('g'), A('G'), C('G'),
-/* 35 - 'h'     */      L('h'), 'H',    A('h'), A('h'), A('H'), C('H'),
-/* 36 - 'j'     */      L('j'), 'J',    A('j'), A('j'), A('J'), C('J'),
-/* 37 - 'k'     */      L('k'), 'K',    A('k'), A('k'), A('K'), C('K'),
-/* 38 - 'l'     */      L('l'), 'L',    A('l'), A('l'), A('L'), C('L'),
-/* 39 - '€'     */      L(0xa4),0xa5,   A(0xa4),A(0xa4),A(0xa5),C('@'),
-/* 40 - '{'     */      '{',    '[',    A('{'), 0x5e,   A('['), C('@'),
-/* 41 - '|'     */      '|',    0xf8,   A('|'), 0xaa,   A('\''),C('@'),
-/* 42 - l. SHIFT*/      SHIFT,  SHIFT,  SHIFT,  SHIFT,  SHIFT,  SHIFT,
-/* 43 - '}'     */      0x7d,   0x5d,   A('<'), 0x60,   A('>'), C('<'),
-/* 44 - 'z'     */      L('z'), 'Z',    A('z'), A('z'), A('Z'), C('Z'),
-/* 45 - 'x'     */      L('x'), 'X',    A('x'), A('x'), A('X'), C('X'),
-/* 46 - 'c'     */      L('c'), 'C',    A('c'), A('c'), A('C'), C('C'),
-/* 47 - 'v'     */      L('v'), 'V',    A('v'), A('v'), A('V'), C('V'),
-/* 48 - 'b'     */      L('b'), 'B',    A('b'), A('b'), A('B'), C('B'),
-/* 49 - 'n'     */      L('n'), 'N',    A('n'), A('n'), A('N'), C('N'),
-/* 50 - 'm'     */      L('m'), 'M',    A('m'), A('m'), A('M'), C('M'),
-/* 51 - ','     */      ',',    ';',    A(','), A(','), A(';'), C('@'),
-/* 52 - '.'     */      '.',    ':',    A('.'), A('.'), A(':'), C('@'),
-/* 53 - '/'     */      '-',    '_',    A('-'), A('-'), A('_'), C('@'),
-/* 54 - r. SHIFT*/      SHIFT,  SHIFT,  SHIFT,  SHIFT,  SHIFT,  SHIFT,
-/* 55 - '*'     */      '*',    '*',    A('*'), A('*'), A('*'), C('@'),
-/* 56 - ALT     */      ALT,    ALT,    ALT,    ALT,    ALT,    ALT,
-/* 57 - ' '     */      ' ',    ' ',    A(' '), A(' '), A(' '), C('@'),
-/* 58 - CapsLck */      CALOCK, CALOCK, CALOCK, CALOCK, CALOCK, CALOCK,
-/* 59 - F1      */      F1,     SF1,    AF1,    AF1,    ASF1,   CF1,
-/* 60 - F2      */      F2,     SF2,    AF2,    AF2,    ASF2,   CF2,
-/* 61 - F3      */      F3,     SF3,    AF3,    AF3,    ASF3,   CF3,
-/* 62 - F4      */      F4,     SF4,    AF4,    AF4,    ASF4,   CF4,
-/* 63 - F5      */      F5,     SF5,    AF5,    AF5,    ASF5,   CF5,
-/* 64 - F6      */      F6,     SF6,    AF6,    AF6,    ASF6,   CF6,
-/* 65 - F7      */      F7,     SF7,    AF7,    AF7,    ASF7,   CF7,
-/* 66 - F8      */      F8,     SF8,    AF8,    AF8,    ASF8,   CF8,
-/* 67 - F9      */      F9,     SF9,    AF9,    AF9,    ASF9,   CF9,
-/* 68 - F10     */      F10,    SF10,   AF10,   AF10,   ASF10,  CF10,
-/* 69 - NumLock */      NLOCK,  NLOCK,  NLOCK,  NLOCK,  NLOCK,  NLOCK,
-/* 70 - ScrLock */      SLOCK,  SLOCK,  SLOCK,  SLOCK,  SLOCK,  SLOCK,
-/* 71 - Home    */      HOME,   '7',    AHOME,  AHOME,  A('7'), CHOME,  
-/* 72 - CurUp   */      UP,     '8',    AUP,    AUP,    A('8'), CUP,
-/* 73 - PgUp    */      PGUP,   '9',    APGUP,  APGUP,  A('9'), CPGUP,
-/* 74 - '-'     */      '-',    '-',    '-',    '-',    '-',    '-',
-/* 75 - Left    */      LEFT,   '4',    ALEFT,  ALEFT,  A('4'), CLEFT,
-/* 76 - MID     */      MID,    '5',    AMID,   AMID,   A('5'), CMID,
-/* 77 - Right   */      RIGHT,  '6',    ARIGHT, ARIGHT, A('6'), CRIGHT,
-/* 78 - '+'     */      '+',    '+',    '+',    '+',    '+',    '+',
-/* 79 - End     */      END,    '1',    AEND,   AEND,   A('1'), CEND,
-/* 80 - Down    */      DOWN,   '2',    ADOWN,  ADOWN,  A('2'), CDOWN,
-/* 81 - PgDown  */      PGDN,   '3',    APGDN,  APGDN,  A('3'), CPGDN,
-/* 82 - Insert  */      INSRT,  '0',    AINSRT, AINSRT, A('0'), CINSRT,
-/* 83 - Delete  */      0177,   '.',    A(0177),A(0177),A('.'), 0177,
-/* 84 - Enter   */      C('M'), C('M'), CA('M'),CA('M'),CA('M'),C('J'),
-/* 85 - ???     */      0,      0,      0,      0,      0,      0,
-/* 86 - ???     */      '<',    '>',   A('<'),  A('>'), A('>'), C('@'),
-/* 87 - F11     */      F11,    SF11,   AF11,   AF11,   ASF11,  CF11,
-/* 88 - F12     */      F12,    SF12,   AF12,   AF12,   ASF12,  CF12,
-/* 89 - ???     */      0,      0,      0,      0,      0,      0,
-/* 90 - ???     */      0,      0,      0,      0,      0,      0,
-/* 91 - ???     */      0,      0,      0,      0,      0,      0,
-/* 92 - ???     */      0,      0,      0,      0,      0,      0,
-/* 93 - ???     */      0,      0,      0,      0,      0,      0,
-/* 94 - ???     */      0,      0,      0,      0,      0,      0,
-/* 95 - ???     */      0,      0,      0,      0,      0,      0,
-/* 96 - EXT_KEY */      EXTKEY, EXTKEY, EXTKEY, EXTKEY, EXTKEY, EXTKEY,
-/* 97 - ???     */      0,      0,      0,      0,      0,      0,
-/* 98 - ???     */      0,      0,      0,      0,      0,      0,
-/* 99 - ???     */      0,      0,      0,      0,      0,      0,
-/*100 - ???     */      0,      0,      0,      0,      0,      0,
-/*101 - ???     */      0,      0,      0,      0,      0,      0,
-/*102 - ???     */      0,      0,      0,      0,      0,      0,
-/*103 - ???     */      0,      0,      0,      0,      0,      0,
-/*104 - ???     */      0,      0,      0,      0,      0,      0,
-/*105 - ???     */      0,      0,      0,      0,      0,      0,
-/*106 - ???     */      0,      0,      0,      0,      0,      0,
-/*107 - ???     */      0,      0,      0,      0,      0,      0,
-/*108 - ???     */      0,      0,      0,      0,      0,      0,
-/*109 - ???     */      0,      0,      0,      0,      0,      0,
-/*110 - ???     */      0,      0,      0,      0,      0,      0,
-/*111 - ???     */      0,      0,      0,      0,      0,      0,
-/*112 - ???     */      0,      0,      0,      0,      0,      0,
-/*113 - ???     */      0,      0,      0,      0,      0,      0,
-/*114 - ???     */      0,      0,      0,      0,      0,      0,
-/*115 - ???     */      0,      0,      0,      0,      0,      0,
-/*116 - ???     */      0,      0,      0,      0,      0,      0,
-/*117 - ???     */      0,      0,      0,      0,      0,      0,
-/*118 - ???     */      0,      0,      0,      0,      0,      0,
-/*119 - ???     */      0,      0,      0,      0,      0,      0,
-/*120 - ???     */      0,      0,      0,      0,      0,      0,
-/*121 - ???     */      0,      0,      0,      0,      0,      0,
-/*122 - ???     */      0,      0,      0,      0,      0,      0,
-/*123 - ???     */      0,      0,      0,      0,      0,      0,
-/*124 - ???     */      0,      0,      0,      0,      0,      0,
-/*125 - ???     */      0,      0,      0,      0,      0,      0,
-/*126 - ???     */      0,      0,      0,      0,      0,      0,
-/*127 - ???     */      0,      0,      0,      0,      0,      0
-};
Index: trunk/minix/drivers/tty/keymaps/olivetti.src
===================================================================
--- trunk/minix/drivers/tty/keymaps/olivetti.src	(revision 9)
+++ 	(revision )
@@ -1,135 +1,0 @@
-/* Keymap for the Olivetti M24. */
-
-u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
-
-/* scan-code		!Shift	Shift	Alt1	Alt2	Alt+Sh	Ctrl	*/
-/* ==================================================================== */
-/* 00 - none	*/	0,	0,	0,	0,	0,	0,	
-/* 01 - ESC	*/	C('['),	C('['),	CA('['),CA('['),CA('['),C('['),
-/* 02 - '1'	*/	'1',	'!',	A('1'),	A('1'),	A('!'),	C('A'),
-/* 03 - '2'	*/	'2',	'"',	A('2'),	A('2'),	A('"'),	C('B'),
-/* 04 - '3'	*/	'3',	'#',	A('3'),	A('3'),	A('#'),	C('C'),
-/* 05 - '4'	*/	'4',	'$',	A('4'),	A('4'),	A('$'),	C('D'),
-/* 06 - '5'	*/	'5',	'%',	A('5'),	A('5'),	A('%'),	C('E'),
-/* 07 - '6'	*/	'6',	'&',	A('6'),	A('6'),	A('&'),	C('F'),
-/* 08 - '7'	*/	'7',	'\'',	A('7'),	A('7'),	A('\''),C('G'),
-/* 09 - '8'	*/	'8',	'(',	A('8'),	A('8'),	A('('),	C('H'),
-/* 10 - '9'	*/	'9',	')',	A('9'),	A('9'),	A(')'),	C('I'),
-/* 11 - '0'	*/	'0',	'_',	A('0'),	A('0'),	A('_'),	C('@'),
-/* 12 - '-'	*/	'-',	'=',	A('-'),	A('-'),	A('='),	C('@'),
-/* 13 - '='	*/	'^',	'~',	A('^'),	A('^'),	A('~'),	C('^'),
-/* 14 - BS	*/	C('H'),	C('H'),	CA('H'),CA('H'),CA('H'),0177,	
-/* 15 - TAB	*/	C('I'),	C('I'),	CA('I'),CA('I'),CA('I'),C('I'),
-/* 16 - 'q'	*/	L('q'),	'Q',	A('q'),	A('q'),	A('Q'),	C('Q'),
-/* 17 - 'w'	*/	L('w'),	'W',	A('w'),	A('w'),	A('W'),	C('W'),
-/* 18 - 'e'	*/	L('e'),	'E',	A('e'),	A('e'),	A('E'),	C('E'),
-/* 19 - 'r'	*/	L('r'),	'R',	A('r'),	A('r'),	A('R'),	C('R'),
-/* 20 - 't'	*/	L('t'),	'T',	A('t'),	A('t'),	A('T'),	C('T'),
-/* 21 - 'y'	*/	L('y'),	'Y',	A('y'),	A('y'),	A('Y'),	C('Y'),
-/* 22 - 'u'	*/	L('u'),	'U',	A('u'),	A('u'),	A('U'),	C('U'),
-/* 23 - 'i'	*/	L('i'),	'I',	A('i'),	A('i'),	A('I'),	C('I'),
-/* 24 - 'o'	*/	L('o'),	'O',	A('o'),	A('o'),	A('O'),	C('O'),
-/* 25 - 'p'	*/	L('p'),	'P',	A('p'),	A('p'),	A('P'),	C('P'),
-/* 26 - '['	*/	'@',	'`',	A('@'),	A('@'),	A('`'),	C('@'),
-/* 27 - ']'	*/	'[',	'{',	A('['),	A('['),	A('{'),	C('['),
-/* 28 - CR/LF	*/	C('M'),	C('M'),	CA('M'),CA('M'),CA('M'),C('J'),
-/* 29 - Ctrl	*/	CTRL,	CTRL,	CTRL,	CTRL,	CTRL,	CTRL,
-/* 30 - 'a'	*/	L('a'),	'A',	A('a'),	A('a'),	A('A'),	C('A'),
-/* 31 - 's'	*/	L('s'),	'S',	A('s'),	A('s'),	A('S'),	C('S'),
-/* 32 - 'd'	*/	L('d'),	'D',	A('d'),	A('d'),	A('D'),	C('D'),
-/* 33 - 'f'	*/	L('f'),	'F',	A('f'),	A('f'),	A('F'),	C('F'),
-/* 34 - 'g'	*/	L('g'),	'G',	A('g'),	A('g'),	A('G'),	C('G'),
-/* 35 - 'h'	*/	L('h'),	'H',	A('h'),	A('h'),	A('H'),	C('H'),
-/* 36 - 'j'	*/	L('j'),	'J',	A('j'),	A('j'),	A('J'),	C('J'),
-/* 37 - 'k'	*/	L('k'),	'K',	A('k'),	A('k'),	A('K'),	C('K'),
-/* 38 - 'l'	*/	L('l'),	'L',	A('l'),	A('l'),	A('L'),	C('L'),
-/* 39 - ';'	*/	';',	'+',	A(';'),	A(';'),	A('+'),	C('@'),
-/* 40 - '\''	*/	':',	'*',	A(':'),	A(':'),	A('*'),	C('@'),
-/* 41 - '`'	*/	']',	'}',	A(']'),	A(']'),	A('}'),	C(']'),
-/* 42 - l. SHIFT*/	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,
-/* 43 - '\\'	*/	'\\',	'|',	A('\\'),A('\\'),A('|'),	C('\\'),
-/* 44 - 'z'	*/	L('z'),	'Z',	A('z'),	A('z'),	A('Z'),	C('Z'),
-/* 45 - 'x'	*/	L('x'),	'X',	A('x'),	A('x'),	A('X'),	C('X'),
-/* 46 - 'c'	*/	L('c'),	'C',	A('c'),	A('c'),	A('C'),	C('C'),
-/* 47 - 'v'	*/	L('v'),	'V',	A('v'),	A('v'),	A('V'),	C('V'),
-/* 48 - 'b'	*/	L('b'),	'B',	A('b'),	A('b'),	A('B'),	C('B'),
-/* 49 - 'n'	*/	L('n'),	'N',	A('n'),	A('n'),	A('N'),	C('N'),
-/* 50 - 'm'	*/	L('m'),	'M',	A('m'),	A('m'),	A('M'),	C('M'),
-/* 51 - ','	*/	',',	'<',	A(','),	A(','),	A('<'),	C('@'),
-/* 52 - '.'	*/	'.',	'>',	A('.'),	A('.'),	A('>'),	C('@'),
-/* 53 - '/'	*/	'/',	'?',	A('/'),	A('/'),	A('?'),	C('@'),
-/* 54 - r. SHIFT*/	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,
-/* 55 - '*'	*/	'*',	'*',	A('*'),	A('*'),	A('*'),	C('@'),
-/* 56 - ALT	*/	ALT,	ALT,	ALT,	ALT,	ALT,	ALT,
-/* 57 - ' '	*/	' ',	' ',	A(' '),	A(' '),	A(' '),	C('@'),
-/* 58 - CapsLck	*/	CALOCK,	CALOCK,	CALOCK,	CALOCK,	CALOCK,	CALOCK,
-/* 59 - F1	*/	F1,	SF1,	AF1,	AF1,	ASF1,	CF1,
-/* 60 - F2	*/	F2,	SF2,	AF2,	AF2,	ASF2,	CF2,
-/* 61 - F3	*/	F3,	SF3,	AF3,	AF3,	ASF3,	CF3,
-/* 62 - F4	*/	F4,	SF4,	AF4,	AF4,	ASF4,	CF4,
-/* 63 - F5	*/	F5,	SF5,	AF5,	AF5,	ASF5,	CF5,
-/* 64 - F6	*/	F6,	SF6,	AF6,	AF6,	ASF6,	CF6,
-/* 65 - F7	*/	F7,	SF7,	AF7,	AF7,	ASF7,	CF7,
-/* 66 - F8	*/	F8,	SF8,	AF8,	AF8,	ASF8,	CF8,
-/* 67 - F9	*/	F9,	SF9,	AF9,	AF9,	ASF9,	CF9,
-/* 68 - F10	*/	F10,	SF10,	AF10,	AF10,	ASF10,	CF10,
-/* 69 - NumLock	*/	C('S'),	C('S'),	C('S'),	C('S'),	C('S'),	C('S'),
-/* 70 - ScrLock */	SLOCK,	SLOCK,	SLOCK,	SLOCK,	SLOCK,	SLOCK,
-/* 71 - Home	*/	HOME,	'7',	AHOME,	AHOME,	A('7'),	CHOME,	
-/* 72 - CurUp	*/	UP,	'8',	AUP,	AUP,	A('8'),	CUP,
-/* 73 - PgUp	*/	PGUP,	'9',	APGUP,	APGUP,	A('9'),	CPGUP,
-/* 74 - '-'	*/	NMIN,	'-',	ANMIN,	ANMIN,	A('-'),	CNMIN,
-/* 75 - Left	*/	LEFT,	'4',	ALEFT,	ALEFT,	A('4'),	CLEFT,
-/* 76 - MID	*/	MID,	'5',	AMID,	AMID,	A('5'),	CMID,
-/* 77 - Right	*/	RIGHT,	'6',	ARIGHT,	ARIGHT,	A('6'),	CRIGHT,
-/* 78 - '+'	*/	PLUS,	'+',	APLUS,	APLUS,	A('+'),	CPLUS,
-/* 79 - End	*/	END,	'1',	AEND,	AEND,	A('1'),	CEND,
-/* 80 - Down	*/	DOWN,	'2',	ADOWN,	ADOWN,	A('2'),	CDOWN,
-/* 81 - PgDown	*/	PGDN,	'3',	APGDN,	APGDN,	A('3'),	CPGDN,
-/* 82 - Insert	*/	INSRT,	'0',	AINSRT,	AINSRT,	A('0'),	CINSRT,
-/* 83 - Delete	*/	0177,	'.',	A(0177),A(0177),A('.'),	0177,
-/* 84 - Enter	*/	' ',	' ',	A(' '),	A(' '),	A(' '),	C('@'),
-/* 85 - ???	*/	LEFT,	014,	A(014),	A(014),	A(014),	014,
-/* 86 - ???	*/	0212,	0212,	0212,	0212,	0212,	0212,
-/* 87 - F11	*/	C('M'),	C('M'),	CA('M'),CA('M'),CA('M'),C('J'),
-/* 88 - F12	*/	F12,	SF12,	AF12,	AF12,	ASF12,	CF12,
-/* 89 - ???	*/	DOWN,	DOWN,	DOWN,	DOWN,	DOWN,	DOWN,
-/* 90 - ???	*/	RIGHT,	RIGHT,	RIGHT,	RIGHT,	RIGHT,	RIGHT,
-/* 91 - ???	*/	UP,	UP,	UP,	UP,	UP,	UP,
-/* 92 - ???	*/	LEFT,	LEFT,	LEFT,	LEFT,	LEFT,	LEFT,
-/* 93 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 94 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 95 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 96 - EXT_KEY	*/	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,
-/* 97 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 98 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 99 - ???	*/	0,	0,	0,	0,	0,	0,
-/*100 - ???	*/	0,	0,	0,	0,	0,	0,
-/*101 - ???	*/	0,	0,	0,	0,	0,	0,
-/*102 - ???	*/	0,	0,	0,	0,	0,	0,
-/*103 - ???	*/	0,	0,	0,	0,	0,	0,
-/*104 - ???	*/	0,	0,	0,	0,	0,	0,
-/*105 - ???	*/	0,	0,	0,	0,	0,	0,
-/*106 - ???	*/	0,	0,	0,	0,	0,	0,
-/*107 - ???	*/	0,	0,	0,	0,	0,	0,
-/*108 - ???	*/	0,	0,	0,	0,	0,	0,
-/*109 - ???	*/	0,	0,	0,	0,	0,	0,
-/*110 - ???	*/	0,	0,	0,	0,	0,	0,
-/*111 - ???	*/	0,	0,	0,	0,	0,	0,
-/*112 - ???	*/	0,	0,	0,	0,	0,	0,
-/*113 - ???	*/	0,	0,	0,	0,	0,	0,
-/*114 - ???	*/	0,	0,	0,	0,	0,	0,
-/*115 - ???	*/	0,	0,	0,	0,	0,	0,
-/*116 - ???	*/	0,	0,	0,	0,	0,	0,
-/*117 - ???	*/	0,	0,	0,	0,	0,	0,
-/*118 - ???	*/	0,	0,	0,	0,	0,	0,
-/*119 - ???	*/	0,	0,	0,	0,	0,	0,
-/*120 - ???	*/	0,	0,	0,	0,	0,	0,
-/*121 - ???	*/	0,	0,	0,	0,	0,	0,
-/*122 - ???	*/	0,	0,	0,	0,	0,	0,
-/*123 - ???	*/	0,	0,	0,	0,	0,	0,
-/*124 - ???	*/	0,	0,	0,	0,	0,	0,
-/*125 - ???	*/	0,	0,	0,	0,	0,	0,
-/*126 - ???	*/	0,	0,	0,	0,	0,	0,
-/*127 - ???	*/	0,	0,	0,	0,	0,	0
-};
Index: trunk/minix/drivers/tty/keymaps/polish.src
===================================================================
--- trunk/minix/drivers/tty/keymaps/polish.src	(revision 9)
+++ 	(revision )
@@ -1,140 +1,0 @@
-/*
- * Keymap for US MF-2 keyboard. + Polish national letters.
- * Modified by Antek Sawicki <tenox@tenox.tc>
- * Charset: ISO-8859-2 - [Polska Norma PN-93 T-42118]
- */
-
-
-u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
-
-/* scan-code		!Shift	Shift	Alt1	Alt2	Alt+Sh	Ctrl	*/
-/* ==================================================================== */
-/* 00 - none	*/	0,	0,	0,	0,	0,	0,	
-/* 01 - ESC	*/	C('['),	C('['),	CA('['),CA('['),CA('['),C('['),
-/* 02 - '1'	*/	'1',	'!',	A('1'),	A('1'),	A('!'),	C('A'),
-/* 03 - '2'	*/	'2',	'@',	A('2'),	A('2'),	A('@'),	C('@'),
-/* 04 - '3'	*/	'3',	'#',	A('3'),	A('3'),	A('#'),	C('C'),
-/* 05 - '4'	*/	'4',	'$',	A('4'),	A('4'),	A('$'),	C('D'),
-/* 06 - '5'	*/	'5',	'%',	A('5'),	A('5'),	A('%'),	C('E'),
-/* 07 - '6'	*/	'6',	'^',	A('6'),	A('6'),	A('^'),	C('^'),
-/* 08 - '7'	*/	'7',	'&',	A('7'),	A('7'),	A('&'),	C('G'),
-/* 09 - '8'	*/	'8',	'*',	A('8'),	A('8'),	A('*'),	C('H'),
-/* 10 - '9'	*/	'9',	'(',	A('9'),	A('9'),	A('('),	C('I'),
-/* 11 - '0'	*/	'0',	')',	A('0'),	A('0'),	A(')'),	C('@'),
-/* 12 - '-'	*/	'-',	'_',	A('-'),	A('-'),	A('_'),	C('_'),
-/* 13 - '='	*/	'=',	'+',	A('='),	A('='),	A('+'),	C('@'),
-/* 14 - BS	*/	C('H'),	C('H'),	CA('H'),CA('H'),CA('H'),0177,	
-/* 15 - TAB	*/	C('I'),	C('I'),	CA('I'),CA('I'),CA('I'),C('I'),
-/* 16 - 'q'	*/	L('q'),	'Q',	A('q'),	A('q'),	A('Q'),	C('Q'),
-/* 17 - 'w'	*/	L('w'),	'W',	A('w'),	A('w'),	A('W'),	C('W'),
-/* 18 - 'e'	*/	L('e'),	'E',	A(0xea),A(0xea),A(0xca),C('E'),
-/* 19 - 'r'	*/	L('r'),	'R',	A('r'),	A('r'),	A('R'),	C('R'),
-/* 20 - 't'	*/	L('t'),	'T',	A('t'),	A('t'),	A('T'),	C('T'),
-/* 21 - 'y'	*/	L('y'),	'Y',	A('y'),	A('y'),	A('Y'),	C('Y'),
-/* 22 - 'u'	*/	L('u'),	'U',	A('u'),	A('u'),	A('U'),	C('U'),
-/* 23 - 'i'	*/	L('i'),	'I',	A('i'),	A('i'),	A('I'),	C('I'),
-/* 24 - 'o'	*/	L('o'),	'O',	A(0xf3),A(0xf3),A(0xd3),C('O'),
-/* 25 - 'p'	*/	L('p'),	'P',	A('p'),	A('p'),	A('P'),	C('P'),
-/* 26 - '['	*/	'[',	'{',	A('['),	A('['),	A('{'),	C('['),
-/* 27 - ']'	*/	']',	'}',	A(']'),	A(']'),	A('}'),	C(']'),
-/* 28 - CR/LF	*/	C('M'),	C('M'),	CA('M'),CA('M'),CA('M'),C('J'),
-/* 29 - Ctrl	*/	CTRL,	CTRL,	CTRL,	CTRL,	CTRL,	CTRL,
-/* 30 - 'a'	*/	L('a'),	'A',	A(0xb1),A(0xb1),A(0xa1),C('A'),
-/* 31 - 's'	*/	L('s'),	'S',	A(0xb6),A(0xb6),A(0xa6),C('S'),
-/* 32 - 'd'	*/	L('d'),	'D',	A('d'),	A('d'),	A('D'),	C('D'),
-/* 33 - 'f'	*/	L('f'),	'F',	A('f'),	A('f'),	A('F'),	C('F'),
-/* 34 - 'g'	*/	L('g'),	'G',	A('g'),	A('g'),	A('G'),	C('G'),
-/* 35 - 'h'	*/	L('h'),	'H',	A('h'),	A('h'),	A('H'),	C('H'),
-/* 36 - 'j'	*/	L('j'),	'J',	A('j'),	A('j'),	A('J'),	C('J'),
-/* 37 - 'k'	*/	L('k'),	'K',	A('k'),	A('k'),	A('K'),	C('K'),
-/* 38 - 'l'	*/	L('l'),	'L',	A(0xb3),A(0xb3),A(0xa3),C('L'),
-/* 39 - ';'	*/	';',	':',	A(';'),	A(';'),	A(':'),	C('@'),
-/* 40 - '\''	*/	'\'',	'"',	A('\''),A('\''),A('"'),	C('@'),
-/* 41 - '`'	*/	'`',	'~',	A('`'),	A('`'),	A('~'),	C('@'),
-/* 42 - l. SHIFT*/	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,
-/* 43 - '\\'	*/	'\\',	'|',	A('\\'),A('\\'),A('|'),	C('\\'),
-/* 44 - 'z'	*/	L('z'),	'Z',	A(0xbf),A(0xbf),A(0xaf),C('Z'),
-/* 45 - 'x'	*/	L('x'),	'X',	A(0xbc),A(0xbc),A(0xac),C('X'),
-/* 46 - 'c'	*/	L('c'),	'C',	A(0xe6),A(0xe6),A(0xc6),C('C'),
-/* 47 - 'v'	*/	L('v'),	'V',	A('v'),	A('v'),	A('V'),	C('V'),
-/* 48 - 'b'	*/	L('b'),	'B',	A('b'),	A('b'),	A('B'),	C('B'),
-/* 49 - 'n'	*/	L('n'),	'N',	A(0xf1),A(0xf1),A(0xd1),C('N'),
-/* 50 - 'm'	*/	L('m'),	'M',	A('m'),	A('m'),	A('M'),	C('M'),
-/* 51 - ','	*/	',',	'<',	A(','),	A(','),	A('<'),	C('@'),
-/* 52 - '.'	*/	'.',	'>',	A('.'),	A('.'),	A('>'),	C('@'),
-/* 53 - '/'	*/	'/',	'?',	A('/'),	A('/'),	A('?'),	C('@'),
-/* 54 - r. SHIFT*/	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,
-/* 55 - '*'	*/	'*',	'*',	A('*'),	A('*'),	A('*'),	C('@'),
-/* 56 - ALT	*/	ALT,	ALT,	ALT,	ALT,	ALT,	ALT,
-/* 57 - ' '	*/	' ',	' ',	A(' '),	A(' '),	A(' '),	C('@'),
-/* 58 - CapsLck	*/	CALOCK,	CALOCK,	CALOCK,	CALOCK,	CALOCK,	CALOCK,
-/* 59 - F1	*/	F1,	SF1,	AF1,	AF1,	ASF1,	CF1,
-/* 60 - F2	*/	F2,	SF2,	AF2,	AF2,	ASF2,	CF2,
-/* 61 - F3	*/	F3,	SF3,	AF3,	AF3,	ASF3,	CF3,
-/* 62 - F4	*/	F4,	SF4,	AF4,	AF4,	ASF4,	CF4,
-/* 63 - F5	*/	F5,	SF5,	AF5,	AF5,	ASF5,	CF5,
-/* 64 - F6	*/	F6,	SF6,	AF6,	AF6,	ASF6,	CF6,
-/* 65 - F7	*/	F7,	SF7,	AF7,	AF7,	ASF7,	CF7,
-/* 66 - F8	*/	F8,	SF8,	AF8,	AF8,	ASF8,	CF8,
-/* 67 - F9	*/	F9,	SF9,	AF9,	AF9,	ASF9,	CF9,
-/* 68 - F10	*/	F10,	SF10,	AF10,	AF10,	ASF10,	CF10,
-/* 69 - NumLock	*/	NLOCK,	NLOCK,	NLOCK,	NLOCK,	NLOCK,	NLOCK,
-/* 70 - ScrLock */	SLOCK,	SLOCK,	SLOCK,	SLOCK,	SLOCK,	SLOCK,
-/* 71 - Home	*/	HOME,	'7',	AHOME,	AHOME,	A('7'),	CHOME,	
-/* 72 - CurUp	*/	UP,	'8',	AUP,	AUP,	A('8'),	CUP,
-/* 73 - PgUp	*/	PGUP,	'9',	APGUP,	APGUP,	A('9'),	CPGUP,
-/* 74 - '-'	*/	NMIN,	'-',	ANMIN,	ANMIN,	A('-'),	CNMIN,
-/* 75 - Left	*/	LEFT,	'4',	ALEFT,	ALEFT,	A('4'),	CLEFT,
-/* 76 - MID	*/	MID,	'5',	AMID,	AMID,	A('5'),	CMID,
-/* 77 - Right	*/	RIGHT,	'6',	ARIGHT,	ARIGHT,	A('6'),	CRIGHT,
-/* 78 - '+'	*/	PLUS,	'+',	APLUS,	APLUS,	A('+'),	CPLUS,
-/* 79 - End	*/	END,	'1',	AEND,	AEND,	A('1'),	CEND,
-/* 80 - Down	*/	DOWN,	'2',	ADOWN,	ADOWN,	A('2'),	CDOWN,
-/* 81 - PgDown	*/	PGDN,	'3',	APGDN,	APGDN,	A('3'),	CPGDN,
-/* 82 - Insert	*/	INSRT,	'0',	AINSRT,	AINSRT,	A('0'),	CINSRT,
-/* 83 - Delete	*/	0177,	'.',	A(0177),A(0177),A('.'),	0177,
-/* 84 - Enter	*/	C('M'),	C('M'),	CA('M'),CA('M'),CA('M'),C('J'),
-/* 85 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 86 - ???	*/	'<',	'>',	A('<'),	A('|'),	A('>'),	C('@'),
-/* 87 - F11	*/	F11,	SF11,	AF11,	AF11,	ASF11,	CF11,
-/* 88 - F12	*/	F12,	SF12,	AF12,	AF12,	ASF12,	CF12,
-/* 89 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 90 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 91 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 92 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 93 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 94 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 95 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 96 - EXT_KEY	*/	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,
-/* 97 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 98 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 99 - ???	*/	0,	0,	0,	0,	0,	0,
-/*100 - ???	*/	0,	0,	0,	0,	0,	0,
-/*101 - ???	*/	0,	0,	0,	0,	0,	0,
-/*102 - ???	*/	0,	0,	0,	0,	0,	0,
-/*103 - ???	*/	0,	0,	0,	0,	0,	0,
-/*104 - ???	*/	0,	0,	0,	0,	0,	0,
-/*105 - ???	*/	0,	0,	0,	0,	0,	0,
-/*106 - ???	*/	0,	0,	0,	0,	0,	0,
-/*107 - ???	*/	0,	0,	0,	0,	0,	0,
-/*108 - ???	*/	0,	0,	0,	0,	0,	0,
-/*109 - ???	*/	0,	0,	0,	0,	0,	0,
-/*110 - ???	*/	0,	0,	0,	0,	0,	0,
-/*111 - ???	*/	0,	0,	0,	0,	0,	0,
-/*112 - ???	*/	0,	0,	0,	0,	0,	0,
-/*113 - ???	*/	0,	0,	0,	0,	0,	0,
-/*114 - ???	*/	0,	0,	0,	0,	0,	0,
-/*115 - ???	*/	0,	0,	0,	0,	0,	0,
-/*116 - ???	*/	0,	0,	0,	0,	0,	0,
-/*117 - ???	*/	0,	0,	0,	0,	0,	0,
-/*118 - ???	*/	0,	0,	0,	0,	0,	0,
-/*119 - ???	*/	0,	0,	0,	0,	0,	0,
-/*120 - ???	*/	0,	0,	0,	0,	0,	0,
-/*121 - ???	*/	0,	0,	0,	0,	0,	0,
-/*122 - ???	*/	0,	0,	0,	0,	0,	0,
-/*123 - ???	*/	0,	0,	0,	0,	0,	0,
-/*124 - ???	*/	0,	0,	0,	0,	0,	0,
-/*125 - ???	*/	0,	0,	0,	0,	0,	0,
-/*126 - ???	*/	0,	0,	0,	0,	0,	0,
-/*127 - ???	*/	0,	0,	0,	0,	0,	0
-};
Index: trunk/minix/drivers/tty/keymaps/scandinavian.src
===================================================================
--- trunk/minix/drivers/tty/keymaps/scandinavian.src	(revision 9)
+++ 	(revision )
@@ -1,138 +1,0 @@
-/* Keymap for Scandinavian keyboard. 
- * by Oliver Reitalu, nolx@nolx.tartu.ee 
- * preliminary version, 8 Sept 1996  
- */
-
-u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
-
-/* scan-code		unsh	Shift	Alt	AltGr	Alt+Sh	Ctrl	*/
-/* ==================================================================== */
-/* 00 - none	*/	0,	0,	0,	0,	0,	0,	
-/* 01 - ESC	*/	C('['),	C('['),	CA('['),C('['),	C('['),	C('['),
-/* 02 - '1'	*/	'1',	'!',	A('1'),	'1',	'!',	C('A'),
-/* 03 - '2'	*/	'2',	'"',	A('2'),	'@',	'@',	C('@'),
-/* 04 - '3'	*/	'3',	'#',	A('3'),	156,	'#',	C('C'),
-/* 05 - '4'	*/	'4',	' ',	A('4'),	'$',	'$',	C('D'),
-/* 06 - '5'	*/	'5',	'%',	A('5'),	'5',	'%',	C('E'),
-/* 07 - '6'	*/	'6',	'&',	A('6'),	'6',	'^',	C('^'),
-/* 08 - '7'	*/	'7',	'/',	A('7'),	'{',	'&',	C('G'),
-/* 09 - '8'	*/	'8',	'(',	A('8'),	'[',	'*',	C('H'),
-/* 10 - '9'	*/	'9',	')',	A('9'),	']',	'(',	C('I'),
-/* 11 - '0'	*/	'0',	'=',	A('0'),	'}',	')',	C('@'),
-/* 12 - '_'	*/	'+',	'?',	0341,	'\\',	'_',	C('_'),
-/* 13 - '='	*/	'\'',	'`',	A('\''),'=',	'+',	C('@'),
-/* 14 - BS	*/	C('H'),	C('H'),	CA('H'),C('H'),	C('H'),	0177,	
-/* 15 - TAB	*/	C('I'),	C('I'),	CA('I'),C('I'),	C('I'),	C('I'),
-/* 16 - 'q'	*/	L('q'),	'Q',	A('q'),	'@',	'Q',	C('Q'),
-/* 17 - 'w'	*/	L('w'),	'W',	A('w'),	'w',	'W',	C('W'),
-/* 18 - 'e'	*/	L('e'),	'E',	A('e'),	'e',	'E',	C('E'),
-/* 19 - 'r'	*/	L('r'),	'R',	A('r'),	'r',	'R',	C('R'),
-/* 20 - 't'	*/	L('t'),	'T',	A('t'),	't',	'T',	C('T'),
-/* 21 - 'y'	*/	L('y'),	'Y',	A('y'),	'y',	'Y',	C('Y'),
-/* 22 - 'u'	*/	L('u'),	'U',	A('u'),	'u',	'U',	C('U'),
-/* 23 - 'i'	*/	L('i'),	'I',	A('i'),	'i',	'I',	C('I'),
-/* 24 - 'o'	*/	L('o'),	'O',	A('o'),	'o',	'O',	C('O'),
-/* 25 - 'p'	*/	L('p'),	'P',	A('p'),	'p',	'P',	C('P'),
-/* 26 - '['	*/	L(134),  143,	0201,	'[',	'{',	C('['),
-/* 27 - ']'	*/	'\"',	'^',	A('+'),	'~',	']',	C(']'),
-/* 28 - CR/LF	*/	C('M'),	C('M'),	CA('M'),C('M'),	C('M'),	C('J'),
-/* 29 - Ctrl	*/	CTRL,	CTRL,	CTRL,	CTRL,	CTRL,	CTRL,
-/* 30 - 'a'	*/	L('a'),	'A',	A('a'),	'a',	'A',	C('A'),
-/* 31 - 's'	*/	L('s'),	'S',	A('s'),	's',	'S',	C('S'),
-/* 32 - 'd'	*/	L('d'),	'D',	A('d'),	'd',	'D',	C('D'),
-/* 33 - 'f'	*/	L('f'),	'F',	A('f'),	'f',	'F',	C('F'),
-/* 34 - 'g'	*/	L('g'),	'G',	A('g'),	'g',	'G',	C('G'),
-/* 35 - 'h'	*/	L('h'),	'H',	A('h'),	'h',	'H',	C('H'),
-/* 36 - 'j'	*/	L('j'),	'J',	A('j'),	'j',	'J',	C('J'),
-/* 37 - 'k'	*/	L('k'),	'K',	A('k'),	'k',	'K',	C('K'),
-/* 38 - 'l'	*/	L('l'),	'L',	A('l'),	'l',	'L',	C('L'),
-/* 39 - ';'	*/	L(0224),0231,	0224,	';',	':',	C('@'),
-/* 40 - '\''	*/	L(0204),0216,	0204,	'\'',	'"',	C('@'),
-/* 41 - '`'	*/	L(21),	171,	A('^'),	'`',	'~',	C('^'),
-/* 42 - SHIFT	*/	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,
-/* 43 - '\\'	*/	39,	'*',	A('#'),	'\\',	'|',	C('\\'),
-/* 44 - 'z'	*/	L('z'),	'Z',	A('z'),	'z',	'Z',	C('Z'),
-/* 45 - 'x'	*/	L('x'),	'X',	A('x'),	'x',	'X',	C('X'),
-/* 46 - 'c'	*/	L('c'),	'C',	A('c'),	'c',	'C',	C('C'),
-/* 47 - 'v'	*/	L('v'),	'V',	A('v'),	'v',	'V',	C('V'),
-/* 48 - 'b'	*/	L('b'),	'B',	A('b'),	'b',	'B',	C('B'),
-/* 49 - 'n'	*/	L('n'),	'N',	A('n'),	'n',	'N',	C('N'),
-/* 50 - 'm'	*/	L('m'),	'M',	A('m'),	0346,	'M',	C('M'),
-/* 51 - ','	*/	',',	';',	A(','),	',',	'<',	C('@'),
-/* 52 - '.'	*/	'.',	':',	A('.'),	'.',	'>',	C('@'),
-/* 53 - '/'	*/	'-',	'_',	A('-'),	'/',	'?',	C('_'),
-/* 54 - SHIFT	*/	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,
-/* 55 - '*'	*/	'*',	'*',	A('*'),	'*',	'*',	C('@'),
-/* 56 - ALT	*/	ALT,	ALT,	ALT,	ALT,	ALT,	ALT,
-/* 57 - ' '	*/	' ',	' ',	A(' '),	' ',	' ',	C('@'),
-/* 58 - CapsLck	*/	CALOCK,	CALOCK,	CALOCK,	CALOCK,	CALOCK,	CALOCK,
-/* 59 - F1	*/	F1,	SF1,	AF1,	AF1,	ASF1,	CF1,
-/* 60 - F2	*/	F2,	SF2,	AF2,	AF2,	ASF2,	CF2,
-/* 61 - F3	*/	F3,	SF3,	AF3,	AF3,	ASF3,	CF3,
-/* 62 - F4	*/	F4,	SF4,	AF4,	AF4,	ASF4,	CF4,
-/* 63 - F5	*/	F5,	SF5,	AF5,	AF5,	ASF5,	CF5,
-/* 64 - F6	*/	F6,	SF6,	AF6,	AF6,	ASF6,	CF6,
-/* 65 - F7	*/	F7,	SF7,	AF7,	AF7,	ASF7,	CF7,
-/* 66 - F8	*/	F8,	SF8,	AF8,	AF8,	ASF8,	CF8,
-/* 67 - F9	*/	F9,	SF9,	AF9,	AF9,	ASF9,	CF9,
-/* 68 - F10	*/	F10,	SF10,	AF10,	AF10,	ASF10,	CF10,
-/* 69 - NumLock	*/	NLOCK,	NLOCK,	NLOCK,	NLOCK,	NLOCK,	NLOCK,
-/* 70 - ScrLock */	SLOCK,	SLOCK,	SLOCK,	SLOCK,	SLOCK,	SLOCK,
-/* 71 - Home	*/	HOME,	'7',	AHOME,	AHOME,	'7',	CHOME,	
-/* 72 - CurUp	*/	UP,	'8',	AUP,	AUP,	'8',	CUP,
-/* 73 - PgUp	*/	PGUP,	'9',	APGUP,	APGUP,	'9',	CPGUP,
-/* 74 - '-'	*/	NMIN,	'-',	ANMIN,	ANMIN,	'-',	CNMIN,
-/* 75 - Left	*/	LEFT,	'4',	ALEFT,	ALEFT,	'4',	CLEFT,
-/* 76 - MID	*/	MID,	'5',	AMID,	AMID,	'5',	CMID,
-/* 77 - Right	*/	RIGHT,	'6',	ARIGHT,	ARIGHT,	'6',	CRIGHT,
-/* 78 - '+'	*/	PLUS,	'+',	APLUS,	APLUS,	'+',	CPLUS,
-/* 79 - End	*/	END,	'1',	AEND,	AEND,	'1',	CEND,
-/* 80 - Down	*/	DOWN,	'2',	ADOWN,	ADOWN,	'2',	CDOWN,
-/* 81 - PgDown	*/	PGDN,	'3',	APGDN,	APGDN,	'3',	CPGDN,
-/* 82 - Insert	*/	INSRT,	'0',	AINSRT,	AINSRT,	'0',	CINSRT,
-/* 83 - Delete	*/	0177,	'.',	A(0177),0177,	'.',	0177,
-/* 84 - Enter	*/	C('M'),	C('M'),	CA('M'),C('M'),	C('M'),	C('J'),
-/* 85 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 86 - ???	*/	'<',	'>',	A('<'),	'|',	'>',	C('@'),
-/* 87 - F11	*/	F11,	SF11,	AF11,	AF11,	ASF11,	CF11,
-/* 88 - F12	*/	F12,	SF12,	AF12,	AF12,	ASF12,	CF12,
-/* 89 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 90 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 91 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 92 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 93 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 94 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 95 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 96 - EXT_KEY	*/	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,
-/* 97 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 98 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 99 - ???	*/	0,	0,	0,	0,	0,	0,
-/*100 - ???	*/	0,	0,	0,	0,	0,	0,
-/*101 - ???	*/	0,	0,	0,	0,	0,	0,
-/*102 - ???	*/	0,	0,	0,	0,	0,	0,
-/*103 - ???	*/	0,	0,	0,	0,	0,	0,
-/*104 - ???	*/	0,	0,	0,	0,	0,	0,
-/*105 - ???	*/	0,	0,	0,	0,	0,	0,
-/*106 - ???	*/	0,	0,	0,	0,	0,	0,
-/*107 - ???	*/	0,	0,	0,	0,	0,	0,
-/*108 - ???	*/	0,	0,	0,	0,	0,	0,
-/*109 - ???	*/	0,	0,	0,	0,	0,	0,
-/*110 - ???	*/	0,	0,	0,	0,	0,	0,
-/*111 - ???	*/	0,	0,	0,	0,	0,	0,
-/*112 - ???	*/	0,	0,	0,	0,	0,	0,
-/*113 - ???	*/	0,	0,	0,	0,	0,	0,
-/*114 - ???	*/	0,	0,	0,	0,	0,	0,
-/*115 - ???	*/	0,	0,	0,	0,	0,	0,
-/*116 - ???	*/	0,	0,	0,	0,	0,	0,
-/*117 - ???	*/	0,	0,	0,	0,	0,	0,
-/*118 - ???	*/	0,	0,	0,	0,	0,	0,
-/*119 - ???	*/	0,	0,	0,	0,	0,	0,
-/*120 - ???	*/	0,	0,	0,	0,	0,	0,
-/*121 - ???	*/	0,	0,	0,	0,	0,	0,
-/*122 - ???	*/	0,	0,	0,	0,	0,	0,
-/*123 - ???	*/	0,	0,	0,	0,	0,	0,
-/*124 - ???	*/	0,	0,	0,	0,	0,	0,
-/*125 - ???	*/	0,	0,	0,	0,	0,	0,
-/*126 - ???	*/	0,	0,	0,	0,	0,	0,
-/*127 - ???	*/	0,	0,	0,	0,	0,	0
-};
Index: trunk/minix/drivers/tty/keymaps/spanish.src
===================================================================
--- trunk/minix/drivers/tty/keymaps/spanish.src	(revision 9)
+++ 	(revision )
@@ -1,138 +1,0 @@
-/* Keymap for Spanish MF-2 keyboard. */
-/* Modified by Javier Garcia Martin jawa@inf.deusto.es */
-
-u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
-
-/* scan-code		!Shift	Shift	Alt	AltGr	Alt+Sh	Ctrl	*/
-/* 
-==================================================================== 
-*/
-/* 00 - none	*/	0,	0,	0,	0,	0,	0,	
-/* 01 - ESC	*/	C('['),	C('['),	CA('['),C('['),	C('['),	C('['),
-/* 02 - '1'	*/	'1',	'!',	A('1'),	'|',	'!',	C('A'),
-/* 03 - '2'	*/	'2',	'"',	A('2'),	'@',	'"',	C('@'),
-/* 04 - '3'	*/	'3',	0372,	A('3'),	'#',	0372,	C('C'),
-/* 05 - '4'	*/	'4',	'$',	A('4'),	'4',	'$',	C('D'),
-/* 06 - '5'	*/	'5',	'%',	A('5'),	'5',	'%',	C('E'),
-/* 07 - '6'	*/	'6',	'&',	A('6'),	0252,	'&',	C('F'),
-/* 08 - '7'	*/	'7',	'/',	A('7'),	'{',	'/',	C('G'),
-/* 09 - '8'	*/	'8',	'(',	A('8'),	'(',	'(',	C('H'),
-/* 10 - '9'	*/	'9',	')',	A('9'),	')',	')',	C('I'),
-/* 11 - '0'	*/	'0',	'=',	A('0'),	'=',	'=',	C('@'),
-/* 12 - '-'	*/	'\'',	'?',	A('\''),'?',	'?',	C('_'),
-/* 13 - '='	*/	0255,	0250,	A(0255),0250,	0250,	C('@'),
-/* 14 - BS	*/	C('H'),	C('H'),	CA('H'),C('H'),	C('H'),	0177,	
-/* 15 - TAB	*/	C('I'),	C('I'),	CA('I'),C('I'),	C('I'),	C('I'),
-/* 16 - 'q'	*/	L('q'),	'Q',	A('q'),	'q',	'Q',	C('Q'),
-/* 17 - 'w'	*/	L('w'),	'W',	A('w'),	'w',	'W',	C('W'),
-/* 18 - 'e'	*/	L('e'),	'E',	A('e'),	'e',	'E',	C('E'),
-/* 19 - 'r'	*/	L('r'),	'R',	A('r'),	'r',	'R',	C('R'),
-/* 20 - 't'	*/	L('t'),	'T',	A('t'),	't',	'T',	C('T'),
-/* 21 - 'y'	*/	L('y'),	'Y',	A('y'),	'y',	'Y',	C('Y'),
-/* 22 - 'u'	*/	L('u'),	'U',	A('u'),	'u',	'U',	C('U'),
-/* 23 - 'i'	*/	L('i'),	'I',	A('i'),	'i',	'I',	C('I'),
-/* 24 - 'o'	*/	L('o'),	'O',	A('o'),	'o',	'O',	C('O'),
-/* 25 - 'p'	*/	L('p'),	'P',	A('p'),	'p',	'P',	C('P'),
-/* 26 - '['	*/	'`',	'^',	A('`'),'[',	'^',	C('['),
-/* 27 - ']'	*/	'+',	'*',	A('+'),	']',	'*',	C(']'),
-/* 28 - CR/LF	*/	C('M'),	C('M'),	CA('M'),C('M'),	C('M'),	C('J'),
-/* 29 - Ctrl	*/	CTRL,	CTRL,	CTRL,	CTRL,	CTRL,	CTRL,
-/* 30 - 'a'	*/	L('a'),	'A',	A('a'),	'a',	'A',	C('A'),
-/* 31 - 's'	*/	L('s'),	'S',	A('s'),	's',	'S',	C('S'),
-/* 32 - 'd'	*/	L('d'),	'D',	A('d'),	'd',	'D',	C('D'),
-/* 33 - 'f'	*/	L('f'),	'F',	A('f'),	'f',	'F',	C('F'),
-/* 34 - 'g'	*/	L('g'),	'G',	A('g'),	'g',	'G',	C('G'),
-/* 35 - 'h'	*/	L('h'),	'H',	A('h'),	'h',	'H',	C('H'),
-/* 36 - 'j'	*/	L('j'),	'J',	A('j'),	'j',	'J',	C('J'),
-/* 37 - 'k'	*/	L('k'),	'K',	A('k'),	'k',	'K',	C('K'),
-/* 38 - 'l'	*/	L('l'),	'L',	A('l'),	'l',	'L',	C('L'),
-/* 39 - ';'	*/	L(0244),0245,	A(0244),0244,	0245,	C('@'),
-/* 40 - '\''	*/	'\'',	'"',	A('\''),'{',	'"',	C('@'),
-/* 41 - '`'	*/	0247,	0246,	A(0247),'\\',	0246,	C('@'),
-/* 42 - l. SHIFT*/	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,
-/* 43 - '\\'	*/	L(0207),0200,	A(0207),'}',	0200,	C('@'),
-/* 44 - 'z'	*/	L('z'),	'Z',	A('z'),	'z',	'Z',	C('Z'),
-/* 45 - 'x'	*/	L('x'),	'X',	A('x'),	'x',	'X',	C('X'),
-/* 46 - 'c'	*/	L('c'),	'C',	A('c'),	'c',	'C',	C('C'),
-/* 47 - 'v'	*/	L('v'),	'V',	A('v'),	'v',	'V',	C('V'),
-/* 48 - 'b'	*/	L('b'),	'B',	A('b'),	'b',	'B',	C('B'),
-/* 49 - 'n'	*/	L('n'),	'N',	A('n'),	'n',	'N',	C('N'),
-/* 50 - 'm'	*/	L('m'),	'M',	A('m'),	'm',	'M',	C('M'),
-/* 51 - ','	*/	',',	';',	A(','),	',',	';',	C('@'),
-/* 52 - '.'	*/	'.',	':',	A('.'),	'.',	':',	C('@'),
-/* 53 - '/'	*/	'-',	'_',	A('-'), '-',	'_',	C('@'),
-/* 54 - r. SHIFT*/	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,
-/* 55 - '*'	*/	'*',	'*',	A('*'),	'*',	'*',	C('M'),
-/* 56 - ALT	*/	ALT,	ALT,	ALT,	ALT,	ALT,	ALT,
-/* 57 - ' '	*/	' ',	' ',	A(' '),	' ',	' ',	C('@'),
-/* 58 - CapsLck	*/	CALOCK,	CALOCK,	CALOCK,	CALOCK,	CALOCK,	CALOCK,
-/* 59 - F1	*/	F1,	SF1,	AF1,	AF1,	ASF1,	CF1,
-/* 60 - F2	*/	F2,	SF2,	AF2,	AF2,	ASF2,	CF2,
-/* 61 - F3	*/	F3,	SF3,	AF3,	AF3,	ASF3,	CF3,
-/* 62 - F4	*/	F4,	SF4,	AF4,	AF4,	ASF4,	CF4,
-/* 63 - F5	*/	F5,	SF5,	AF5,	AF5,	ASF5,	CF5,
-/* 64 - F6	*/	F6,	SF6,	AF6,	AF6,	ASF6,	CF6,
-/* 65 - F7	*/	F7,	SF7,	AF7,	AF7,	ASF7,	CF7,
-/* 66 - F8	*/	F8,	SF8,	AF8,	AF8,	ASF8,	CF8,
-/* 67 - F9	*/	F9,	SF9,	AF9,	AF9,	ASF9,	CF9,
-/* 68 - F10	*/	F10,	SF10,	AF10,	AF10,	ASF10,	CF10,
-/* 69 - NumLock	*/	NLOCK,	NLOCK,	NLOCK,	NLOCK,	NLOCK,	NLOCK,
-/* 70 - ScrLock */	SLOCK,	SLOCK,	SLOCK,	SLOCK,	SLOCK,	SLOCK,
-/* 71 - Home	*/	HOME,	'7',	AHOME,	AHOME,	'7',	CHOME,	
-/* 72 - CurUp	*/	UP,	'8',	AUP,	AUP,	'8',	CUP,
-/* 73 - PgUp	*/	PGUP,	'9',	APGUP,	APGUP,	'9',	CPGUP,
-/* 74 - '-'	*/	NMIN,	'-',	ANMIN,	ANMIN,	'-',	CNMIN,
-/* 75 - Left	*/	LEFT,	'4',	ALEFT,	ALEFT,	'4',	CLEFT,
-/* 76 - MID	*/	MID,	'5',	AMID,	AMID,	'5',	CMID,
-/* 77 - Right	*/	RIGHT,	'6',	ARIGHT,	ARIGHT,	'6',	CRIGHT,
-/* 78 - '+'	*/	PLUS,	'+',	APLUS,	APLUS,	'+',	CPLUS,
-/* 79 - End	*/	END,	'1',	AEND,	AEND,	'1',	CEND,
-/* 80 - Down	*/	DOWN,	'2',	ADOWN,	ADOWN,	'2',	CDOWN,
-/* 81 - PgDown	*/	PGDN,	'3',	APGDN,	APGDN,	'3',	CPGDN,
-/* 82 - Insert	*/	INSRT,	'0',	AINSRT,	AINSRT,	'0',	CINSRT,
-/* 83 - Delete	*/	0177,	'.',	A(0177),0177,	'.',	0177,
-/* 84 - Enter	*/	C('M'),	C('M'),	CA('M'),C('M'),	C('M'),	C('J'),
-/* 85 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 86 - ???	*/	'<',	'>',	A('<'),	'<',	'>',	C('@'),
-/* 87 - F11	*/	F11,	SF11,	AF11,	AF11,	ASF11,	CF11,
-/* 88 - F12	*/	F12,	SF12,	AF12,	AF12,	ASF12,	CF12,
-/* 89 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 90 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 91 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 92 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 93 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 94 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 95 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 96 - EXT_KEY	*/	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,
-/* 97 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 98 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 99 - ???	*/	0,	0,	0,	0,	0,	0,
-/*100 - ???	*/	0,	0,	0,	0,	0,	0,
-/*101 - ???	*/	0,	0,	0,	0,	0,	0,
-/*102 - ???	*/	0,	0,	0,	0,	0,	0,
-/*103 - ???	*/	0,	0,	0,	0,	0,	0,
-/*104 - ???	*/	0,	0,	0,	0,	0,	0,
-/*105 - ???	*/	0,	0,	0,	0,	0,	0,
-/*106 - ???	*/	0,	0,	0,	0,	0,	0,
-/*107 - ???	*/	0,	0,	0,	0,	0,	0,
-/*108 - ???	*/	0,	0,	0,	0,	0,	0,
-/*109 - ???	*/	0,	0,	0,	0,	0,	0,
-/*110 - ???	*/	0,	0,	0,	0,	0,	0,
-/*111 - ???	*/	0,	0,	0,	0,	0,	0,
-/*112 - ???	*/	0,	0,	0,	0,	0,	0,
-/*113 - ???	*/	0,	0,	0,	0,	0,	0,
-/*114 - ???	*/	0,	0,	0,	0,	0,	0,
-/*115 - ???	*/	0,	0,	0,	0,	0,	0,
-/*116 - ???	*/	0,	0,	0,	0,	0,	0,
-/*117 - ???	*/	0,	0,	0,	0,	0,	0,
-/*118 - ???	*/	0,	0,	0,	0,	0,	0,
-/*119 - ???	*/	0,	0,	0,	0,	0,	0,
-/*120 - ???	*/	0,	0,	0,	0,	0,	0,
-/*121 - ???	*/	0,	0,	0,	0,	0,	0,
-/*122 - ???	*/	0,	0,	0,	0,	0,	0,
-/*123 - ???	*/	0,	0,	0,	0,	0,	0,
-/*124 - ???	*/	0,	0,	0,	0,	0,	0,
-/*125 - ???	*/	0,	0,	0,	0,	0,	0,
-/*126 - ???	*/	0,	0,	0,	0,	0,	0,
-/*127 - ???	*/	0,	0,	0,	0,	0,	0
-};
Index: trunk/minix/drivers/tty/keymaps/uk.src
===================================================================
--- trunk/minix/drivers/tty/keymaps/uk.src	(revision 9)
+++ 	(revision )
@@ -1,135 +1,0 @@
-/* Keymap for standard UK keyboard.			Author: Darren Mason */
-
-u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
-
-/* scan-code		!Shift	Shift	Alt1	Alt2	Alt+Sh	Ctrl	*/
-/* ==================================================================== */
-/* 00 - none	*/	0,	0,	0,	0,	0,	0,	
-/* 01 - ESC	*/	C('['),	C('['),	CA('['),CA('['),CA('['),C('['),
-/* 02 - '1'	*/	'1',	'!',	A('1'),	A('1'),	A('!'),	C('A'),
-/* 03 - '2'	*/	'2',	'"',	A('2'),	A('2'),	A('@'),	C('@'),
-/* 04 - '3'	*/	'3',	156,	A('3'),	A('3'),	A(156),	C('C'),
-/* 05 - '4'	*/	'4',	'$',	A('4'),	A('4'),	A('$'),	C('D'),
-/* 06 - '5'	*/	'5',	'%',	A('5'),	A('5'),	A('%'),	C('E'),
-/* 07 - '6'	*/	'6',	'^',	A('6'),	A('6'),	A('^'),	C('^'),
-/* 08 - '7'	*/	'7',	'&',	A('7'),	A('7'),	A('&'),	C('G'),
-/* 09 - '8'	*/	'8',	'*',	A('8'),	A('8'),	A('*'),	C('H'),
-/* 10 - '9'	*/	'9',	'(',	A('9'),	A('9'),	A('('),	C('I'),
-/* 11 - '0'	*/	'0',	')',	A('0'),	A('0'),	A(')'),	C('@'),
-/* 12 - '-'	*/	'-',	'_',	A('-'),	A('-'),	A('_'),	C('_'),
-/* 13 - '='	*/	'=',	'+',	A('='),	A('='),	A('+'),	C('@'),
-/* 14 - BS	*/	C('H'),	C('H'),	CA('H'),CA('H'),CA('H'),0177,	
-/* 15 - TAB	*/	C('I'),	C('I'),	CA('I'),CA('I'),CA('I'),C('I'),
-/* 16 - 'q'	*/	L('q'),	'Q',	A('q'),	A('q'),	A('Q'),	C('Q'),
-/* 17 - 'w'	*/	L('w'),	'W',	A('w'),	A('w'),	A('W'),	C('W'),
-/* 18 - 'e'	*/	L('e'),	'E',	A('e'),	A('e'),	A('E'),	C('E'),
-/* 19 - 'r'	*/	L('r'),	'R',	A('r'),	A('r'),	A('R'),	C('R'),
-/* 20 - 't'	*/	L('t'),	'T',	A('t'),	A('t'),	A('T'),	C('T'),
-/* 21 - 'y'	*/	L('y'),	'Y',	A('y'),	A('y'),	A('Y'),	C('Y'),
-/* 22 - 'u'	*/	L('u'),	'U',	A('u'),	A('u'),	A('U'),	C('U'),
-/* 23 - 'i'	*/	L('i'),	'I',	A('i'),	A('i'),	A('I'),	C('I'),
-/* 24 - 'o'	*/	L('o'),	'O',	A('o'),	A('o'),	A('O'),	C('O'),
-/* 25 - 'p'	*/	L('p'),	'P',	A('p'),	A('p'),	A('P'),	C('P'),
-/* 26 - '['	*/	'[',	'{',	A('['),	A('['),	A('{'),	C('['),
-/* 27 - ']'	*/	']',	'}',	A(']'),	A(']'),	A('}'),	C(']'),
-/* 28 - CR/LF	*/	C('M'),	C('M'),	CA('M'),CA('M'),CA('M'),C('J'),
-/* 29 - Ctrl	*/	CTRL,	CTRL,	CTRL,	CTRL,	CTRL,	CTRL,
-/* 30 - 'a'	*/	L('a'),	'A',	A('a'),	A('a'),	A('A'),	C('A'),
-/* 31 - 's'	*/	L('s'),	'S',	A('s'),	A('s'),	A('S'),	C('S'),
-/* 32 - 'd'	*/	L('d'),	'D',	A('d'),	A('d'),	A('D'),	C('D'),
-/* 33 - 'f'	*/	L('f'),	'F',	A('f'),	A('f'),	A('F'),	C('F'),
-/* 34 - 'g'	*/	L('g'),	'G',	A('g'),	A('g'),	A('G'),	C('G'),
-/* 35 - 'h'	*/	L('h'),	'H',	A('h'),	A('h'),	A('H'),	C('H'),
-/* 36 - 'j'	*/	L('j'),	'J',	A('j'),	A('j'),	A('J'),	C('J'),
-/* 37 - 'k'	*/	L('k'),	'K',	A('k'),	A('k'),	A('K'),	C('K'),
-/* 38 - 'l'	*/	L('l'),	'L',	A('l'),	A('l'),	A('L'),	C('L'),
-/* 39 - ';'	*/	';',	':',	A(';'),	A(';'),	A(':'),	C('@'),
-/* 40 - '\''	*/	'\'',	'@',	A('\''),A('\''),A('"'),	C('@'),
-/* 41 - '`'	*/	'`',	'~',	A('`'),	A('`'),	A('~'),	C('@'),
-/* 42 - l. SHIFT*/	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,
-/* 43 - '#'	*/	'#',	'~',	A('#'),	A('#'),	A('~'),	C('#'),
-/* 44 - 'z'	*/	L('z'),	'Z',	A('z'),	A('z'),	A('Z'),	C('Z'),
-/* 45 - 'x'	*/	L('x'),	'X',	A('x'),	A('x'),	A('X'),	C('X'),
-/* 46 - 'c'	*/	L('c'),	'C',	A('c'),	A('c'),	A('C'),	C('C'),
-/* 47 - 'v'	*/	L('v'),	'V',	A('v'),	A('v'),	A('V'),	C('V'),
-/* 48 - 'b'	*/	L('b'),	'B',	A('b'),	A('b'),	A('B'),	C('B'),
-/* 49 - 'n'	*/	L('n'),	'N',	A('n'),	A('n'),	A('N'),	C('N'),
-/* 50 - 'm'	*/	L('m'),	'M',	A('m'),	A('m'),	A('M'),	C('M'),
-/* 51 - ','	*/	',',	'<',	A(','),	A(','),	A('<'),	C('@'),
-/* 52 - '.'	*/	'.',	'>',	A('.'),	A('.'),	A('>'),	C('@'),
-/* 53 - '/'	*/	'/',	'?',	A('/'),	A('/'),	A('?'),	C('@'),
-/* 54 - r. SHIFT*/	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,
-/* 55 - '*'	*/	'*',	'*',	A('*'),	A('*'),	A('*'),	C('@'),
-/* 56 - ALT	*/	ALT,	ALT,	ALT,	ALT,	ALT,	ALT,
-/* 57 - ' '	*/	' ',	' ',	A(' '),	A(' '),	A(' '),	C('@'),
-/* 58 - CapsLck	*/	CALOCK,	CALOCK,	CALOCK,	CALOCK,	CALOCK,	CALOCK,
-/* 59 - F1	*/	F1,	SF1,	AF1,	AF1,	ASF1,	CF1,
-/* 60 - F2	*/	F2,	SF2,	AF2,	AF2,	ASF2,	CF2,
-/* 61 - F3	*/	F3,	SF3,	AF3,	AF3,	ASF3,	CF3,
-/* 62 - F4	*/	F4,	SF4,	AF4,	AF4,	ASF4,	CF4,
-/* 63 - F5	*/	F5,	SF5,	AF5,	AF5,	ASF5,	CF5,
-/* 64 - F6	*/	F6,	SF6,	AF6,	AF6,	ASF6,	CF6,
-/* 65 - F7	*/	F7,	SF7,	AF7,	AF7,	ASF7,	CF7,
-/* 66 - F8	*/	F8,	SF8,	AF8,	AF8,	ASF8,	CF8,
-/* 67 - F9	*/	F9,	SF9,	AF9,	AF9,	ASF9,	CF9,
-/* 68 - F10	*/	F10,	SF10,	AF10,	AF10,	ASF10,	CF10,
-/* 69 - NumLock	*/	NLOCK,	NLOCK,	NLOCK,	NLOCK,	NLOCK,	NLOCK,
-/* 70 - ScrLock */	SLOCK,	SLOCK,	SLOCK,	SLOCK,	SLOCK,	SLOCK,
-/* 71 - Home	*/	HOME,	'7',	AHOME,	AHOME,	A('7'),	CHOME,	
-/* 72 - CurUp	*/	UP,	'8',	AUP,	AUP,	A('8'),	CUP,
-/* 73 - PgUp	*/	PGUP,	'9',	APGUP,	APGUP,	A('9'),	CPGUP,
-/* 74 - '-'	*/	NMIN,	'-',	ANMIN,	ANMIN,	A('-'),	CNMIN,
-/* 75 - Left	*/	LEFT,	'4',	ALEFT,	ALEFT,	A('4'),	CLEFT,
-/* 76 - MID	*/	MID,	'5',	AMID,	AMID,	A('5'),	CMID,
-/* 77 - Right	*/	RIGHT,	'6',	ARIGHT,	ARIGHT,	A('6'),	CRIGHT,
-/* 78 - '+'	*/	PLUS,	'+',	APLUS,	APLUS,	A('+'),	CPLUS,
-/* 79 - End	*/	END,	'1',	AEND,	AEND,	A('1'),	CEND,
-/* 80 - Down	*/	DOWN,	'2',	ADOWN,	ADOWN,	A('2'),	CDOWN,
-/* 81 - PgDown	*/	PGDN,	'3',	APGDN,	APGDN,	A('3'),	CPGDN,
-/* 82 - Insert	*/	INSRT,	'0',	AINSRT,	AINSRT,	A('0'),	CINSRT,
-/* 83 - Delete	*/	0177,	'.',	A(0177),A(0177),A('.'),	0177,
-/* 84 - Enter	*/	C('M'),	C('M'),	CA('M'),CA('M'),CA('M'),C('J'),
-/* 85 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 86 - ???	*/	'\\',	'|',	A('\\'),A('|'),	A('|'),	C('@'),
-/* 87 - F11	*/	F11,	SF11,	AF11,	AF11,	ASF11,	CF11,
-/* 88 - F12	*/	F12,	SF12,	AF12,	AF12,	ASF12,	CF12,
-/* 89 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 90 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 91 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 92 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 93 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 94 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 95 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 96 - EXT_KEY	*/	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,
-/* 97 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 98 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 99 - ???	*/	0,	0,	0,	0,	0,	0,
-/*100 - ???	*/	0,	0,	0,	0,	0,	0,
-/*101 - ???	*/	0,	0,	0,	0,	0,	0,
-/*102 - ???	*/	0,	0,	0,	0,	0,	0,
-/*103 - ???	*/	0,	0,	0,	0,	0,	0,
-/*104 - ???	*/	0,	0,	0,	0,	0,	0,
-/*105 - ???	*/	0,	0,	0,	0,	0,	0,
-/*106 - ???	*/	0,	0,	0,	0,	0,	0,
-/*107 - ???	*/	0,	0,	0,	0,	0,	0,
-/*108 - ???	*/	0,	0,	0,	0,	0,	0,
-/*109 - ???	*/	0,	0,	0,	0,	0,	0,
-/*110 - ???	*/	0,	0,	0,	0,	0,	0,
-/*111 - ???	*/	0,	0,	0,	0,	0,	0,
-/*112 - ???	*/	0,	0,	0,	0,	0,	0,
-/*113 - ???	*/	0,	0,	0,	0,	0,	0,
-/*114 - ???	*/	0,	0,	0,	0,	0,	0,
-/*115 - ???	*/	0,	0,	0,	0,	0,	0,
-/*116 - ???	*/	0,	0,	0,	0,	0,	0,
-/*117 - ???	*/	0,	0,	0,	0,	0,	0,
-/*118 - ???	*/	0,	0,	0,	0,	0,	0,
-/*119 - ???	*/	0,	0,	0,	0,	0,	0,
-/*120 - ???	*/	0,	0,	0,	0,	0,	0,
-/*121 - ???	*/	0,	0,	0,	0,	0,	0,
-/*122 - ???	*/	0,	0,	0,	0,	0,	0,
-/*123 - ???	*/	0,	0,	0,	0,	0,	0,
-/*124 - ???	*/	0,	0,	0,	0,	0,	0,
-/*125 - ???	*/	0,	0,	0,	0,	0,	0,
-/*126 - ???	*/	0,	0,	0,	0,	0,	0,
-/*127 - ???	*/	0,	0,	0,	0,	0,	0
-};
Index: trunk/minix/drivers/tty/keymaps/us-std.src
===================================================================
--- trunk/minix/drivers/tty/keymaps/us-std.src	(revision 9)
+++ 	(revision )
@@ -1,135 +1,0 @@
-/* Keymap for US MF-2 keyboard. */
-
-u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
-
-/* scan-code		!Shift	Shift	Alt1	Alt2	Alt+Sh	Ctrl	*/
-/* ==================================================================== */
-/* 00 - none	*/	0,	0,	0,	0,	0,	0,	
-/* 01 - ESC	*/	C('['),	C('['),	CA('['),CA('['),CA('['),C('['),
-/* 02 - '1'	*/	'1',	'!',	A('1'),	A('1'),	A('!'),	C('A'),
-/* 03 - '2'	*/	'2',	'@',	A('2'),	A('2'),	A('@'),	C('@'),
-/* 04 - '3'	*/	'3',	'#',	A('3'),	A('3'),	A('#'),	C('C'),
-/* 05 - '4'	*/	'4',	'$',	A('4'),	A('4'),	A('$'),	C('D'),
-/* 06 - '5'	*/	'5',	'%',	A('5'),	A('5'),	A('%'),	C('E'),
-/* 07 - '6'	*/	'6',	'^',	A('6'),	A('6'),	A('^'),	C('^'),
-/* 08 - '7'	*/	'7',	'&',	A('7'),	A('7'),	A('&'),	C('G'),
-/* 09 - '8'	*/	'8',	'*',	A('8'),	A('8'),	A('*'),	C('H'),
-/* 10 - '9'	*/	'9',	'(',	A('9'),	A('9'),	A('('),	C('I'),
-/* 11 - '0'	*/	'0',	')',	A('0'),	A('0'),	A(')'),	C('@'),
-/* 12 - '-'	*/	'-',	'_',	A('-'),	A('-'),	A('_'),	C('_'),
-/* 13 - '='	*/	'=',	'+',	A('='),	A('='),	A('+'),	C('@'),
-/* 14 - BS	*/	C('H'),	C('H'),	CA('H'),CA('H'),CA('H'),0177,	
-/* 15 - TAB	*/	C('I'),	C('I'),	CA('I'),CA('I'),CA('I'),C('I'),
-/* 16 - 'q'	*/	L('q'),	'Q',	A('q'),	A('q'),	A('Q'),	C('Q'),
-/* 17 - 'w'	*/	L('w'),	'W',	A('w'),	A('w'),	A('W'),	C('W'),
-/* 18 - 'e'	*/	L('e'),	'E',	A('e'),	A('e'),	A('E'),	C('E'),
-/* 19 - 'r'	*/	L('r'),	'R',	A('r'),	A('r'),	A('R'),	C('R'),
-/* 20 - 't'	*/	L('t'),	'T',	A('t'),	A('t'),	A('T'),	C('T'),
-/* 21 - 'y'	*/	L('y'),	'Y',	A('y'),	A('y'),	A('Y'),	C('Y'),
-/* 22 - 'u'	*/	L('u'),	'U',	A('u'),	A('u'),	A('U'),	C('U'),
-/* 23 - 'i'	*/	L('i'),	'I',	A('i'),	A('i'),	A('I'),	C('I'),
-/* 24 - 'o'	*/	L('o'),	'O',	A('o'),	A('o'),	A('O'),	C('O'),
-/* 25 - 'p'	*/	L('p'),	'P',	A('p'),	A('p'),	A('P'),	C('P'),
-/* 26 - '['	*/	'[',	'{',	A('['),	A('['),	A('{'),	C('['),
-/* 27 - ']'	*/	']',	'}',	A(']'),	A(']'),	A('}'),	C(']'),
-/* 28 - CR/LF	*/	C('M'),	C('M'),	CA('M'),CA('M'),CA('M'),C('J'),
-/* 29 - Ctrl	*/	CTRL,	CTRL,	CTRL,	CTRL,	CTRL,	CTRL,
-/* 30 - 'a'	*/	L('a'),	'A',	A('a'),	A('a'),	A('A'),	C('A'),
-/* 31 - 's'	*/	L('s'),	'S',	A('s'),	A('s'),	A('S'),	C('S'),
-/* 32 - 'd'	*/	L('d'),	'D',	A('d'),	A('d'),	A('D'),	C('D'),
-/* 33 - 'f'	*/	L('f'),	'F',	A('f'),	A('f'),	A('F'),	C('F'),
-/* 34 - 'g'	*/	L('g'),	'G',	A('g'),	A('g'),	A('G'),	C('G'),
-/* 35 - 'h'	*/	L('h'),	'H',	A('h'),	A('h'),	A('H'),	C('H'),
-/* 36 - 'j'	*/	L('j'),	'J',	A('j'),	A('j'),	A('J'),	C('J'),
-/* 37 - 'k'	*/	L('k'),	'K',	A('k'),	A('k'),	A('K'),	C('K'),
-/* 38 - 'l'	*/	L('l'),	'L',	A('l'),	A('l'),	A('L'),	C('L'),
-/* 39 - ';'	*/	';',	':',	A(';'),	A(';'),	A(':'),	C('@'),
-/* 40 - '\''	*/	'\'',	'"',	A('\''),A('\''),A('"'),	C('@'),
-/* 41 - '`'	*/	'`',	'~',	A('`'),	A('`'),	A('~'),	C('@'),
-/* 42 - l. SHIFT*/	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,
-/* 43 - '\\'	*/	'\\',	'|',	A('\\'),A('\\'),A('|'),	C('\\'),
-/* 44 - 'z'	*/	L('z'),	'Z',	A('z'),	A('z'),	A('Z'),	C('Z'),
-/* 45 - 'x'	*/	L('x'),	'X',	A('x'),	A('x'),	A('X'),	C('X'),
-/* 46 - 'c'	*/	L('c'),	'C',	A('c'),	A('c'),	A('C'),	C('C'),
-/* 47 - 'v'	*/	L('v'),	'V',	A('v'),	A('v'),	A('V'),	C('V'),
-/* 48 - 'b'	*/	L('b'),	'B',	A('b'),	A('b'),	A('B'),	C('B'),
-/* 49 - 'n'	*/	L('n'),	'N',	A('n'),	A('n'),	A('N'),	C('N'),
-/* 50 - 'm'	*/	L('m'),	'M',	A('m'),	A('m'),	A('M'),	C('M'),
-/* 51 - ','	*/	',',	'<',	A(','),	A(','),	A('<'),	C('@'),
-/* 52 - '.'	*/	'.',	'>',	A('.'),	A('.'),	A('>'),	C('@'),
-/* 53 - '/'	*/	'/',	'?',	A('/'),	A('/'),	A('?'),	C('@'),
-/* 54 - r. SHIFT*/	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,
-/* 55 - '*'	*/	'*',	'*',	A('*'),	A('*'),	A('*'),	C('@'),
-/* 56 - ALT	*/	ALT,	ALT,	ALT,	ALT,	ALT,	ALT,
-/* 57 - ' '	*/	' ',	' ',	A(' '),	A(' '),	A(' '),	C('@'),
-/* 58 - CapsLck	*/	CALOCK,	CALOCK,	CALOCK,	CALOCK,	CALOCK,	CALOCK,
-/* 59 - F1	*/	F1,	SF1,	AF1,	AF1,	ASF1,	CF1,
-/* 60 - F2	*/	F2,	SF2,	AF2,	AF2,	ASF2,	CF2,
-/* 61 - F3	*/	F3,	SF3,	AF3,	AF3,	ASF3,	CF3,
-/* 62 - F4	*/	F4,	SF4,	AF4,	AF4,	ASF4,	CF4,
-/* 63 - F5	*/	F5,	SF5,	AF5,	AF5,	ASF5,	CF5,
-/* 64 - F6	*/	F6,	SF6,	AF6,	AF6,	ASF6,	CF6,
-/* 65 - F7	*/	F7,	SF7,	AF7,	AF7,	ASF7,	CF7,
-/* 66 - F8	*/	F8,	SF8,	AF8,	AF8,	ASF8,	CF8,
-/* 67 - F9	*/	F9,	SF9,	AF9,	AF9,	ASF9,	CF9,
-/* 68 - F10	*/	F10,	SF10,	AF10,	AF10,	ASF10,	CF10,
-/* 69 - NumLock	*/	NLOCK,	NLOCK,	NLOCK,	NLOCK,	NLOCK,	NLOCK,
-/* 70 - ScrLock */	SLOCK,	SLOCK,	SLOCK,	SLOCK,	SLOCK,	SLOCK,
-/* 71 - Home	*/	HOME,	'7',	AHOME,	AHOME,	A('7'),	CHOME,	
-/* 72 - CurUp	*/	UP,	'8',	AUP,	AUP,	A('8'),	CUP,
-/* 73 - PgUp	*/	PGUP,	'9',	APGUP,	APGUP,	A('9'),	CPGUP,
-/* 74 - '-'	*/	NMIN,	'-',	ANMIN,	ANMIN,	A('-'),	CNMIN,
-/* 75 - Left	*/	LEFT,	'4',	ALEFT,	ALEFT,	A('4'),	CLEFT,
-/* 76 - MID	*/	MID,	'5',	AMID,	AMID,	A('5'),	CMID,
-/* 77 - Right	*/	RIGHT,	'6',	ARIGHT,	ARIGHT,	A('6'),	CRIGHT,
-/* 78 - '+'	*/	PLUS,	'+',	APLUS,	APLUS,	A('+'),	CPLUS,
-/* 79 - End	*/	END,	'1',	AEND,	AEND,	A('1'),	CEND,
-/* 80 - Down	*/	DOWN,	'2',	ADOWN,	ADOWN,	A('2'),	CDOWN,
-/* 81 - PgDown	*/	PGDN,	'3',	APGDN,	APGDN,	A('3'),	CPGDN,
-/* 82 - Insert	*/	INSRT,	'0',	AINSRT,	AINSRT,	A('0'),	CINSRT,
-/* 83 - Delete	*/	0177,	'.',	A(0177),A(0177),A('.'),	0177,
-/* 84 - Enter	*/	C('M'),	C('M'),	CA('M'),CA('M'),CA('M'),C('J'),
-/* 85 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 86 - ???	*/	'<',	'>',	A('<'),	A('|'),	A('>'),	C('@'),
-/* 87 - F11	*/	F11,	SF11,	AF11,	AF11,	ASF11,	CF11,
-/* 88 - F12	*/	F12,	SF12,	AF12,	AF12,	ASF12,	CF12,
-/* 89 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 90 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 91 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 92 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 93 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 94 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 95 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 96 - EXT_KEY	*/	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,
-/* 97 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 98 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 99 - ???	*/	0,	0,	0,	0,	0,	0,
-/*100 - ???	*/	0,	0,	0,	0,	0,	0,
-/*101 - ???	*/	0,	0,	0,	0,	0,	0,
-/*102 - ???	*/	0,	0,	0,	0,	0,	0,
-/*103 - ???	*/	0,	0,	0,	0,	0,	0,
-/*104 - ???	*/	0,	0,	0,	0,	0,	0,
-/*105 - ???	*/	0,	0,	0,	0,	0,	0,
-/*106 - ???	*/	0,	0,	0,	0,	0,	0,
-/*107 - ???	*/	0,	0,	0,	0,	0,	0,
-/*108 - ???	*/	0,	0,	0,	0,	0,	0,
-/*109 - ???	*/	0,	0,	0,	0,	0,	0,
-/*110 - ???	*/	0,	0,	0,	0,	0,	0,
-/*111 - ???	*/	0,	0,	0,	0,	0,	0,
-/*112 - ???	*/	0,	0,	0,	0,	0,	0,
-/*113 - ???	*/	0,	0,	0,	0,	0,	0,
-/*114 - ???	*/	0,	0,	0,	0,	0,	0,
-/*115 - ???	*/	0,	0,	0,	0,	0,	0,
-/*116 - ???	*/	0,	0,	0,	0,	0,	0,
-/*117 - ???	*/	0,	0,	0,	0,	0,	0,
-/*118 - ???	*/	0,	0,	0,	0,	0,	0,
-/*119 - ???	*/	0,	0,	0,	0,	0,	0,
-/*120 - ???	*/	0,	0,	0,	0,	0,	0,
-/*121 - ???	*/	0,	0,	0,	0,	0,	0,
-/*122 - ???	*/	0,	0,	0,	0,	0,	0,
-/*123 - ???	*/	0,	0,	0,	0,	0,	0,
-/*124 - ???	*/	0,	0,	0,	0,	0,	0,
-/*125 - ???	*/	0,	0,	0,	0,	0,	0,
-/*126 - ???	*/	0,	0,	0,	0,	0,	0,
-/*127 - ???	*/	0,	0,	0,	0,	0,	0
-};
Index: trunk/minix/drivers/tty/keymaps/us-swap.src
===================================================================
--- trunk/minix/drivers/tty/keymaps/us-swap.src	(revision 9)
+++ 	(revision )
@@ -1,135 +1,0 @@
-/* Keymap for US MF-2 keyboard with the Caps Lock and Control key swapped. */
-
-u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
-
-/* scan-code		!Shift	Shift	Alt1	Alt2	Alt+Sh	Ctrl	*/
-/* ==================================================================== */
-/* 00 - none	*/	0,	0,	0,	0,	0,	0,	
-/* 01 - ESC	*/	C('['),	C('['),	CA('['),CA('['),CA('['),C('['),
-/* 02 - '1'	*/	'1',	'!',	A('1'),	A('1'),	A('!'),	C('A'),
-/* 03 - '2'	*/	'2',	'@',	A('2'),	A('2'),	A('@'),	C('@'),
-/* 04 - '3'	*/	'3',	'#',	A('3'),	A('3'),	A('#'),	C('C'),
-/* 05 - '4'	*/	'4',	'$',	A('4'),	A('4'),	A('$'),	C('D'),
-/* 06 - '5'	*/	'5',	'%',	A('5'),	A('5'),	A('%'),	C('E'),
-/* 07 - '6'	*/	'6',	'^',	A('6'),	A('6'),	A('^'),	C('^'),
-/* 08 - '7'	*/	'7',	'&',	A('7'),	A('7'),	A('&'),	C('G'),
-/* 09 - '8'	*/	'8',	'*',	A('8'),	A('8'),	A('*'),	C('H'),
-/* 10 - '9'	*/	'9',	'(',	A('9'),	A('9'),	A('('),	C('I'),
-/* 11 - '0'	*/	'0',	')',	A('0'),	A('0'),	A(')'),	C('@'),
-/* 12 - '-'	*/	'-',	'_',	A('-'),	A('-'),	A('_'),	C('_'),
-/* 13 - '='	*/	'=',	'+',	A('='),	A('='),	A('+'),	C('@'),
-/* 14 - BS	*/	C('H'),	C('H'),	CA('H'),CA('H'),CA('H'),0177,	
-/* 15 - TAB	*/	C('I'),	C('I'),	CA('I'),CA('I'),CA('I'),C('I'),
-/* 16 - 'q'	*/	L('q'),	'Q',	A('q'),	A('q'),	A('Q'),	C('Q'),
-/* 17 - 'w'	*/	L('w'),	'W',	A('w'),	A('w'),	A('W'),	C('W'),
-/* 18 - 'e'	*/	L('e'),	'E',	A('e'),	A('e'),	A('E'),	C('E'),
-/* 19 - 'r'	*/	L('r'),	'R',	A('r'),	A('r'),	A('R'),	C('R'),
-/* 20 - 't'	*/	L('t'),	'T',	A('t'),	A('t'),	A('T'),	C('T'),
-/* 21 - 'y'	*/	L('y'),	'Y',	A('y'),	A('y'),	A('Y'),	C('Y'),
-/* 22 - 'u'	*/	L('u'),	'U',	A('u'),	A('u'),	A('U'),	C('U'),
-/* 23 - 'i'	*/	L('i'),	'I',	A('i'),	A('i'),	A('I'),	C('I'),
-/* 24 - 'o'	*/	L('o'),	'O',	A('o'),	A('o'),	A('O'),	C('O'),
-/* 25 - 'p'	*/	L('p'),	'P',	A('p'),	A('p'),	A('P'),	C('P'),
-/* 26 - '['	*/	'[',	'{',	A('['),	A('['),	A('{'),	C('['),
-/* 27 - ']'	*/	']',	'}',	A(']'),	A(']'),	A('}'),	C(']'),
-/* 28 - CR/LF	*/	C('M'),	C('M'),	CA('M'),CA('M'),CA('M'),C('J'),
-/* 29 - Ctrl	*/	CALOCK,	CALOCK,	CALOCK,	CALOCK,	CALOCK,	CALOCK,
-/* 30 - 'a'	*/	L('a'),	'A',	A('a'),	A('a'),	A('A'),	C('A'),
-/* 31 - 's'	*/	L('s'),	'S',	A('s'),	A('s'),	A('S'),	C('S'),
-/* 32 - 'd'	*/	L('d'),	'D',	A('d'),	A('d'),	A('D'),	C('D'),
-/* 33 - 'f'	*/	L('f'),	'F',	A('f'),	A('f'),	A('F'),	C('F'),
-/* 34 - 'g'	*/	L('g'),	'G',	A('g'),	A('g'),	A('G'),	C('G'),
-/* 35 - 'h'	*/	L('h'),	'H',	A('h'),	A('h'),	A('H'),	C('H'),
-/* 36 - 'j'	*/	L('j'),	'J',	A('j'),	A('j'),	A('J'),	C('J'),
-/* 37 - 'k'	*/	L('k'),	'K',	A('k'),	A('k'),	A('K'),	C('K'),
-/* 38 - 'l'	*/	L('l'),	'L',	A('l'),	A('l'),	A('L'),	C('L'),
-/* 39 - ';'	*/	';',	':',	A(';'),	A(';'),	A(':'),	C('@'),
-/* 40 - '\''	*/	'\'',	'"',	A('\''),A('\''),A('"'),	C('@'),
-/* 41 - '`'	*/	'`',	'~',	A('`'),	A('`'),	A('~'),	C('@'),
-/* 42 - l. SHIFT*/	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,
-/* 43 - '\\'	*/	'\\',	'|',	A('\\'),A('\\'),A('|'),	C('\\'),
-/* 44 - 'z'	*/	L('z'),	'Z',	A('z'),	A('z'),	A('Z'),	C('Z'),
-/* 45 - 'x'	*/	L('x'),	'X',	A('x'),	A('x'),	A('X'),	C('X'),
-/* 46 - 'c'	*/	L('c'),	'C',	A('c'),	A('c'),	A('C'),	C('C'),
-/* 47 - 'v'	*/	L('v'),	'V',	A('v'),	A('v'),	A('V'),	C('V'),
-/* 48 - 'b'	*/	L('b'),	'B',	A('b'),	A('b'),	A('B'),	C('B'),
-/* 49 - 'n'	*/	L('n'),	'N',	A('n'),	A('n'),	A('N'),	C('N'),
-/* 50 - 'm'	*/	L('m'),	'M',	A('m'),	A('m'),	A('M'),	C('M'),
-/* 51 - ','	*/	',',	'<',	A(','),	A(','),	A('<'),	C('@'),
-/* 52 - '.'	*/	'.',	'>',	A('.'),	A('.'),	A('>'),	C('@'),
-/* 53 - '/'	*/	'/',	'?',	A('/'),	A('/'),	A('?'),	C('@'),
-/* 54 - r. SHIFT*/	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,	SHIFT,
-/* 55 - '*'	*/	'*',	'*',	A('*'),	A('*'),	A('*'),	C('@'),
-/* 56 - ALT	*/	ALT,	ALT,	ALT,	ALT,	ALT,	ALT,
-/* 57 - ' '	*/	' ',	' ',	A(' '),	A(' '),	A(' '),	C('@'),
-/* 58 - CapsLck	*/	CTRL,	CTRL,	CTRL,	CTRL,	CTRL,	CTRL,
-/* 59 - F1	*/	F1,	SF1,	AF1,	AF1,	ASF1,	CF1,
-/* 60 - F2	*/	F2,	SF2,	AF2,	AF2,	ASF2,	CF2,
-/* 61 - F3	*/	F3,	SF3,	AF3,	AF3,	ASF3,	CF3,
-/* 62 - F4	*/	F4,	SF4,	AF4,	AF4,	ASF4,	CF4,
-/* 63 - F5	*/	F5,	SF5,	AF5,	AF5,	ASF5,	CF5,
-/* 64 - F6	*/	F6,	SF6,	AF6,	AF6,	ASF6,	CF6,
-/* 65 - F7	*/	F7,	SF7,	AF7,	AF7,	ASF7,	CF7,
-/* 66 - F8	*/	F8,	SF8,	AF8,	AF8,	ASF8,	CF8,
-/* 67 - F9	*/	F9,	SF9,	AF9,	AF9,	ASF9,	CF9,
-/* 68 - F10	*/	F10,	SF10,	AF10,	AF10,	ASF10,	CF10,
-/* 69 - NumLock	*/	NLOCK,	NLOCK,	NLOCK,	NLOCK,	NLOCK,	NLOCK,
-/* 70 - ScrLock */	SLOCK,	SLOCK,	SLOCK,	SLOCK,	SLOCK,	SLOCK,
-/* 71 - Home	*/	HOME,	'7',	AHOME,	AHOME,	A('7'),	CHOME,	
-/* 72 - CurUp	*/	UP,	'8',	AUP,	AUP,	A('8'),	CUP,
-/* 73 - PgUp	*/	PGUP,	'9',	APGUP,	APGUP,	A('9'),	CPGUP,
-/* 74 - '-'	*/	NMIN,	'-',	ANMIN,	ANMIN,	A('-'),	CNMIN,
-/* 75 - Left	*/	LEFT,	'4',	ALEFT,	ALEFT,	A('4'),	CLEFT,
-/* 76 - MID	*/	MID,	'5',	AMID,	AMID,	A('5'),	CMID,
-/* 77 - Right	*/	RIGHT,	'6',	ARIGHT,	ARIGHT,	A('6'),	CRIGHT,
-/* 78 - '+'	*/	PLUS,	'+',	APLUS,	APLUS,	A('+'),	CPLUS,
-/* 79 - End	*/	END,	'1',	AEND,	AEND,	A('1'),	CEND,
-/* 80 - Down	*/	DOWN,	'2',	ADOWN,	ADOWN,	A('2'),	CDOWN,
-/* 81 - PgDown	*/	PGDN,	'3',	APGDN,	APGDN,	A('3'),	CPGDN,
-/* 82 - Insert	*/	INSRT,	'0',	AINSRT,	AINSRT,	A('0'),	CINSRT,
-/* 83 - Delete	*/	0177,	'.',	A(0177),A(0177),A('.'),	0177,
-/* 84 - Enter	*/	C('M'),	C('M'),	CA('M'),CA('M'),CA('M'),C('J'),
-/* 85 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 86 - ???	*/	'<',	'>',	A('<'),	A('|'),	A('>'),	C('@'),
-/* 87 - F11	*/	F11,	SF11,	AF11,	AF11,	ASF11,	CF11,
-/* 88 - F12	*/	F12,	SF12,	AF12,	AF12,	ASF12,	CF12,
-/* 89 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 90 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 91 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 92 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 93 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 94 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 95 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 96 - EXT_KEY	*/	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,	EXTKEY,
-/* 97 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 98 - ???	*/	0,	0,	0,	0,	0,	0,
-/* 99 - ???	*/	0,	0,	0,	0,	0,	0,
-/*100 - ???	*/	0,	0,	0,	0,	0,	0,
-/*101 - ???	*/	0,	0,	0,	0,	0,	0,
-/*102 - ???	*/	0,	0,	0,	0,	0,	0,
-/*103 - ???	*/	0,	0,	0,	0,	0,	0,
-/*104 - ???	*/	0,	0,	0,	0,	0,	0,
-/*105 - ???	*/	0,	0,	0,	0,	0,	0,
-/*106 - ???	*/	0,	0,	0,	0,	0,	0,
-/*107 - ???	*/	0,	0,	0,	0,	0,	0,
-/*108 - ???	*/	0,	0,	0,	0,	0,	0,
-/*109 - ???	*/	0,	0,	0,	0,	0,	0,
-/*110 - ???	*/	0,	0,	0,	0,	0,	0,
-/*111 - ???	*/	0,	0,	0,	0,	0,	0,
-/*112 - ???	*/	0,	0,	0,	0,	0,	0,
-/*113 - ???	*/	0,	0,	0,	0,	0,	0,
-/*114 - ???	*/	0,	0,	0,	0,	0,	0,
-/*115 - ???	*/	0,	0,	0,	0,	0,	0,
-/*116 - ???	*/	0,	0,	0,	0,	0,	0,
-/*117 - ???	*/	0,	0,	0,	0,	0,	0,
-/*118 - ???	*/	0,	0,	0,	0,	0,	0,
-/*119 - ???	*/	0,	0,	0,	0,	0,	0,
-/*120 - ???	*/	0,	0,	0,	0,	0,	0,
-/*121 - ???	*/	0,	0,	0,	0,	0,	0,
-/*122 - ???	*/	0,	0,	0,	0,	0,	0,
-/*123 - ???	*/	0,	0,	0,	0,	0,	0,
-/*124 - ???	*/	0,	0,	0,	0,	0,	0,
-/*125 - ???	*/	0,	0,	0,	0,	0,	0,
-/*126 - ???	*/	0,	0,	0,	0,	0,	0,
-/*127 - ???	*/	0,	0,	0,	0,	0,	0
-};
Index: trunk/minix/drivers/tty/pty.c
===================================================================
--- trunk/minix/drivers/tty/pty.c	(revision 9)
+++ 	(revision )
@@ -1,612 +1,0 @@
-/*	pty.c - pseudo terminal driver			Author: Kees J. Bot
- *								30 Dec 1995
- * PTYs can be seen as a bidirectional pipe with TTY
- * input and output processing.  For example a simple rlogin session:
- *
- *	keyboard -> rlogin -> in.rld -> /dev/ptypX -> /dev/ttypX -> shell
- *	shell -> /dev/ttypX -> /dev/ptypX -> in.rld -> rlogin -> screen
- *
- * This file takes care of copying data between the tty/pty device pairs and
- * the open/read/write/close calls on the pty devices.  The TTY task takes
- * care of the input and output processing (interrupt, backspace, raw I/O,
- * etc.) using the pty_read() and pty_write() functions as the "keyboard" and
- * "screen" functions of the ttypX devices.
- * Be careful when reading this code, the terms "reading" and "writing" are
- * used both for the tty and the pty end of the pseudo tty.  Writes to one
- * end are to be read at the other end and vice-versa.
- */
-
-#include "../drivers.h"
-#include <assert.h>
-#include <termios.h>
-#include <signal.h>
-#include <minix/com.h>
-#include <minix/callnr.h>
-#include <sys/select.h>
-#include "tty.h"
-
-#if NR_PTYS > 0
-
-/* PTY bookkeeping structure, one per pty/tty pair. */
-typedef struct pty {
-  tty_t		*tty;		/* associated TTY structure */
-  char		state;		/* flags: busy, closed, ... */
-
-  /* Read call on /dev/ptypX. */
-  char		rdsendreply;	/* send a reply (instead of notify) */
-  int		rdcaller;	/* process making the call (usually FS) */
-  int		rdproc;		/* process that wants to read from the pty */
-  vir_bytes	rdvir;		/* virtual address in readers address space */
-  int		rdleft;		/* # bytes yet to be read */
-  int		rdcum;		/* # bytes written so far */
-
-  /* Write call to /dev/ptypX. */
-  char		wrsendreply;	/* send a reply (instead of notify) */
-  int		wrcaller;	/* process making the call (usually FS) */
-  int		wrproc;		/* process that wants to write to the pty */
-  vir_bytes	wrvir;		/* virtual address in writers address space */
-  int		wrleft;		/* # bytes yet to be written */
-  int		wrcum;		/* # bytes written so far */
-
-  /* Output buffer. */
-  int		ocount;		/* # characters in the buffer */
-  char		*ohead, *otail;	/* head and tail of the circular buffer */
-  char		obuf[128];	/* buffer for bytes going to the pty reader */
-
-  /* select() data. */
-  int		select_ops,	/* Which operations do we want to know about? */
-  		select_proc,	/* Who wants to know about it? */
-  		select_ready_ops;	/* For callback. */
-} pty_t;
-
-#define PTY_ACTIVE	0x01	/* pty is open/active */
-#define TTY_CLOSED	0x02	/* tty side has closed down */
-#define PTY_CLOSED	0x04	/* pty side has closed down */
-
-PRIVATE pty_t pty_table[NR_PTYS];	/* PTY bookkeeping */
-
-FORWARD _PROTOTYPE( int pty_write, (tty_t *tp, int try)			);
-FORWARD _PROTOTYPE( void pty_echo, (tty_t *tp, int c)			);
-FORWARD _PROTOTYPE( void pty_start, (pty_t *pp)				);
-FORWARD _PROTOTYPE( void pty_finish, (pty_t *pp)			);
-FORWARD _PROTOTYPE( int pty_read, (tty_t *tp, int try)			);
-FORWARD _PROTOTYPE( int pty_close, (tty_t *tp, int try)			);
-FORWARD _PROTOTYPE( int pty_icancel, (tty_t *tp, int try)		);
-FORWARD _PROTOTYPE( int pty_ocancel, (tty_t *tp, int try)		);
-FORWARD _PROTOTYPE( int pty_select, (tty_t *tp, message *m)		);
-
-/*===========================================================================*
- *				do_pty					     *
- *===========================================================================*/
-PUBLIC void do_pty(tp, m_ptr)
-tty_t *tp;
-message *m_ptr;
-{
-/* Perform an open/close/read/write call on a /dev/ptypX device. */
-  pty_t *pp = tp->tty_priv;
-  int r;
-  phys_bytes p;
-
-  switch (m_ptr->m_type) {
-    case DEV_READ:
-	/* Check, store information on the reader, do I/O. */
-	if (pp->state & TTY_CLOSED) {
-		r = 0;
-		break;
-	}
-	if (pp->rdleft != 0 || pp->rdcum != 0) {
-		r = EIO;
-		break;
-	}
-	if (m_ptr->COUNT <= 0) {
-		r = EINVAL;
-		break;
-	}
-#if DEAD_CODE
-	if (numap_local(m_ptr->IO_ENDPT, (vir_bytes) m_ptr->ADDRESS,
-							m_ptr->COUNT) == 0) {
-#else
-	if ((r = sys_umap(m_ptr->IO_ENDPT, D, (vir_bytes) m_ptr->ADDRESS,
-		m_ptr->COUNT, &p)) != OK) {
-#endif
-		break;
-	}
-	pp->rdsendreply = TRUE;
-	pp->rdcaller = m_ptr->m_source;
-	pp->rdproc = m_ptr->IO_ENDPT;
-	pp->rdvir = (vir_bytes) m_ptr->ADDRESS;
-	pp->rdleft = m_ptr->COUNT;
-	pty_start(pp);
-	handle_events(tp);
-	if (pp->rdleft == 0) return;			/* already done */
-
-	if (m_ptr->TTY_FLAGS & O_NONBLOCK) {
-		r = EAGAIN;				/* don't suspend */
-		pp->rdleft = pp->rdcum = 0;
-	} else {
-		r = SUSPEND;				/* do suspend */
-		pp->rdsendreply = FALSE;
-	}
-	break;
-
-    case DEV_WRITE:
-	/* Check, store information on the writer, do I/O. */
-	if (pp->state & TTY_CLOSED) {
-		r = EIO;
-		break;
-	}
-	if (pp->wrleft != 0 || pp->wrcum != 0) {
-		r = EIO;
-		break;
-	}
-	if (m_ptr->COUNT <= 0) {
-		r = EINVAL;
-		break;
-	}
-#if DEAD_CODE
-	if (numap_local(m_ptr->IO_ENDPT, (vir_bytes) m_ptr->ADDRESS,
-							m_ptr->COUNT) == 0) {
-		r = EFAULT;
-#else
-	if ((r = sys_umap(m_ptr->IO_ENDPT, D, (vir_bytes) m_ptr->ADDRESS,
-		m_ptr->COUNT, &p)) != OK) {
-#endif
-		break;
-	}
-	pp->wrsendreply = TRUE;
-	pp->wrcaller = m_ptr->m_source;
-	pp->wrproc = m_ptr->IO_ENDPT;
-	pp->wrvir = (vir_bytes) m_ptr->ADDRESS;
-	pp->wrleft = m_ptr->COUNT;
-	handle_events(tp);
-	if (pp->wrleft == 0) return;			/* already done */
-
-	if (m_ptr->TTY_FLAGS & O_NONBLOCK) {		/* don't suspend */
-		r = pp->wrcum > 0 ? pp->wrcum : EAGAIN;
-		pp->wrleft = pp->wrcum = 0;
-	} else {
-		pp->wrsendreply = FALSE;			/* do suspend */
-		r = SUSPEND;
-	}
-	break;
-
-    case DEV_OPEN:
-	r = pp->state != 0 ? EIO : OK;
-	pp->state |= PTY_ACTIVE;
-	pp->rdcum = 0;
-	pp->wrcum = 0;
-	break;
-
-    case DEV_CLOSE:
-	r = OK;
-	if (pp->state & TTY_CLOSED) {
-		pp->state = 0;
-	} else {
-		pp->state |= PTY_CLOSED;
-		sigchar(tp, SIGHUP);
-	}
-	break;
-
-    case DEV_SELECT:
-    	r = pty_select(tp, m_ptr);
-    	break;
-
-    case CANCEL:
-	if (m_ptr->IO_ENDPT == pp->rdproc) {
-		/* Cancel a read from a PTY. */
-		pp->rdleft = pp->rdcum = 0;
-	}
-	if (m_ptr->IO_ENDPT == pp->wrproc) {
-		/* Cancel a write to a PTY. */
-		pp->wrleft = pp->wrcum = 0;
-	}
-	r = EINTR;
-	break;
-
-    default:
-	r = EINVAL;
-  }
-  tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, r);
-}
-
-/*===========================================================================*
- *				pty_write				     *
- *===========================================================================*/
-PRIVATE int pty_write(tp, try)
-tty_t *tp;
-int try;
-{
-/* (*dev_write)() routine for PTYs.  Transfer bytes from the writer on
- * /dev/ttypX to the output buffer.
- */
-  pty_t *pp = tp->tty_priv;
-  int count, ocount, s;
-  phys_bytes user_phys;
-
-  /* PTY closed down? */
-  if (pp->state & PTY_CLOSED) {
-  	if (try) return 1;
-	if (tp->tty_outleft > 0) {
-		tty_reply(tp->tty_outrepcode, tp->tty_outcaller,
-							tp->tty_outproc, EIO);
-		tp->tty_outleft = tp->tty_outcum = 0;
-	}
-	return;
-  }
-
-  /* While there is something to do. */
-  for (;;) {
-	ocount = buflen(pp->obuf) - pp->ocount;
-	if (try) return (ocount > 0);
-	count = bufend(pp->obuf) - pp->ohead;
-	if (count > ocount) count = ocount;
-	if (count > tp->tty_outleft) count = tp->tty_outleft;
-	if (count == 0 || tp->tty_inhibited)
-		break;
-
-	/* Copy from user space to the PTY output buffer. */
-	if ((s = sys_vircopy(tp->tty_outproc, D, (vir_bytes) tp->tty_out_vir,
-		SELF, D, (vir_bytes) pp->ohead, (phys_bytes) count)) != OK) {
-		printf("pty tty%d: copy failed (error %d)\n",  s);
-		break;
-	}
-
-	/* Perform output processing on the output buffer. */
-	out_process(tp, pp->obuf, pp->ohead, bufend(pp->obuf), &count, &ocount);
-	if (count == 0) break;
-
-	/* Assume echoing messed up by output. */
-	tp->tty_reprint = TRUE;
-
-	/* Bookkeeping. */
-	pp->ocount += ocount;
-	if ((pp->ohead += ocount) >= bufend(pp->obuf))
-		pp->ohead -= buflen(pp->obuf);
-	pty_start(pp);
-	tp->tty_out_vir += count;
-	tp->tty_outcum += count;
-	if ((tp->tty_outleft -= count) == 0) {
-		/* Output is finished, reply to the writer. */
-		tty_reply(tp->tty_outrepcode, tp->tty_outcaller,
-					tp->tty_outproc, tp->tty_outcum);
-		tp->tty_outcum = 0;
-	}
-  }
-  pty_finish(pp);
-  return 1;
-}
-
-/*===========================================================================*
- *				pty_echo				     *
- *===========================================================================*/
-PRIVATE void pty_echo(tp, c)
-tty_t *tp;
-int c;
-{
-/* Echo one character.  (Like pty_write, but only one character, optionally.) */
-
-  pty_t *pp = tp->tty_priv;
-  int count, ocount;
-
-  ocount = buflen(pp->obuf) - pp->ocount;
-  if (ocount == 0) return;		/* output buffer full */
-  count = 1;
-  *pp->ohead = c;			/* add one character */
-
-  out_process(tp, pp->obuf, pp->ohead, bufend(pp->obuf), &count, &ocount);
-  if (count == 0) return;
-
-  pp->ocount += ocount;
-  if ((pp->ohead += ocount) >= bufend(pp->obuf)) pp->ohead -= buflen(pp->obuf);
-  pty_start(pp);
-}
-
-/*===========================================================================*
- *				pty_start				     *
- *===========================================================================*/
-PRIVATE void pty_start(pp)
-pty_t *pp;
-{
-/* Transfer bytes written to the output buffer to the PTY reader. */
-  int count;
-
-  /* While there are things to do. */
-  for (;;) {
-  	int s;
-	count = bufend(pp->obuf) - pp->otail;
-	if (count > pp->ocount) count = pp->ocount;
-	if (count > pp->rdleft) count = pp->rdleft;
-	if (count == 0) break;
-
-	/* Copy from the output buffer to the readers address space. */
-	if ((s = sys_vircopy(SELF, D, (vir_bytes)pp->otail,
-		(vir_bytes) pp->rdproc, D, (vir_bytes) pp->rdvir, (phys_bytes) count)) != OK) {
-		printf("pty tty%d: copy failed (error %d)\n",  s);
-		break;
-	}
-
-	/* Bookkeeping. */
-	pp->ocount -= count;
-	if ((pp->otail += count) == bufend(pp->obuf)) pp->otail = pp->obuf;
-	pp->rdvir += count;
-	pp->rdcum += count;
-	pp->rdleft -= count;
-  }
-}
-
-/*===========================================================================*
- *				pty_finish				     *
- *===========================================================================*/
-PRIVATE void pty_finish(pp)
-pty_t *pp;
-{
-/* Finish the read request of a PTY reader if there is at least one byte
- * transferred.
- */
-  if (pp->rdcum > 0) {
-        if (pp->rdsendreply) {
-		tty_reply(TASK_REPLY, pp->rdcaller, pp->rdproc, pp->rdcum);
-		pp->rdleft = pp->rdcum = 0;
-	}
-	else
-		notify(pp->rdcaller);
-  }
-
-}
-
-/*===========================================================================*
- *				pty_read				     *
- *===========================================================================*/
-PRIVATE int pty_read(tp, try)
-tty_t *tp;
-int try;
-{
-/* Offer bytes from the PTY writer for input on the TTY.  (Do it one byte at
- * a time, 99% of the writes will be for one byte, so no sense in being smart.)
- */
-  pty_t *pp = tp->tty_priv;
-  char c;
-
-  if (pp->state & PTY_CLOSED) {
-	if (try) return 1;
-	if (tp->tty_inleft > 0) {
-		tty_reply(tp->tty_inrepcode, tp->tty_incaller, tp->tty_inproc,
-								tp->tty_incum);
-		tp->tty_inleft = tp->tty_incum = 0;
-	}
-	return 1;
-  }
-
-  if (try) {
-  	if (pp->wrleft > 0)
-  		return 1;
-  	return 0;
-  }
-
-  while (pp->wrleft > 0) {
-  	int s;
-
-	/* Transfer one character to 'c'. */
-	if ((s = sys_vircopy(pp->wrproc, D, (vir_bytes) pp->wrvir,
-		SELF, D, (vir_bytes) &c, (phys_bytes) 1)) != OK) {
-		printf("pty: copy failed (error %d)\n", s);
-		break;
-	}
-
-	/* Input processing. */
-	if (in_process(tp, &c, 1) == 0) break;
-
-	/* PTY writer bookkeeping. */
-	pp->wrvir++;
-	pp->wrcum++;
-	if (--pp->wrleft == 0) {
-		if (pp->wrsendreply) {
-			tty_reply(TASK_REPLY, pp->wrcaller, pp->wrproc,
-				pp->wrcum);
-			pp->wrcum = 0;
-		}
-		else
-			notify(pp->wrcaller);
-	}
-  }
-}
-
-/*===========================================================================*
- *				pty_close				     *
- *===========================================================================*/
-PRIVATE int pty_close(tp, try)
-tty_t *tp;
-int try;
-{
-/* The tty side has closed, so shut down the pty side. */
-  pty_t *pp = tp->tty_priv;
-
-  if (!(pp->state & PTY_ACTIVE)) return;
-
-  if (pp->rdleft > 0) {
-  	assert(!pp->rdsendreply);
-  	notify(pp->rdcaller);
-  }
-
-  if (pp->wrleft > 0) {
-  	assert(!pp->wrsendreply);
-  	notify(pp->wrcaller);
-  }
-
-  if (pp->state & PTY_CLOSED) pp->state = 0; else pp->state |= TTY_CLOSED;
-}
-
-/*===========================================================================*
- *				pty_icancel				     *
- *===========================================================================*/
-PRIVATE int pty_icancel(tp, try)
-tty_t *tp;
-int try;
-{
-/* Discard waiting input. */
-  pty_t *pp = tp->tty_priv;
-
-  if (pp->wrleft > 0) {
-  	assert(!pp->wrsendreply);
-  	pp->wrcum += pp->wrleft;
-  	pp->wrleft= 0;
-  	notify(pp->wrcaller);
-  }
-}
-
-/*===========================================================================*
- *				pty_ocancel				     *
- *===========================================================================*/
-PRIVATE int pty_ocancel(tp, try)
-tty_t *tp;
-int try;
-{
-/* Drain the output buffer. */
-  pty_t *pp = tp->tty_priv;
-
-  pp->ocount = 0;
-  pp->otail = pp->ohead;
-}
-
-/*===========================================================================*
- *				pty_init				     *
- *===========================================================================*/
-PUBLIC void pty_init(tp)
-tty_t *tp;
-{
-  pty_t *pp;
-  int line;
-
-  /* Associate PTY and TTY structures. */
-  line = tp - &tty_table[NR_CONS + NR_RS_LINES];
-  pp = tp->tty_priv = &pty_table[line];
-  pp->tty = tp;
-  pp->select_ops = 0;
-
-  /* Set up output queue. */
-  pp->ohead = pp->otail = pp->obuf;
-
-  /* Fill in TTY function hooks. */
-  tp->tty_devread = pty_read;
-  tp->tty_devwrite = pty_write;
-  tp->tty_echo = pty_echo;
-  tp->tty_icancel = pty_icancel;
-  tp->tty_ocancel = pty_ocancel;
-  tp->tty_close = pty_close;
-  tp->tty_select_ops = 0;
-}
-
-/*===========================================================================*
- *				pty_status				     *
- *===========================================================================*/
-PUBLIC int pty_status(message *m_ptr)
-{
-	int i, event_found;
-	pty_t *pp;
-
-	event_found = 0;
-	for (i= 0, pp = pty_table; i<NR_PTYS; i++, pp++) {
-		if ((((pp->state & TTY_CLOSED) && pp->rdleft > 0) ||
-			pp->rdcum > 0) &&
-			pp->rdcaller == m_ptr->m_source)
-		{
-			m_ptr->m_type = DEV_REVIVE;
-			m_ptr->REP_ENDPT = pp->rdproc;
-			m_ptr->REP_STATUS = pp->rdcum;
-
-			pp->rdleft = pp->rdcum = 0;
-			event_found = 1;
-			break;
-		}
-
-		if ((((pp->state & TTY_CLOSED) && pp->wrleft > 0) ||
-			pp->wrcum > 0) &&
-			pp->wrcaller == m_ptr->m_source)
-		{
-			m_ptr->m_type = DEV_REVIVE;
-			m_ptr->REP_ENDPT = pp->wrproc;
-			if (pp->wrcum == 0)
-				m_ptr->REP_STATUS = EIO;
-			else
-				m_ptr->REP_STATUS = pp->wrcum;
-
-			pp->wrleft = pp->wrcum = 0;
-			event_found = 1;
-			break;
-		}
-
-		if (pp->select_ready_ops && pp->select_proc == m_ptr->m_source) {
-			m_ptr->m_type = DEV_IO_READY;
-			m_ptr->DEV_MINOR = PTYPX_MINOR + i;
-			m_ptr->DEV_SEL_OPS = pp->select_ready_ops;
-			pp->select_ready_ops = 0;
-			event_found = 1;
-			break;
-		}
-	}
-	return event_found;
-}
-
-/*===========================================================================*
- *				select_try_pty				     *
- *===========================================================================*/
-PRIVATE int select_try_pty(tty_t *tp, int ops)
-{
-  	pty_t *pp = tp->tty_priv;
-	int r = 0;
-
-	if (ops & SEL_WR)  {
-		/* Write won't block on error. */
-		if (pp->state & TTY_CLOSED) r |= SEL_WR;
-		else if (pp->wrleft != 0 || pp->wrcum != 0) r |= SEL_WR;
-		else r |= SEL_WR;
-	}
-
-	if (ops & SEL_RD) {
-		/* Read won't block on error. */
-		if (pp->state & TTY_CLOSED) r |= SEL_RD;
-		else if (pp->rdleft != 0 || pp->rdcum != 0) r |= SEL_RD;
-		else if (pp->ocount > 0) r |= SEL_RD;	/* Actual data. */
-	}
-
-	return r;
-}
-
-/*===========================================================================*
- *				select_retry_pty			     *
- *===========================================================================*/
-PUBLIC void select_retry_pty(tty_t *tp)
-{
-  	pty_t *pp = tp->tty_priv;
-  	int r;
-
-	/* See if the pty side of a pty is ready to return a select. */
-	if (pp->select_ops && (r=select_try_pty(tp, pp->select_ops))) {
-		pp->select_ops &= ~r;
-		pp->select_ready_ops |= r;
-		notify(pp->select_proc);
-	}
-}
-
-/*===========================================================================*
- *				pty_select				     *
- *===========================================================================*/
-PRIVATE int pty_select(tty_t *tp, message *m)
-{
-  	pty_t *pp = tp->tty_priv;
-	int ops, ready_ops = 0, watch;
-
-	ops = m->IO_ENDPT & (SEL_RD|SEL_WR|SEL_ERR);
-	watch = (m->IO_ENDPT & SEL_NOTIFY) ? 1 : 0;
-
-	ready_ops = select_try_pty(tp, ops);
-
-	if (!ready_ops && ops && watch) {
-		pp->select_ops |= ops;
-		pp->select_proc = m->m_source;
-	}
-
-	return ready_ops;
-}
-
-#endif /* NR_PTYS > 0 */
Index: trunk/minix/drivers/tty/rs232.c
===================================================================
--- trunk/minix/drivers/tty/rs232.c	(revision 9)
+++ 	(revision )
@@ -1,991 +1,0 @@
-#include <minix/config.h>
-/*---------------------------------------------------------------------------*
- *		rs232.c - serial driver for 8250 and 16450 UARTs	     *
- *		Added support for Atari ST M68901 and YM-2149	--kub	     *
- *---------------------------------------------------------------------------*/
-
-#include "../drivers.h"
-#include <termios.h>
-#include <signal.h>
-#include "tty.h"
-
-#if NR_RS_LINES > 0
-
-#if (MACHINE != IBM_PC) && (MACHINE != ATARI)
-#error				/* rs232.c only supports PC and Atari ST */
-#endif
-
-#if (MACHINE == ATARI)
-#include "staddr.h"
-#include "stsound.h"
-#include "stmfp.h"
-#if (NR_RS_LINES > 1)
-#error				/* Only one physical RS232 line available */
-#endif
-#endif
-
-#if (MACHINE == IBM_PC)		/* PC/AT 8250/16450 chip combination */
-
-/* 8250 constants. */
-#define UART_FREQ         115200L	/* timer frequency */
-
-/* Interrupt enable bits. */
-#define IE_RECEIVER_READY       1
-#define IE_TRANSMITTER_READY    2
-#define IE_LINE_STATUS_CHANGE   4
-#define IE_MODEM_STATUS_CHANGE  8
-
-/* Interrupt status bits. */
-#define IS_MODEM_STATUS_CHANGE  0
-#define IS_TRANSMITTER_READY    2
-#define IS_RECEIVER_READY       4
-#define IS_LINE_STATUS_CHANGE   6
-
-/* Line control bits. */
-#define LC_2STOP_BITS        0x04
-#define LC_PARITY            0x08
-#define LC_PAREVEN           0x10
-#define LC_BREAK             0x40
-#define LC_ADDRESS_DIVISOR   0x80
-
-/* Line status bits. */
-#define LS_OVERRUN_ERR          2
-#define LS_PARITY_ERR           4
-#define LS_FRAMING_ERR          8
-#define LS_BREAK_INTERRUPT   0x10
-#define LS_TRANSMITTER_READY 0x20
-
-/* Modem control bits. */
-#define MC_DTR                  1
-#define MC_RTS                  2
-#define MC_OUT2                 8	/* required for PC & AT interrupts */
-
-/* Modem status bits. */
-#define MS_CTS               0x10
-#define MS_RLSD              0x80       /* Received Line Signal Detect */
-#define MS_DRLSD             0x08       /* RLSD Delta */
-
-#else /* MACHINE == ATARI */		/* Atari ST 68901 USART */
-
-/* Most of the USART constants are already defined in stmfp.h . The local
- * definitions made here are for keeping C code changes smaller.   --kub
- */
-
-#define UART_FREQ          19200L	/* timer frequency */
-
-/* Line status bits. */
-#define LS_OVERRUN_ERR       R_OE
-#define LS_PARITY_ERR        R_PE
-#define LS_FRAMING_ERR       R_FE
-#define LS_BREAK_INTERRUPT   R_BREAK
-
-/* Modem status bits. */
-#define MS_CTS               IO_SCTS	/* 0x04 */
-
-#endif /* MACHINE == ATARI */
-
-#define DATA_BITS_SHIFT         8	/* amount data bits shifted in mode */
-#define DEF_BAUD             1200	/* default baud rate */
-
-#define RS_IBUFSIZE          1024	/* RS232 input buffer size */
-#define RS_OBUFSIZE          1024	/* RS232 output buffer size */
-
-/* Input buffer watermarks.
- * The external device is asked to stop sending when the buffer
- * exactly reaches high water, or when TTY requests it.  Sending restarts
- * when the input buffer empties below the low watermark.
- */
-#define RS_ILOWWATER	(1 * RS_IBUFSIZE / 4)
-#define RS_IHIGHWATER	(3 * RS_IBUFSIZE / 4)
-
-/* Output buffer low watermark.
- * TTY is notified when the output buffer empties below the low watermark, so
- * it may continue filling the buffer if doing a large write.
- */
-#define RS_OLOWWATER	(1 * RS_OBUFSIZE / 4)
-
-#if (MACHINE == IBM_PC)
-
-/* Macros to handle flow control.
- * Interrupts must be off when they are used.
- * Time is critical - already the function call for outb() is annoying.
- * If outb() can be done in-line, tests to avoid it can be dropped.
- * istart() tells external device we are ready by raising RTS.
- * istop() tells external device we are not ready by dropping RTS.
- * DTR is kept high all the time (it probably should be raised by open and
- * dropped by close of the device).
- * OUT2 is also kept high all the time.
- */
-#define istart(rs) \
-	(sys_outb((rs)->modem_ctl_port, MC_OUT2 | MC_RTS | MC_DTR), \
-		(rs)->idevready = TRUE)
-#define istop(rs) \
-	(sys_outb((rs)->modem_ctl_port, MC_OUT2 | MC_DTR), \
-		(rs)->idevready = FALSE)
-
-/* Macro to tell if device is ready.  The rs->cts field is set to MS_CTS if
- * CLOCAL is in effect for a line without a CTS wire.
- */
-#define devready(rs) ((my_inb(rs->modem_status_port) | rs->cts) & MS_CTS)
-
-/* Macro to tell if transmitter is ready. */
-#define txready(rs) (my_inb(rs->line_status_port) & LS_TRANSMITTER_READY)
-
-/* Macro to tell if carrier has dropped.
- * The RS232 Carrier Detect (CD) line is usually connected to the 8250
- * Received Line Signal Detect pin, reflected by bit MS_RLSD in the Modem
- * Status Register.  The MS_DRLSD bit tells if MS_RLSD has just changed state.
- * So if MS_DRLSD is set and MS_RLSD cleared, we know that carrier has just
- * dropped.
- */
-#define devhup(rs)	\
-	((my_inb(rs->modem_status_port) & (MS_RLSD|MS_DRLSD)) == MS_DRLSD)
-
-#else /* MACHINE == ATARI */
-
-/* Macros to handle flow control.
- * Time is critical - already the function call for lock()/restore() is
- * annoying.
- * istart() tells external device we are ready by raising RTS.
- * istop() tells external device we are not ready by dropping RTS.
- * DTR is kept high all the time (it probably should be raised by open and
- * dropped by close of the device). NOTE: The modem lines are active low.
- */
-#define set_porta(msk,val) { register int s = lock();		\
-			     SOUND->sd_selr = YM_IOA;		\
-			     SOUND->sd_wdat =			\
-				SOUND->sd_rdat & (msk) | (val);	\
-			     restore(s);	}
-#define istart(rs)         { set_porta( ~(PA_SRTS|PA_SDTR),0 ); \
-			     (rs)->idevready = TRUE;	}
-#define istop(rs)          { set_porta( ~PA_SDTR, PA_SRTS );	\
-			     (rs)->idevready = FALSE;	}
-
-/* Macro to tell if device is ready.  The rs->cts field is set to MS_CTS if
- * CLOCAL is in effect for a line without a CTS wire.
- */
-#define devready(rs)         ((~MFP->mf_gpip | rs->cts) & MS_CTS)
-
-/* Transmitter ready test */
-#define txready(rs)          (MFP->mf_tsr & (T_EMPTY | T_UE))
-
-#endif /* MACHINE == ATARI */
-
-/* Types. */
-typedef unsigned char bool_t;	/* boolean */
-
-/* RS232 device structure, one per device. */
-typedef struct rs232 {
-  tty_t *tty;			/* associated TTY structure */
-
-  int icount;			/* number of bytes in the input buffer */
-  char *ihead;			/* next free spot in input buffer */
-  char *itail;			/* first byte to give to TTY */
-  bool_t idevready;		/* nonzero if we are ready to receive (RTS) */
-  char cts;			/* normally 0, but MS_CTS if CLOCAL is set */
-
-  unsigned char ostate;		/* combination of flags: */
-#define ODONE          1	/* output completed (< output enable bits) */
-#define ORAW           2	/* raw mode for xoff disable (< enab. bits) */
-#define OWAKEUP        4	/* tty_wakeup() pending (asm code only) */
-#define ODEVREADY MS_CTS	/* external device hardware ready (CTS) */
-#define OQUEUED     0x20	/* output buffer not empty */
-#define OSWREADY    0x40	/* external device software ready (no xoff) */
-#define ODEVHUP  MS_RLSD	/* external device has dropped carrier */
-#define OSOFTBITS  (ODONE | ORAW | OWAKEUP | OQUEUED | OSWREADY)
-				/* user-defined bits */
-#if (OSOFTBITS | ODEVREADY | ODEVHUP) == OSOFTBITS
-				/* a weak sanity check */
-#error				/* bits are not unique */
-#endif
-  unsigned char oxoff;		/* char to stop output */
-  bool_t inhibited;		/* output inhibited? (follows tty_inhibited) */
-  bool_t drain;			/* if set drain output and reconfigure line */
-  int ocount;			/* number of bytes in the output buffer */
-  char *ohead;			/* next free spot in output buffer */
-  char *otail;			/* next char to output */
-
-#if (MACHINE == IBM_PC)
-  port_t xmit_port;		/* i/o ports */
-  port_t recv_port;
-  port_t div_low_port;
-  port_t div_hi_port;
-  port_t int_enab_port;
-  port_t int_id_port;
-  port_t line_ctl_port;
-  port_t modem_ctl_port;
-  port_t line_status_port;
-  port_t modem_status_port;
-#endif
-
-  unsigned char lstatus;	/* last line status */
-  unsigned char pad;		/* ensure alignment for 16-bit ints */
-  unsigned framing_errors;	/* error counts (no reporting yet) */
-  unsigned overrun_errors;
-  unsigned parity_errors;
-  unsigned break_interrupts;
-
-  int irq;			/* irq for this line */
-  int irq_hook_id;		/* interrupt hook */
-
-  char ibuf[RS_IBUFSIZE];	/* input buffer */
-  char obuf[RS_OBUFSIZE];	/* output buffer */
-} rs232_t;
-
-PUBLIC rs232_t rs_lines[NR_RS_LINES];
-
-/* Table and macro to translate an RS232 line number to its rs_lines entry. */
-PRIVATE rs232_t *p_rs_addr[NR_RS_LINES];
-
-#define rs_addr(line)	(p_rs_addr[line])
-
-#if (MACHINE == IBM_PC)
-/* 8250 base addresses. */
-PRIVATE port_t addr_8250[] = {
-  0x3F8,	/* COM1 */
-  0x2F8,	/* COM2 */
-  0x3E8,	/* COM3 */
-  0x2E8,	/* COM4 */
-};
-#endif
-
-FORWARD _PROTOTYPE( void in_int, (rs232_t *rs)				);
-FORWARD _PROTOTYPE( void line_int, (rs232_t *rs)			);
-FORWARD _PROTOTYPE( void modem_int, (rs232_t *rs)			);
-FORWARD _PROTOTYPE( int rs_write, (tty_t *tp, int try)			);
-FORWARD _PROTOTYPE( void rs_echo, (tty_t *tp, int c)			);
-FORWARD _PROTOTYPE( int rs_ioctl, (tty_t *tp, int try)			);
-FORWARD _PROTOTYPE( void rs_config, (rs232_t *rs)			);
-FORWARD _PROTOTYPE( int rs_read, (tty_t *tp, int try)			);
-FORWARD _PROTOTYPE( int rs_icancel, (tty_t *tp, int try)		);
-FORWARD _PROTOTYPE( int rs_ocancel, (tty_t *tp, int try)		);
-FORWARD _PROTOTYPE( void rs_ostart, (rs232_t *rs)			);
-FORWARD _PROTOTYPE( int rs_break, (tty_t *tp, int try)			);
-FORWARD _PROTOTYPE( int rs_close, (tty_t *tp, int try)			);
-FORWARD _PROTOTYPE( void out_int, (rs232_t *rs)				);
-FORWARD _PROTOTYPE( void rs232_handler, (rs232_t *rs)			);
-
-/* XXX */
-PRIVATE void lock(void) {}
-PRIVATE void unlock(void) {}
-
-PRIVATE int my_inb(port_t port)
-{
-	int r;
-	unsigned long v = 0;
-	r = sys_inb(port, &v);
-	if (r != OK)
-		printf("RS232 warning: failed inb 0x%x\n", port);
-
-	return (int) v;
-}
-
-/*===========================================================================*
- *				rs_write				     *
- *===========================================================================*/
-PRIVATE int rs_write(tp, try)
-register tty_t *tp;
-int try;
-{
-/* (*devwrite)() routine for RS232. */
-
-  rs232_t *rs = tp->tty_priv;
-  int count, ocount;
-
-  if (rs->inhibited != tp->tty_inhibited) {
-	/* Inhibition state has changed. */
-	lock();
-	rs->ostate |= OSWREADY;
-	if (tp->tty_inhibited) rs->ostate &= ~OSWREADY;
-	unlock();
-	rs->inhibited = tp->tty_inhibited;
-  }
-
-  if (rs->drain) {
-	/* Wait for the line to drain then reconfigure and continue output. */
-	if (rs->ocount > 0) return 0;
-	rs->drain = FALSE;
-	rs_config(rs);
-  }
-
-  /* While there is something to do. */
-  for (;;) {
-	ocount = buflen(rs->obuf) - rs->ocount;
-	count = bufend(rs->obuf) - rs->ohead;
-	if (count > ocount) count = ocount;
-	if (count > tp->tty_outleft) count = tp->tty_outleft;
-	if (count == 0 || tp->tty_inhibited) {
-		if (try) return 0;
-		break;
-	}
-	if (try) return 1;
-
-	/* Copy from user space to the RS232 output buffer. */
-	sys_vircopy(tp->tty_outproc, D, (vir_bytes) tp->tty_out_vir, 
-		SELF, D, (vir_bytes) rs->ohead, (phys_bytes) count);
-
-	/* Perform output processing on the output buffer. */
-	out_process(tp, rs->obuf, rs->ohead, bufend(rs->obuf), &count, &ocount);
-	if (count == 0) break;
-
-	/* Assume echoing messed up by output. */
-	tp->tty_reprint = TRUE;
-
-	/* Bookkeeping. */
-	lock();			/* protect interrupt sensitive rs->ocount */
-	rs->ocount += ocount;
-	rs_ostart(rs);
-	unlock();
-	if ((rs->ohead += ocount) >= bufend(rs->obuf))
-		rs->ohead -= buflen(rs->obuf);
-	tp->tty_out_vir += count;
-	tp->tty_outcum += count;
-	if ((tp->tty_outleft -= count) == 0) {
-		/* Output is finished, reply to the writer. */
-		tty_reply(tp->tty_outrepcode, tp->tty_outcaller,
-					tp->tty_outproc, tp->tty_outcum);
-		tp->tty_outcum = 0;
-	}
-  }
-  if (tp->tty_outleft > 0 && tp->tty_termios.c_ospeed == B0) {
-	/* Oops, the line has hung up. */
-	tty_reply(tp->tty_outrepcode, tp->tty_outcaller, tp->tty_outproc, EIO);
-	tp->tty_outleft = tp->tty_outcum = 0;
-  }
-
-  return 1;
-}
-
-/*===========================================================================*
- *				rs_echo					     *
- *===========================================================================*/
-PRIVATE void rs_echo(tp, c)
-tty_t *tp;			/* which TTY */
-int c;				/* character to echo */
-{
-/* Echo one character.  (Like rs_write, but only one character, optionally.) */
-
-  rs232_t *rs = tp->tty_priv;
-  int count, ocount;
-
-  ocount = buflen(rs->obuf) - rs->ocount;
-  if (ocount == 0) return;		/* output buffer full */
-  count = 1;
-  *rs->ohead = c;			/* add one character */
-
-  out_process(tp, rs->obuf, rs->ohead, bufend(rs->obuf), &count, &ocount);
-  if (count == 0) return;
-
-  lock();
-  rs->ocount += ocount;
-  rs_ostart(rs);
-  unlock();
-  if ((rs->ohead += ocount) >= bufend(rs->obuf)) rs->ohead -= buflen(rs->obuf);
-}
-
-/*===========================================================================*
- *				rs_ioctl				     *
- *===========================================================================*/
-PRIVATE int rs_ioctl(tp, dummy)
-tty_t *tp;			/* which TTY */
-int dummy;
-{
-/* Reconfigure the line as soon as the output has drained. */
-  rs232_t *rs = tp->tty_priv;
-
-  rs->drain = TRUE;
-  return 0;	/* dummy */
-}
-
-/*===========================================================================*
- *				rs_config				     *
- *===========================================================================*/
-PRIVATE void rs_config(rs)
-rs232_t *rs;			/* which line */
-{
-/* Set various line control parameters for RS232 I/O.
- * If DataBits == 5 and StopBits == 2, 8250 will generate 1.5 stop bits.
- * The 8250 can't handle split speed, so we use the input speed.
- */
-
-  tty_t *tp = rs->tty;
-  int divisor;
-  int line_controls;
-  static struct speed2divisor {
-	speed_t	speed;
-	int	divisor;
-  } s2d[] = {
-#if (MACHINE == IBM_PC)
-	{ B50,		UART_FREQ / 50		},
-#endif
-	{ B75,		UART_FREQ / 75		},
-	{ B110,		UART_FREQ / 110		},
-	{ B134,		UART_FREQ * 10 / 1345	},
-	{ B150,		UART_FREQ / 150		},
-	{ B200,		UART_FREQ / 200		},
-	{ B300,		UART_FREQ / 300		},
-	{ B600,		UART_FREQ / 600		},
-	{ B1200,	UART_FREQ / 1200	},
-#if (MACHINE == IBM_PC)
-	{ B1800,	UART_FREQ / 1800	},
-#endif
-	{ B2400,	UART_FREQ / 2400	},
-	{ B4800,	UART_FREQ / 4800	},
-	{ B9600,	UART_FREQ / 9600	},
-	{ B19200,	UART_FREQ / 19200	},
-#if (MACHINE == IBM_PC)
-	{ B38400,	UART_FREQ / 38400	},
-	{ B57600,	UART_FREQ / 57600	},
-	{ B115200,	UART_FREQ / 115200L	},
-#endif
-  };
-  struct speed2divisor *s2dp;
-
-  /* RS232 needs to know the xoff character, and if CTS works. */
-  rs->oxoff = tp->tty_termios.c_cc[VSTOP];
-  rs->cts = (tp->tty_termios.c_cflag & CLOCAL) ? MS_CTS : 0;
-
-  /* Look up the 8250 rate divisor from the output speed. */
-  divisor = 0;
-  for (s2dp = s2d; s2dp < s2d + sizeof(s2d)/sizeof(s2d[0]); s2dp++) {
-	if (s2dp->speed == tp->tty_termios.c_ospeed) divisor = s2dp->divisor;
-  }
-  if (divisor == 0) return;	/* B0? */
-
-#if (MACHINE == IBM_PC)
-  /* Compute line control flag bits. */
-  line_controls = 0;
-  if (tp->tty_termios.c_cflag & PARENB) {
-	line_controls |= LC_PARITY;
-	if (!(tp->tty_termios.c_cflag & PARODD)) line_controls |= LC_PAREVEN;
-  }
-  if (divisor >= (UART_FREQ / 110)) line_controls |= LC_2STOP_BITS;
-  line_controls |= (tp->tty_termios.c_cflag & CSIZE) >> 2;
-
-  /* Lock out interrupts while setting the speed. The receiver register is
-   * going to be hidden by the div_low register, but the input interrupt
-   * handler relies on reading it to clear the interrupt and avoid looping
-   * forever.
-   */
-  lock();
-
-  /* Select the baud rate divisor registers and change the rate. */
-  sys_outb(rs->line_ctl_port, LC_ADDRESS_DIVISOR);
-  sys_outb(rs->div_low_port, divisor);
-  sys_outb(rs->div_hi_port, divisor >> 8);
-
-  /* Change the line controls and reselect the usual registers. */
-  sys_outb(rs->line_ctl_port, line_controls);
-
-  rs->ostate = devready(rs) | ORAW | OSWREADY;	/* reads modem_ctl_port */
-  if ((tp->tty_termios.c_lflag & IXON) && rs->oxoff != _POSIX_VDISABLE)
-	rs->ostate &= ~ORAW;
-
-  unlock();
-
-#else /* MACHINE == ATARI */
-
-  line_controls = U_Q16;
-  if (tp->tty_termios.c_cflag & PARENB) {
-	line_controls |= U_PAR;
-	if (!(tp->tty_termios.c_cflag & PARODD)) line_controls |= U_EVEN;
-  }
-  line_controls |= (divisor >= (UART_FREQ / 110)) ? U_ST2 : U_ST1;
-
-  switch (tp->tty_termios.c_cflag & CSIZE) {	/* XXX - are U_Dn like CSn? */
-	case CS5:	line_controls |= U_D5; break;
-	case CS5:	line_controls |= U_D6; break;
-	case CS5:	line_controls |= U_D7; break;
-	case CS5:	line_controls |= U_D8; break;
-  }
-  lock();
-  MFP->mf_ucr = line_controls;
-  MFP->mf_tddr = divisor;
-  unlock();
-#endif /* MACHINE == ATARI */
-}
-
-/*===========================================================================*
- *				rs_init					     *
- *===========================================================================*/
-PUBLIC void rs_init(tp)
-tty_t *tp;			/* which TTY */
-{
-  unsigned long dummy;
-/* Initialize RS232 for one line. */
-
-  register rs232_t *rs;
-  int line;
-#if (MACHINE == IBM_PC)
-  port_t this_8250;
-  int irq;
-  long v;
-#endif
-
-  /* Associate RS232 and TTY structures. */
-  line = tp - &tty_table[NR_CONS];
-  rs = tp->tty_priv = &rs_lines[line];
-  rs->tty = tp;
-
-  /* Set up input queue. */
-  rs->ihead = rs->itail = rs->ibuf;
-
-#if (MACHINE == IBM_PC)
-  /* Precalculate port numbers for speed. Magic numbers in the code (once). */
-  this_8250 = addr_8250[line];
-  rs->xmit_port = this_8250 + 0;
-  rs->recv_port = this_8250 + 0;
-  rs->div_low_port = this_8250 + 0;
-  rs->div_hi_port = this_8250 + 1;
-  rs->int_enab_port = this_8250 + 1;
-  rs->int_id_port = this_8250 + 2;
-  rs->line_ctl_port = this_8250 + 3;
-  rs->modem_ctl_port = this_8250 + 4;
-  rs->line_status_port = this_8250 + 5;
-  rs->modem_status_port = this_8250 + 6;
-#endif
-
-  /* Set up the hardware to a base state, in particular
-   *	o turn off DTR (MC_DTR) to try to stop the external device.
-   *	o be careful about the divisor latch.  Some BIOS's leave it enabled
-   *	  here and that caused trouble (no interrupts) in version 1.5 by
-   *	  hiding the interrupt enable port in the next step, and worse trouble
-   *	  (continual interrupts) in an old version by hiding the receiver
-   *	  port in the first interrupt.  Call rs_ioctl() early to avoid this.
-   *	o disable interrupts at the chip level, to force an edge transition
-   *	  on the 8259 line when interrupts are next enabled and active.
-   *	  RS232 interrupts are guaranteed to be disabled now by the 8259
-   *	  mask, but there used to be trouble if the mask was set without
-   *	  handling a previous interrupt.
-   */
-  istop(rs);			/* sets modem_ctl_port */
-  rs_config(rs);
-#if (MACHINE == IBM_PC)
-  sys_outb(rs->int_enab_port, 0);
-#endif
-
-  /* Clear any harmful leftover interrupts.  An output interrupt is harmless
-   * and will occur when interrupts are enabled anyway.  Set up the output
-   * queue using the status from clearing the modem status interrupt.
-   */
-#if (MACHINE == IBM_PC)
-  sys_inb(rs->line_status_port, &dummy);
-  sys_inb(rs->recv_port, &dummy);
-#endif
-  rs->ostate = devready(rs) | ORAW | OSWREADY;	/* reads modem_ctl_port */
-  rs->ohead = rs->otail = rs->obuf;
-
-#if (MACHINE == IBM_PC)
-  /* Enable interrupts for both interrupt controller and device. */
-  irq = (line & 1) == 0 ? RS232_IRQ : SECONDARY_IRQ;
-
-  rs->irq = irq;
-  rs->irq_hook_id = rs->irq;	/* call back with irq line number */
-  if (sys_irqsetpolicy(irq, IRQ_REENABLE, &rs->irq_hook_id) != OK) {
-  	printf("RS232: Couldn't obtain hook for irq %d\n", irq);
-  } else {
-  	if (sys_irqenable(&rs->irq_hook_id) != OK)  {
-  		printf("RS232: Couldn't enable irq %d (hooked)\n", irq);
-  	}
-  }
-
-  rs_irq_set |= (1 << irq);
-
-  sys_outb(rs->int_enab_port, IE_LINE_STATUS_CHANGE | IE_MODEM_STATUS_CHANGE
-				| IE_RECEIVER_READY | IE_TRANSMITTER_READY);
-#else /* MACHINE == ATARI */
-  /* Initialize the 68901 chip, then enable interrupts. */
-  MFP->mf_scr = 0x00;
-  MFP->mf_tcdcr |= T_Q004;
-  MFP->mf_rsr = R_ENA;
-  MFP->mf_tsr = T_ENA;
-  MFP->mf_aer = (MFP->mf_aer | (IO_SCTS|IO_SDCD)) ^
-		 (MFP->mf_gpip & (IO_SCTS|IO_SDCD));
-  MFP->mf_ddr = (MFP->mf_ddr & ~ (IO_SCTS|IO_SDCD));
-  MFP->mf_iera |= (IA_RRDY|IA_RERR|IA_TRDY|IA_TERR);
-  MFP->mf_imra |= (IA_RRDY|IA_RERR|IA_TRDY|IA_TERR);
-  MFP->mf_ierb |= (IB_SCTS|IB_SDCD);
-  MFP->mf_imrb |= (IB_SCTS|IB_SDCD);
-#endif /* MACHINE == ATARI */
-
-  /* Fill in TTY function hooks. */
-  tp->tty_devread = rs_read;
-  tp->tty_devwrite = rs_write;
-  tp->tty_echo = rs_echo;
-  tp->tty_icancel = rs_icancel;
-  tp->tty_ocancel = rs_ocancel;
-  tp->tty_ioctl = rs_ioctl;
-  tp->tty_break = rs_break;
-  tp->tty_close = rs_close;
-
-  /* Tell external device we are ready. */
-  istart(rs);
-
-}
-
-/*===========================================================================*
- *				rs_interrupt				     *
- *===========================================================================*/
-PUBLIC void rs_interrupt(m)
-message *m;			/* which TTY */
-{
-	unsigned long irq_set;
-	int i;
-	rs232_t *rs;
-
-	irq_set= m->NOTIFY_ARG;
-	for (i= 0, rs = rs_lines; i<NR_RS_LINES; i++, rs++)
-	{
-		if (irq_set & (1 << rs->irq))
-			rs232_handler(rs);
-	}
-}
-
-/*===========================================================================*
- *				rs_icancel				     *
- *===========================================================================*/
-PRIVATE int rs_icancel(tp, dummy)
-tty_t *tp;			/* which TTY */
-int dummy;
-{
-/* Cancel waiting input. */
-  rs232_t *rs = tp->tty_priv;
-
-  lock();
-  rs->icount = 0;
-  rs->itail = rs->ihead;
-  istart(rs);
-  unlock();
-
-  return 0;	/* dummy */
-}
-
-/*===========================================================================*
- *				rs_ocancel				     *
- *===========================================================================*/
-PRIVATE int rs_ocancel(tp, dummy)
-tty_t *tp;			/* which TTY */
-int dummy;
-{
-/* Cancel pending output. */
-  rs232_t *rs = tp->tty_priv;
-
-  lock();
-  rs->ostate &= ~(ODONE | OQUEUED);
-  rs->ocount = 0;
-  rs->otail = rs->ohead;
-  unlock();
-
-  return 0;	/* dummy */
-}
-
-/*===========================================================================*
- *				rs_read					     *
- *===========================================================================*/
-PRIVATE int rs_read(tp, try)
-tty_t *tp;			/* which tty */
-int try;
-{
-/* Process characters from the circular input buffer. */
-
-  rs232_t *rs = tp->tty_priv;
-  int icount, count, ostate;
-
-  if (!(tp->tty_termios.c_cflag & CLOCAL)) {
-  	if (try) return 1;
-	/* Send a SIGHUP if hangup detected. */
-	lock();
-	ostate = rs->ostate;
-	rs->ostate &= ~ODEVHUP;		/* save ostate, clear DEVHUP */
-	unlock();
-	if (ostate & ODEVHUP) {
-		sigchar(tp, SIGHUP);
-		tp->tty_termios.c_ospeed = B0;	/* Disable further I/O. */
-		return;
-	}
-  }
-
-  if (try) {
-  	if (rs->icount > 0)
-	  	return 1;
-	return 0;
-  }
-
-  while ((count = rs->icount) > 0) {
-	icount = bufend(rs->ibuf) - rs->itail;
-	if (count > icount) count = icount;
-
-	/* Perform input processing on (part of) the input buffer. */
-	if ((count = in_process(tp, rs->itail, count)) == 0) break;
-
-	lock();			/* protect interrupt sensitive variables */
-	rs->icount -= count;
-	if (!rs->idevready && rs->icount < RS_ILOWWATER) istart(rs);
-	unlock();
-	if ((rs->itail += count) == bufend(rs->ibuf)) rs->itail = rs->ibuf;
-  }
-}
-
-/*===========================================================================*
- *				rs_ostart				     *
- *===========================================================================*/
-PRIVATE void rs_ostart(rs)
-rs232_t *rs;			/* which rs line */
-{
-/* Tell RS232 there is something waiting in the output buffer. */
-
-  rs->ostate |= OQUEUED;
-  if (txready(rs)) out_int(rs);
-}
-
-/*===========================================================================*
- *				rs_break				     *
- *===========================================================================*/
-PRIVATE int rs_break(tp, dummy)
-tty_t *tp;			/* which tty */
-int dummy;
-{
-/* Generate a break condition by setting the BREAK bit for 0.4 sec. */
-  rs232_t *rs = tp->tty_priv;
-  unsigned long line_controls;
-
-  sys_inb(rs->line_ctl_port, &line_controls);
-  sys_outb(rs->line_ctl_port, line_controls | LC_BREAK);
-  /* XXX */
-  /* milli_delay(400); */				/* ouch */
-  printf("RS232 break\n");
-  sys_outb(rs->line_ctl_port, line_controls);
-  return 0;	/* dummy */
-}
-
-/*===========================================================================*
- *				rs_close				     *
- *===========================================================================*/
-PRIVATE int rs_close(tp, dummy)
-tty_t *tp;			/* which tty */
-int dummy;
-{
-/* The line is closed; optionally hang up. */
-  rs232_t *rs = tp->tty_priv;
-  int r;
-
-  if (tp->tty_termios.c_cflag & HUPCL) {
-	sys_outb(rs->modem_ctl_port, MC_OUT2 | MC_RTS);
-  }
-  return 0;	/* dummy */
-}
-
-/* Low level (interrupt) routines. */
-
-#if (MACHINE == IBM_PC)
-/*===========================================================================*
- *				rs232_handler				     *
- *===========================================================================*/
-PRIVATE void rs232_handler(rs)
-struct rs232 *rs;
-{
-/* Interrupt hander for RS232. */
-
-  while (TRUE) {
-  	unsigned long v;
-	/* Loop to pick up ALL pending interrupts for device.
-	 * This usually just wastes time unless the hardware has a buffer
-	 * (and then we have to worry about being stuck in the loop too long).
-	 * Unfortunately, some serial cards lock up without this.
-	 */
-	sys_inb(rs->int_id_port, &v);
-	switch (v) {
-	case IS_RECEIVER_READY:
-		in_int(rs);
-		continue;
-	case IS_TRANSMITTER_READY:
-		out_int(rs);
-		continue;
-	case IS_MODEM_STATUS_CHANGE:
-		modem_int(rs);
-		continue;
-	case IS_LINE_STATUS_CHANGE:
-		line_int(rs);
-		continue;
-	}
-	return;
-  }
-}
-#endif /* MACHINE == IBM_PC */
-
-#if (MACHINE == ATARI)
-/*===========================================================================*
- *				siaint					     *
- *===========================================================================*/
-PRIVATE void siaint(type)
-int    type;	       /* interrupt type */
-{
-/* siaint is the rs232 interrupt procedure for Atari ST's. For ST there are
- * as much as 5 interrupt lines used for rs232. The trap type byte left on the
- * stack by the assembler interrupt handler identifies the interrupt cause.
- */
-
-  register unsigned char  code;
-  register rs232_t *rs = &rs_lines[0];
-  int s = lock();
-
-  switch (type & 0x00FF)
-  {
-	case 0x00:	       /* receive buffer full */
-		in_int(rs);
-		break;
-	case 0x01:	       /* receive error */
-		line_int(rs);
-		break;
-	case 0x02:	       /* transmit buffer empty */
-		out_int(rs);
-		break;
-	case 0x03:	       /* transmit error */
-		code = MFP->mf_tsr;
-		if (code & ~(T_ENA | T_UE | T_EMPTY))
-		{
-		    printf("sia: transmit error: status=%x\r\n", code);
-		    /* MFP->mf_udr = lastchar; */ /* retry */
-		}
-		break;
-	case 0x04:		/* modem lines change */
-		modem_int(rs);
-		break;
-  }
-  restore(s);
-}
-#endif /* MACHINE == ATARI */
-
-/*===========================================================================*
- *				in_int					     *
- *===========================================================================*/
-PRIVATE void in_int(rs)
-register rs232_t *rs;		/* line with input interrupt */
-{
-/* Read the data which just arrived.
- * If it is the oxoff char, clear OSWREADY, else if OSWREADY was clear, set
- * it and restart output (any char does this, not just xon).
- * Put data in the buffer if room, otherwise discard it.
- * Set a flag for the clock interrupt handler to eventually notify TTY.
- */
-
-  unsigned long c;
-
-#if (MACHINE == IBM_PC)
-  sys_inb(rs->recv_port, &c);
-#else /* MACHINE == ATARI */
-  c = MFP->mf_udr;
-#endif
-
-  if (!(rs->ostate & ORAW)) {
-	if (c == rs->oxoff) {
-		rs->ostate &= ~OSWREADY;
-	} else
-	if (!(rs->ostate & OSWREADY)) {
-		rs->ostate |= OSWREADY;
-		if (txready(rs)) out_int(rs);
-	}
-  }
-
-  if (rs->icount == buflen(rs->ibuf))
-  {
-	printf("in_int: discarding byte\n");
-	return;	/* input buffer full, discard */
-  }
-
-  if (++rs->icount == RS_IHIGHWATER && rs->idevready) istop(rs);
-  *rs->ihead = c;
-  if (++rs->ihead == bufend(rs->ibuf)) rs->ihead = rs->ibuf;
-  if (rs->icount == 1) {
-	rs->tty->tty_events = 1;
-	force_timeout();
-  }
-  else
-	printf("in_int: icount = %d\n", rs->icount);
-}
-
-/*===========================================================================*
- *				line_int				     *
- *===========================================================================*/
-PRIVATE void line_int(rs)
-register rs232_t *rs;		/* line with line status interrupt */
-{
-/* Check for and record errors. */
-
- unsigned long s;
-#if (MACHINE == IBM_PC)
-  sys_inb(rs->line_status_port, &s);
-  rs->lstatus = s;
-#else /* MACHINE == ATARI */
-  rs->lstatus = MFP->mf_rsr;
-  MFP->mf_rsr &= R_ENA;
-  rs->pad = MFP->mf_udr;	/* discard char in case of LS_OVERRUN_ERR */
-#endif /* MACHINE == ATARI */
-  if (rs->lstatus & LS_FRAMING_ERR) ++rs->framing_errors;
-  if (rs->lstatus & LS_OVERRUN_ERR) ++rs->overrun_errors;
-  if (rs->lstatus & LS_PARITY_ERR) ++rs->parity_errors;
-  if (rs->lstatus & LS_BREAK_INTERRUPT) ++rs->break_interrupts;
-}
-
-/*===========================================================================*
- *				modem_int				     *
- *===========================================================================*/
-PRIVATE void modem_int(rs)
-register rs232_t *rs;		/* line with modem interrupt */
-{
-/* Get possibly new device-ready status, and clear ODEVREADY if necessary.
- * If the device just became ready, restart output.
- */
-
-#if (MACHINE == ATARI)
-  /* Set active edge interrupt so that next change causes a new interrupt */
-  MFP->mf_aer = (MFP->mf_aer | (IO_SCTS|IO_SDCD)) ^
-		 (MFP->mf_gpip & (IO_SCTS|IO_SDCD));
-#endif
-
-  if (devhup(rs)) {
-	rs->ostate |= ODEVHUP;
-	rs->tty->tty_events = 1;
-	force_timeout();
-  }
-
-  if (!devready(rs))
-	rs->ostate &= ~ODEVREADY;
-  else if (!(rs->ostate & ODEVREADY)) {
-	rs->ostate |= ODEVREADY;
-	if (txready(rs)) out_int(rs);
-  }
-}
-
-/*===========================================================================*
- *				out_int					    *
- *===========================================================================*/
-PRIVATE void out_int(rs)
-register rs232_t *rs;		/* line with output interrupt */
-{
-/* If there is output to do and everything is ready, do it (local device is
- * known ready).
- * Notify TTY when the buffer goes empty.
- */
-
-  if (rs->ostate >= (ODEVREADY | OQUEUED | OSWREADY)) {
-	/* Bit test allows ORAW and requires the others. */
-#if (MACHINE == IBM_PC)
-	sys_outb(rs->xmit_port, *rs->otail);
-#else /* MACHINE == ATARI */
-	MFP->mf_udr = *rs->otail;
-#endif
-	if (++rs->otail == bufend(rs->obuf)) rs->otail = rs->obuf;
-	if (--rs->ocount == 0) {
-		rs->ostate ^= (ODONE | OQUEUED);  /* ODONE on, OQUEUED off */
-		rs->tty->tty_events = 1;
-		force_timeout();
-	} else
-	if (rs->ocount == RS_OLOWWATER) {	/* running low? */
-		rs->tty->tty_events = 1;
-		force_timeout();
-	}
-  }
-}
-#endif /* NR_RS_LINES > 0 */
-
Index: trunk/minix/drivers/tty/tty.c
===================================================================
--- trunk/minix/drivers/tty/tty.c	(revision 9)
+++ 	(revision )
@@ -1,2026 +1,0 @@
-/* This file contains the terminal driver, both for the IBM console and regular
- * ASCII terminals.  It handles only the device-independent part of a TTY, the
- * device dependent parts are in console.c, rs232.c, etc.  This file contains
- * two main entry points, tty_task() and tty_wakeup(), and several minor entry
- * points for use by the device-dependent code.
- *
- * The device-independent part accepts "keyboard" input from the device-
- * dependent part, performs input processing (special key interpretation),
- * and sends the input to a process reading from the TTY.  Output to a TTY
- * is sent to the device-dependent code for output processing and "screen"
- * display.  Input processing is done by the device by calling 'in_process'
- * on the input characters, output processing may be done by the device itself
- * or by calling 'out_process'.  The TTY takes care of input queuing, the
- * device does the output queuing.  If a device receives an external signal,
- * like an interrupt, then it causes tty_wakeup() to be run by the CLOCK task
- * to, you guessed it, wake up the TTY to check if input or output can
- * continue.
- *
- * The valid messages and their parameters are:
- *
- *   HARD_INT:       output has been completed or input has arrived
- *   SYS_SIG:      e.g., MINIX wants to shutdown; run code to cleanly stop
- *   DEV_READ:       a process wants to read from a terminal
- *   DEV_WRITE:      a process wants to write on a terminal
- *   DEV_IOCTL:      a process wants to change a terminal's parameters
- *   DEV_OPEN:       a tty line has been opened
- *   DEV_CLOSE:      a tty line has been closed
- *   DEV_SELECT:     start select notification request
- *   DEV_STATUS:     FS wants to know status for SELECT or REVIVE
- *   CANCEL:         terminate a previous incomplete system call immediately
- *
- *    m_type      TTY_LINE   IO_ENDPT    COUNT   TTY_SPEK  TTY_FLAGS  ADDRESS
- * ---------------------------------------------------------------------------
- * | HARD_INT    |         |         |         |         |         |         |
- * |-------------+---------+---------+---------+---------+---------+---------|
- * | SYS_SIG     | sig set |         |         |         |         |         |
- * |-------------+---------+---------+---------+---------+---------+---------|
- * | DEV_READ    |minor dev| proc nr |  count  |         O_NONBLOCK| buf ptr |
- * |-------------+---------+---------+---------+---------+---------+---------|
- * | DEV_WRITE   |minor dev| proc nr |  count  |         |         | buf ptr |
- * |-------------+---------+---------+---------+---------+---------+---------|
- * | DEV_IOCTL   |minor dev| proc nr |func code|erase etc|  flags  |         |
- * |-------------+---------+---------+---------+---------+---------+---------|
- * | DEV_OPEN    |minor dev| proc nr | O_NOCTTY|         |         |         |
- * |-------------+---------+---------+---------+---------+---------+---------|
- * | DEV_CLOSE   |minor dev| proc nr |         |         |         |         |
- * |-------------+---------+---------+---------+---------+---------+---------|
- * | DEV_STATUS  |         |         |         |         |         |         |
- * |-------------+---------+---------+---------+---------+---------+---------|
- * | CANCEL      |minor dev| proc nr |         |         |         |         |
- * ---------------------------------------------------------------------------
- *
- * Changes:
- *   Jan 20, 2004   moved TTY driver to user-space  (Jorrit N. Herder)
- *   Sep 20, 2004   local timer management/ sync alarms  (Jorrit N. Herder)
- *   Jul 13, 2004   support for function key observers  (Jorrit N. Herder)  
- */
-
-#include "../drivers.h"
-#include "../drivers.h"
-#include <termios.h>
-#if ENABLE_SRCCOMPAT || ENABLE_BINCOMPAT
-#include <sgtty.h>
-#endif
-#include <sys/ioc_tty.h>
-#include <signal.h>
-#include <minix/callnr.h>
-#if (CHIP == INTEL)
-#include <minix/keymap.h>
-#endif
-#include "tty.h"
-
-#include <sys/time.h>
-#include <sys/select.h>
-
-extern int irq_hook_id;
-
-unsigned long kbd_irq_set = 0;
-unsigned long rs_irq_set = 0;
-
-/* Address of a tty structure. */
-#define tty_addr(line)	(&tty_table[line])
-
-/* Macros for magic tty types. */
-#define isconsole(tp)	((tp) < tty_addr(NR_CONS))
-#define ispty(tp)	((tp) >= tty_addr(NR_CONS+NR_RS_LINES))
-
-/* Macros for magic tty structure pointers. */
-#define FIRST_TTY	tty_addr(0)
-#define END_TTY		tty_addr(sizeof(tty_table) / sizeof(tty_table[0]))
-
-/* A device exists if at least its 'devread' function is defined. */
-#define tty_active(tp)	((tp)->tty_devread != NULL)
-
-/* RS232 lines or pseudo terminals can be completely configured out. */
-#if NR_RS_LINES == 0
-#define rs_init(tp)	((void) 0)
-#endif
-#if NR_PTYS == 0
-#define pty_init(tp)	((void) 0)
-#define do_pty(tp, mp)	((void) 0)
-#endif
-
-struct kmessages kmess;
-
-FORWARD _PROTOTYPE( void tty_timed_out, (timer_t *tp)			);
-FORWARD _PROTOTYPE( void expire_timers, (void)				);
-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_ioctl, (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_read, (tty_t *tp, message *m_ptr)		);
-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_status, (message *m_ptr)			);
-FORWARD _PROTOTYPE( void in_transfer, (tty_t *tp)			);
-FORWARD _PROTOTYPE( int tty_echo, (tty_t *tp, int ch)			);
-FORWARD _PROTOTYPE( void rawecho, (tty_t *tp, int ch)			);
-FORWARD _PROTOTYPE( int back_over, (tty_t *tp)				);
-FORWARD _PROTOTYPE( void reprint, (tty_t *tp)				);
-FORWARD _PROTOTYPE( void dev_ioctl, (tty_t *tp)				);
-FORWARD _PROTOTYPE( void setattr, (tty_t *tp)				);
-FORWARD _PROTOTYPE( void tty_icancel, (tty_t *tp)			);
-FORWARD _PROTOTYPE( void tty_init, (void)				);
-#if ENABLE_SRCCOMPAT || ENABLE_BINCOMPAT
-FORWARD _PROTOTYPE( int compat_getp, (tty_t *tp, struct sgttyb *sg)	);
-FORWARD _PROTOTYPE( int compat_getc, (tty_t *tp, struct tchars *sg)	);
-FORWARD _PROTOTYPE( int compat_setp, (tty_t *tp, struct sgttyb *sg)	);
-FORWARD _PROTOTYPE( int compat_setc, (tty_t *tp, struct tchars *sg)	);
-FORWARD _PROTOTYPE( int tspd2sgspd, (speed_t tspd)			);
-FORWARD _PROTOTYPE( speed_t sgspd2tspd, (int sgspd)			);
-#if ENABLE_BINCOMPAT
-FORWARD _PROTOTYPE( void do_ioctl_compat, (tty_t *tp, message *m_ptr)	);
-#endif
-#endif
-
-/* Default attributes. */
-PRIVATE struct termios termios_defaults = {
-  TINPUT_DEF, TOUTPUT_DEF, TCTRL_DEF, TLOCAL_DEF, TSPEED_DEF, TSPEED_DEF,
-  {
-	TEOF_DEF, TEOL_DEF, TERASE_DEF, TINTR_DEF, TKILL_DEF, TMIN_DEF,
-	TQUIT_DEF, TTIME_DEF, TSUSP_DEF, TSTART_DEF, TSTOP_DEF,
-	TREPRINT_DEF, TLNEXT_DEF, TDISCARD_DEF,
-  },
-};
-PRIVATE struct winsize winsize_defaults;	/* = all zeroes */
-
-/* Global variables for the TTY task (declared extern in tty.h). */
-PUBLIC tty_t tty_table[NR_CONS+NR_RS_LINES+NR_PTYS];
-PUBLIC int ccurrent;			/* currently active console */
-PUBLIC timer_t *tty_timers;		/* queue of TTY timers */
-PUBLIC clock_t tty_next_timeout;	/* time that the next alarm is due */
-PUBLIC struct machine machine;		/* kernel environment variables */
-
-/*===========================================================================*
- *				tty_task				     *
- *===========================================================================*/
-PUBLIC void main(void)
-{
-/* Main routine of the terminal task. */
-
-  message tty_mess;		/* buffer for all incoming messages */
-  unsigned line;
-  int r, s;
-  register struct proc *rp;
-  register tty_t *tp;
-
-#if DEBUG
-  kputc('H');
-  kputc('e');
-  kputc('l');
-  kputc('l');
-  kputc('o');
-  kputc(',');
-  kputc(' ');
-  printf("TTY\n");
-#endif
-
-  /* Get kernel environment (protected_mode, pc_at and ega are needed). */ 
-  if (OK != (s=sys_getmachine(&machine))) {
-    panic("TTY","Couldn't obtain kernel environment.", s);
-  }
-
-  /* Initialize the TTY driver. */
-  tty_init();
-
-  /* Final one-time keyboard initialization. */
-  kb_init_once();
-
-  printf("\n");
-
-  while (TRUE) {
-
-	/* Check for and handle any events on any of the ttys. */
-	for (tp = FIRST_TTY; tp < END_TTY; tp++) {
-		if (tp->tty_events) handle_events(tp);
-	}
-
-	/* Get a request message. */
-	r= receive(ANY, &tty_mess);
-	if (r != 0)
-		panic("TTY", "receive failed with %d", r);
-
-	/* First handle all kernel notification types that the TTY supports. 
-	 *  - An alarm went off, expire all timers and handle the events. 
-	 *  - A hardware interrupt also is an invitation to check for events. 
-	 *  - A new kernel message is available for printing.
-	 *  - Reset the console on system shutdown. 
-	 * Then see if this message is different from a normal device driver
-	 * request and should be handled separately. These extra functions
-	 * do not operate on a device, in constrast to the driver requests. 
-	 */
-	switch (tty_mess.m_type) { 
-	case SYN_ALARM: 		/* fall through */
-		expire_timers();	/* run watchdogs of expired timers */
-		continue;		/* contine to check for events */
-	case DEV_PING:
-		notify(tty_mess.m_source);
-		continue;
-	case HARD_INT: {		/* hardware interrupt notification */
-		if (tty_mess.NOTIFY_ARG & kbd_irq_set)
-			kbd_interrupt(&tty_mess);/* fetch chars from keyboard */
-#if NR_RS_LINES > 0
-		if (tty_mess.NOTIFY_ARG & rs_irq_set)
-			rs_interrupt(&tty_mess);/* serial I/O */
-#endif
-		expire_timers();	/* run watchdogs of expired timers */
-		continue;		/* contine to check for events */
-	}
-	case PROC_EVENT: {
-		cons_stop();		/* switch to primary console */
-		printf("TTY got PROC_EVENT, assuming SIGTERM\n");
-#if DEAD_CODE
-		if (irq_hook_id != -1) {
-			sys_irqdisable(&irq_hook_id);
-			sys_irqrmpolicy(KEYBOARD_IRQ, &irq_hook_id);
-		}
-#endif
-		continue;
-	}
-	case SYS_SIG: {			/* system signal */
-		sigset_t sigset = (sigset_t) tty_mess.NOTIFY_ARG;
-		if (sigismember(&sigset, SIGKMESS)) do_new_kmess(&tty_mess);
-		continue;
-	}
-	case DIAGNOSTICS: 		/* a server wants to print some */
-		do_diagnostics(&tty_mess);
-		continue;
-	case GET_KMESS:
-		do_get_kmess(&tty_mess);
-		continue;
-	case FKEY_CONTROL:		/* (un)register a fkey observer */
-		do_fkey_ctl(&tty_mess);
-		continue;
-	default:			/* should be a driver request */
-		;			/* do nothing; end switch */
-	}
-
-	/* Only device requests should get to this point. All requests, 
-	 * except DEV_STATUS, have a minor device number. Check this
-	 * exception and get the minor device number otherwise.
-	 */
-	if (tty_mess.m_type == DEV_STATUS) {
-		do_status(&tty_mess);
-		continue;
-	}
-	line = tty_mess.TTY_LINE;
-	if (line == KBD_MINOR) {
-		do_kbd(&tty_mess);
-		continue;
-	} else if (line == KBDAUX_MINOR) {
-		do_kbdaux(&tty_mess);
-		continue;
-	} else if (line == VIDEO_MINOR) {
-		do_video(&tty_mess);
-		continue;
-	} else if ((line - CONS_MINOR) < NR_CONS) {
-		tp = tty_addr(line - CONS_MINOR);
-	} else if (line == LOG_MINOR) {
-		tp = tty_addr(0);
-	} else if ((line - RS232_MINOR) < NR_RS_LINES) {
-		tp = tty_addr(line - RS232_MINOR + NR_CONS);
-	} else if ((line - TTYPX_MINOR) < NR_PTYS) {
-		tp = tty_addr(line - TTYPX_MINOR + NR_CONS + NR_RS_LINES);
-	} else if ((line - PTYPX_MINOR) < NR_PTYS) {
-		tp = tty_addr(line - PTYPX_MINOR + NR_CONS + NR_RS_LINES);
-		if (tty_mess.m_type != DEV_IOCTL) {
-			do_pty(tp, &tty_mess);
-			continue;
-		}
-	} else {
-		tp = NULL;
-	}
-
-	/* If the device doesn't exist or is not configured return ENXIO. */
-	if (tp == NULL || ! tty_active(tp)) {
-		printf("Warning, TTY got illegal request %d from %d\n",
-			tty_mess.m_type, tty_mess.m_source);
-		if (tty_mess.m_source != LOG_PROC_NR)
-		{
-			tty_reply(TASK_REPLY, tty_mess.m_source,
-						tty_mess.IO_ENDPT, ENXIO);
-		}
-		continue;
-	}
-
-	/* Execute the requested device driver function. */
-	switch (tty_mess.m_type) {
-	    case DEV_READ:	 do_read(tp, &tty_mess);	  break;
-	    case DEV_WRITE:	 do_write(tp, &tty_mess);	  break;
-	    case DEV_IOCTL:	 do_ioctl(tp, &tty_mess);	  break;
-	    case DEV_OPEN:	 do_open(tp, &tty_mess);	  break;
-	    case DEV_CLOSE:	 do_close(tp, &tty_mess);	  break;
-	    case DEV_SELECT:	 do_select(tp, &tty_mess);	  break;
-	    case CANCEL:	 do_cancel(tp, &tty_mess);	  break;
-	    default:		
-		printf("Warning, TTY got unexpected request %d from %d\n",
-			tty_mess.m_type, tty_mess.m_source);
-	    tty_reply(TASK_REPLY, tty_mess.m_source,
-						tty_mess.IO_ENDPT, EINVAL);
-	}
-  }
-}
-
-/*===========================================================================*
- *				do_status				     *
- *===========================================================================*/
-PRIVATE void do_status(m_ptr)
-message *m_ptr;
-{
-  register struct tty *tp;
-  int event_found;
-  int status;
-  int ops;
-  
-  /* Check for select or revive events on any of the ttys. If we found an, 
-   * event return a single status message for it. The FS will make another 
-   * call to see if there is more.
-   */
-  event_found = 0;
-  for (tp = FIRST_TTY; tp < END_TTY; tp++) {
-	if ((ops = select_try(tp, tp->tty_select_ops)) && 
-			tp->tty_select_proc == m_ptr->m_source) {
-
-		/* I/O for a selected minor device is ready. */
-		m_ptr->m_type = DEV_IO_READY;
-		m_ptr->DEV_MINOR = tp->tty_minor;
-		m_ptr->DEV_SEL_OPS = ops;
-
-		tp->tty_select_ops &= ~ops;	/* unmark select event */
-  		event_found = 1;
-		break;
-	}
-	else if (tp->tty_inrevived && tp->tty_incaller == m_ptr->m_source) {
-		
-		/* Suspended request finished. Send a REVIVE. */
-		m_ptr->m_type = DEV_REVIVE;
-  		m_ptr->REP_ENDPT = tp->tty_inproc;
-  		m_ptr->REP_STATUS = tp->tty_incum;
-
-		tp->tty_inleft = tp->tty_incum = 0;
-		tp->tty_inrevived = 0;		/* unmark revive event */
-  		event_found = 1;
-  		break;
-	}
-	else if (tp->tty_outrevived && tp->tty_outcaller == m_ptr->m_source) {
-		
-		/* Suspended request finished. Send a REVIVE. */
-		m_ptr->m_type = DEV_REVIVE;
-  		m_ptr->REP_ENDPT = tp->tty_outproc;
-  		m_ptr->REP_STATUS = tp->tty_outcum;
-
-		tp->tty_outcum = 0;
-		tp->tty_outrevived = 0;		/* unmark revive event */
-  		event_found = 1;
-  		break;
-	}
-  }
-
-#if NR_PTYS > 0
-  if (!event_found)
-  	event_found = pty_status(m_ptr);
-#endif
-  if (!event_found)
-	event_found= kbd_status(m_ptr);
-
-  if (! event_found) {
-	/* No events of interest were found. Return an empty message. */
-  	m_ptr->m_type = DEV_NO_STATUS;
-  }
-
-  /* Almost done. Send back the reply message to the caller. */
-  if ((status = send(m_ptr->m_source, m_ptr)) != OK) {
-	panic("TTY","send in do_status failed, status\n", status);
-  }
-}
-
-/*===========================================================================*
- *				do_read					     *
- *===========================================================================*/
-PRIVATE void do_read(tp, m_ptr)
-register tty_t *tp;		/* pointer to tty struct */
-register message *m_ptr;	/* pointer to message sent to the task */
-{
-/* A process wants to read from a terminal. */
-  int r, status;
-  phys_bytes phys_addr;
-  int more_verbose= (tp == tty_addr(NR_CONS));
-
-  /* Check if there is already a process hanging in a read, check if the
-   * parameters are correct, do I/O.
-   */
-  if (tp->tty_inleft > 0) {
-	if (more_verbose) printf("do_read: EIO\n");
-	r = EIO;
-  } else
-  if (m_ptr->COUNT <= 0) {
-	if (more_verbose) printf("do_read: EINVAL\n");
-	r = EINVAL;
-  } else
-  if (sys_umap(m_ptr->IO_ENDPT, D, (vir_bytes) m_ptr->ADDRESS, m_ptr->COUNT,
-		&phys_addr) != OK) {
-	if (more_verbose) printf("do_read: EFAULT\n");
-	r = EFAULT;
-  } else {
-	/* Copy information from the message to the tty struct. */
-	tp->tty_inrepcode = TASK_REPLY;
-	tp->tty_incaller = m_ptr->m_source;
-	tp->tty_inproc = m_ptr->IO_ENDPT;
-	tp->tty_in_vir = (vir_bytes) m_ptr->ADDRESS;
-	tp->tty_inleft = m_ptr->COUNT;
-
-	if (!(tp->tty_termios.c_lflag & ICANON)
-					&& tp->tty_termios.c_cc[VTIME] > 0) {
-		if (tp->tty_termios.c_cc[VMIN] == 0) {
-			/* MIN & TIME specify a read timer that finishes the
-			 * read in TIME/10 seconds if no bytes are available.
-			 */
-			settimer(tp, TRUE);
-			tp->tty_min = 1;
-		} else {
-			/* MIN & TIME specify an inter-byte timer that may
-			 * have to be cancelled if there are no bytes yet.
-			 */
-			if (tp->tty_eotct == 0) {
-				settimer(tp, FALSE);
-				tp->tty_min = tp->tty_termios.c_cc[VMIN];
-			}
-		}
-	}
-
-	/* Anything waiting in the input buffer? Clear it out... */
-	in_transfer(tp);
-	/* ...then go back for more. */
-	handle_events(tp);
-	if (tp->tty_inleft == 0)  {
-  		if (tp->tty_select_ops)
-  			select_retry(tp);
-		return;			/* already done */
-	}
-
-	/* There were no bytes in the input queue available, so either suspend
-	 * the caller or break off the read if nonblocking.
-	 */
-	if (m_ptr->TTY_FLAGS & O_NONBLOCK) {
-		r = EAGAIN;				/* cancel the read */
-		tp->tty_inleft = tp->tty_incum = 0;
-	} else {
-		r = SUSPEND;				/* suspend the caller */
-		tp->tty_inrepcode = REVIVE;
-	}
-  }
-  if (more_verbose) printf("do_read: replying %d\n", r);
-  tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, r);
-  if (tp->tty_select_ops)
-  	select_retry(tp);
-}
-
-/*===========================================================================*
- *				do_write				     *
- *===========================================================================*/
-PRIVATE void do_write(tp, m_ptr)
-register tty_t *tp;
-register message *m_ptr;	/* pointer to message sent to the task */
-{
-/* A process wants to write on a terminal. */
-  int r;
-  phys_bytes phys_addr;
-
-  /* Check if there is already a process hanging in a write, check if the
-   * parameters are correct, do I/O.
-   */
-  if (tp->tty_outleft > 0) {
-	r = EIO;
-  } else
-  if (m_ptr->COUNT <= 0) {
-	r = EINVAL;
-  } else
-  if (sys_umap(m_ptr->IO_ENDPT, D, (vir_bytes) m_ptr->ADDRESS, m_ptr->COUNT,
-		&phys_addr) != OK) {
-	r = EFAULT;
-  } else {
-	/* Copy message parameters to the tty structure. */
-	tp->tty_outrepcode = TASK_REPLY;
-	tp->tty_outcaller = m_ptr->m_source;
-	tp->tty_outproc = m_ptr->IO_ENDPT;
-	tp->tty_out_vir = (vir_bytes) m_ptr->ADDRESS;
-	tp->tty_outleft = m_ptr->COUNT;
-
-	/* Try to write. */
-	handle_events(tp);
-	if (tp->tty_outleft == 0) 
-		return;	/* already done */
-
-	/* None or not all the bytes could be written, so either suspend the
-	 * caller or break off the write if nonblocking.
-	 */
-	if (m_ptr->TTY_FLAGS & O_NONBLOCK) {		/* cancel the write */
-		r = tp->tty_outcum > 0 ? tp->tty_outcum : EAGAIN;
-		tp->tty_outleft = tp->tty_outcum = 0;
-	} else {
-		r = SUSPEND;				/* suspend the caller */
-		tp->tty_outrepcode = REVIVE;
-	}
-  }
-  tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, r);
-}
-
-/*===========================================================================*
- *				do_ioctl				     *
- *===========================================================================*/
-PRIVATE void do_ioctl(tp, m_ptr)
-register tty_t *tp;
-message *m_ptr;			/* pointer to message sent to task */
-{
-/* Perform an IOCTL on this terminal. Posix termios calls are handled
- * by the IOCTL system call
- */
-
-  int r;
-  union {
-	int i;
-#if ENABLE_SRCCOMPAT
-	struct sgttyb sg;
-	struct tchars tc;
-#endif
-  } param;
-  size_t size;
-
-  /* Size of the ioctl parameter. */
-  switch (m_ptr->TTY_REQUEST) {
-    case TCGETS:        /* Posix tcgetattr function */
-    case TCSETS:        /* Posix tcsetattr function, TCSANOW option */ 
-    case TCSETSW:       /* Posix tcsetattr function, TCSADRAIN option */
-    case TCSETSF:	/* Posix tcsetattr function, TCSAFLUSH option */
-        size = sizeof(struct termios);
-        break;
-
-    case TCSBRK:        /* Posix tcsendbreak function */
-    case TCFLOW:        /* Posix tcflow function */
-    case TCFLSH:        /* Posix tcflush function */
-    case TIOCGPGRP:     /* Posix tcgetpgrp function */
-    case TIOCSPGRP:	/* Posix tcsetpgrp function */
-        size = sizeof(int);
-        break;
-
-    case TIOCGWINSZ:    /* get window size (not Posix) */
-    case TIOCSWINSZ:	/* set window size (not Posix) */
-        size = sizeof(struct winsize);
-        break;
-
-#if ENABLE_SRCCOMPAT
-    case TIOCGETP:      /* BSD-style get terminal properties */
-    case TIOCSETP:	/* BSD-style set terminal properties */
-	size = sizeof(struct sgttyb);
-	break;
-
-    case TIOCGETC:      /* BSD-style get terminal special characters */ 
-    case TIOCSETC:	/* BSD-style get terminal special characters */ 
-	size = sizeof(struct tchars);
-	break;
-#endif
-#if (MACHINE == IBM_PC)
-    case KIOCSMAP:	/* load keymap (Minix extension) */
-        size = sizeof(keymap_t);
-        break;
-
-    case TIOCSFON:	/* load font (Minix extension) */
-        size = sizeof(u8_t [8192]);
-        break;
-
-#endif
-    case TCDRAIN:	/* Posix tcdrain function -- no parameter */
-    default:		size = 0;
-  }
-
-  r = OK;
-  switch (m_ptr->TTY_REQUEST) {
-    case TCGETS:
-	/* Get the termios attributes. */
-	r = sys_vircopy(SELF, D, (vir_bytes) &tp->tty_termios,
-		m_ptr->IO_ENDPT, D, (vir_bytes) m_ptr->ADDRESS, 
-		(vir_bytes) size);
-	break;
-
-    case TCSETSW:
-    case TCSETSF:
-    case TCDRAIN:
-	if (tp->tty_outleft > 0) {
-		/* Wait for all ongoing output processing to finish. */
-		tp->tty_iocaller = m_ptr->m_source;
-		tp->tty_ioproc = m_ptr->IO_ENDPT;
-		tp->tty_ioreq = m_ptr->REQUEST;
-		tp->tty_iovir = (vir_bytes) m_ptr->ADDRESS;
-		r = SUSPEND;
-		break;
-	}
-	if (m_ptr->TTY_REQUEST == TCDRAIN) break;
-	if (m_ptr->TTY_REQUEST == TCSETSF) tty_icancel(tp);
-	/*FALL THROUGH*/
-    case TCSETS:
-	/* Set the termios attributes. */
-	r = sys_vircopy( m_ptr->IO_ENDPT, D, (vir_bytes) m_ptr->ADDRESS,
-		SELF, D, (vir_bytes) &tp->tty_termios, (vir_bytes) size);
-	if (r != OK) break;
-	setattr(tp);
-	break;
-
-    case TCFLSH:
-	r = sys_vircopy( m_ptr->IO_ENDPT, D, (vir_bytes) m_ptr->ADDRESS,
-		SELF, D, (vir_bytes) &param.i, (vir_bytes) size);
-	if (r != OK) break;
-	switch (param.i) {
-	    case TCIFLUSH:	tty_icancel(tp);		 	    break;
-	    case TCOFLUSH:	(*tp->tty_ocancel)(tp, 0);		    break;
-	    case TCIOFLUSH:	tty_icancel(tp); (*tp->tty_ocancel)(tp, 0); break;
-	    default:		r = EINVAL;
-	}
-	break;
-
-    case TCFLOW:
-	r = sys_vircopy( m_ptr->IO_ENDPT, D, (vir_bytes) m_ptr->ADDRESS,
-		SELF, D, (vir_bytes) &param.i, (vir_bytes) size);
-	if (r != OK) break;
-	switch (param.i) {
-	    case TCOOFF:
-	    case TCOON:
-		tp->tty_inhibited = (param.i == TCOOFF);
-		tp->tty_events = 1;
-		break;
-	    case TCIOFF:
-		(*tp->tty_echo)(tp, tp->tty_termios.c_cc[VSTOP]);
-		break;
-	    case TCION:
-		(*tp->tty_echo)(tp, tp->tty_termios.c_cc[VSTART]);
-		break;
-	    default:
-		r = EINVAL;
-	}
-	break;
-
-    case TCSBRK:
-	if (tp->tty_break != NULL) (*tp->tty_break)(tp,0);
-	break;
-
-    case TIOCGWINSZ:
-	r = sys_vircopy(SELF, D, (vir_bytes) &tp->tty_winsize,
-		m_ptr->IO_ENDPT, D, (vir_bytes) m_ptr->ADDRESS, 
-		(vir_bytes) size);
-	break;
-
-    case TIOCSWINSZ:
-	r = sys_vircopy( m_ptr->IO_ENDPT, D, (vir_bytes) m_ptr->ADDRESS,
-		SELF, D, (vir_bytes) &tp->tty_winsize, (vir_bytes) size);
-	sigchar(tp, SIGWINCH);
-	break;
-
-#if ENABLE_SRCCOMPAT
-    case TIOCGETP:
-	compat_getp(tp, &param.sg);
-	r = sys_vircopy(SELF, D, (vir_bytes) &param.sg,
-		m_ptr->IO_ENDPT, D, (vir_bytes) m_ptr->ADDRESS,
-		(vir_bytes) size);
-	break;
-
-    case TIOCSETP:
-	r = sys_vircopy( m_ptr->IO_ENDPT, D, (vir_bytes) m_ptr->ADDRESS,
-		SELF, D, (vir_bytes) &param.sg, (vir_bytes) size);
-	if (r != OK) break;
-	compat_setp(tp, &param.sg);
-	break;
-
-    case TIOCGETC:
-	compat_getc(tp, &param.tc);
-	r = sys_vircopy(SELF, D, (vir_bytes) &param.tc,
-		m_ptr->IO_ENDPT, D, (vir_bytes) m_ptr->ADDRESS, 
-		(vir_bytes) size);
-	break;
-
-    case TIOCSETC:
-	r = sys_vircopy( m_ptr->IO_ENDPT, D, (vir_bytes) m_ptr->ADDRESS,
-		SELF, D, (vir_bytes) &param.tc, (vir_bytes) size);
-	if (r != OK) break;
-	compat_setc(tp, &param.tc);
-	break;
-#endif
-
-#if (MACHINE == IBM_PC)
-    case KIOCSMAP:
-	/* Load a new keymap (only /dev/console). */
-	if (isconsole(tp)) r = kbd_loadmap(m_ptr);
-	break;
-
-    case TIOCSFON:
-	/* Load a font into an EGA or VGA card (hs@hck.hr) */
-	if (isconsole(tp)) r = con_loadfont(m_ptr);
-	break;
-#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 
- * not defined.
- */
-    case TIOCGPGRP:     
-    case TIOCSPGRP:	
-    default:
-#if ENABLE_BINCOMPAT
-	do_ioctl_compat(tp, m_ptr);
-	return;
-#else
-	r = ENOTTY;
-#endif
-  }
-
-  /* Send the reply. */
-  tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, r);
-}
-
-/*===========================================================================*
- *				do_open					     *
- *===========================================================================*/
-PRIVATE void do_open(tp, m_ptr)
-register tty_t *tp;
-message *m_ptr;			/* pointer to message sent to task */
-{
-/* A tty line has been opened.  Make it the callers controlling tty if
- * O_NOCTTY is *not* set and it is not the log device.  1 is returned if
- * the tty is made the controlling tty, otherwise OK or an error code.
- */
-  int r = OK;
-
-  if (m_ptr->TTY_LINE == LOG_MINOR) {
-	/* The log device is a write-only diagnostics device. */
-	if (m_ptr->COUNT & R_BIT) r = EACCES;
-  } else {
-	if (!(m_ptr->COUNT & O_NOCTTY)) {
-		tp->tty_pgrp = m_ptr->IO_ENDPT;
-		r = 1;
-	}
-	tp->tty_openct++;
-  }
-  tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, r);
-}
-
-/*===========================================================================*
- *				do_close				     *
- *===========================================================================*/
-PRIVATE void do_close(tp, m_ptr)
-register tty_t *tp;
-message *m_ptr;			/* pointer to message sent to task */
-{
-/* A tty line has been closed.  Clean up the line if it is the last close. */
-
-  if (m_ptr->TTY_LINE != LOG_MINOR && --tp->tty_openct == 0) {
-	tp->tty_pgrp = 0;
-	tty_icancel(tp);
-	(*tp->tty_ocancel)(tp, 0);
-	(*tp->tty_close)(tp, 0);
-	tp->tty_termios = termios_defaults;
-	tp->tty_winsize = winsize_defaults;
-	setattr(tp);
-  }
-  tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, OK);
-}
-
-/*===========================================================================*
- *				do_cancel				     *
- *===========================================================================*/
-PRIVATE void do_cancel(tp, m_ptr)
-register tty_t *tp;
-message *m_ptr;			/* pointer to message sent to task */
-{
-/* A signal has been sent to a process that is hanging trying to read or write.
- * The pending read or write must be finished off immediately.
- */
-
-  int proc_nr;
-  int mode;
-
-  /* Check the parameters carefully, to avoid cancelling twice. */
-  proc_nr = m_ptr->IO_ENDPT;
-  mode = m_ptr->COUNT;
-  if ((mode & R_BIT) && tp->tty_inleft != 0 && proc_nr == tp->tty_inproc) {
-	/* Process was reading when killed.  Clean up input. */
-	tty_icancel(tp);
-	tp->tty_inleft = tp->tty_incum = 0;
-  }
-  if ((mode & W_BIT) && tp->tty_outleft != 0 && proc_nr == tp->tty_outproc) {
-	/* Process was writing when killed.  Clean up output. */
-	(*tp->tty_ocancel)(tp, 0);
-	tp->tty_outleft = tp->tty_outcum = 0;
-  }
-  if (tp->tty_ioreq != 0 && proc_nr == tp->tty_ioproc) {
-	/* Process was waiting for output to drain. */
-	tp->tty_ioreq = 0;
-  }
-  tp->tty_events = 1;
-  tty_reply(TASK_REPLY, m_ptr->m_source, proc_nr, EINTR);
-}
-
-PUBLIC int select_try(struct tty *tp, int ops)
-{
-	int ready_ops = 0;
-
-	/* Special case. If line is hung up, no operations will block.
-	 * (and it can be seen as an exceptional condition.)
-	 */
-	if (tp->tty_termios.c_ospeed == B0) {
-		ready_ops |= ops;
-	}
-
-	if (ops & SEL_RD) {
-		/* will i/o not block on read? */
-		if (tp->tty_inleft > 0) {
-			ready_ops |= SEL_RD;	/* EIO - no blocking */
-		} else if (tp->tty_incount > 0) {
-			/* Is a regular read possible? tty_incount
-			 * says there is data. But a read will only succeed
-			 * in canonical mode if a newline has been seen.
-			 */
-			if (!(tp->tty_termios.c_lflag & ICANON) ||
-				tp->tty_eotct > 0) {
-				ready_ops |= SEL_RD;
-			}
-		}
-	}
-
-	if (ops & SEL_WR)  {
-  		if (tp->tty_outleft > 0)  ready_ops |= SEL_WR;
-		else if ((*tp->tty_devwrite)(tp, 1)) ready_ops |= SEL_WR;
-	}
-	return ready_ops;
-}
-
-PUBLIC int select_retry(struct tty *tp)
-{
-  	if (tp->tty_select_ops && select_try(tp, tp->tty_select_ops))
-		notify(tp->tty_select_proc);
-	return OK;
-}
-
-/*===========================================================================*
- *				handle_events				     *
- *===========================================================================*/
-PUBLIC void handle_events(tp)
-tty_t *tp;			/* TTY to check for events. */
-{
-/* Handle any events pending on a TTY.  These events are usually device
- * interrupts.
- *
- * Two kinds of events are prominent:
- *	- a character has been received from the console or an RS232 line.
- *	- an RS232 line has completed a write request (on behalf of a user).
- * The interrupt handler may delay the interrupt message at its discretion
- * to avoid swamping the TTY task.  Messages may be overwritten when the
- * lines are fast or when there are races between different lines, input
- * and output, because MINIX only provides single buffering for interrupt
- * messages (in proc.c).  This is handled by explicitly checking each line
- * for fresh input and completed output on each interrupt.
- */
-  char *buf;
-  unsigned count;
-  int status;
-
-  do {
-	tp->tty_events = 0;
-
-	/* Read input and perform input processing. */
-	(*tp->tty_devread)(tp, 0);
-
-	/* Perform output processing and write output. */
-	(*tp->tty_devwrite)(tp, 0);
-
-	/* Ioctl waiting for some event? */
-	if (tp->tty_ioreq != 0) dev_ioctl(tp);
-  } while (tp->tty_events);
-
-  /* Transfer characters from the input queue to a waiting process. */
-  in_transfer(tp);
-
-  /* Reply if enough bytes are available. */
-  if (tp->tty_incum >= tp->tty_min && tp->tty_inleft > 0) {
-	if (tp->tty_inrepcode == REVIVE) {
-		notify(tp->tty_incaller);
-		tp->tty_inrevived = 1;
-	} else {
-		tty_reply(tp->tty_inrepcode, tp->tty_incaller, 
-			tp->tty_inproc, tp->tty_incum);
-		tp->tty_inleft = tp->tty_incum = 0;
-	}
-  }
-  if (tp->tty_select_ops)
-  {
-  	select_retry(tp);
-  }
-#if NR_PTYS > 0
-  if (ispty(tp))
-  	select_retry_pty(tp);
-#endif
-}
-
-/*===========================================================================*
- *				in_transfer				     *
- *===========================================================================*/
-PRIVATE void in_transfer(tp)
-register tty_t *tp;		/* pointer to terminal to read from */
-{
-/* Transfer bytes from the input queue to a process reading from a terminal. */
-
-  int ch;
-  int count;
-  char buf[64], *bp;
-
-  /* Force read to succeed if the line is hung up, looks like EOF to reader. */
-  if (tp->tty_termios.c_ospeed == B0) tp->tty_min = 0;
-
-  /* Anything to do? */
-  if (tp->tty_inleft == 0 || tp->tty_eotct < tp->tty_min) return;
-
-  bp = buf;
-  while (tp->tty_inleft > 0 && tp->tty_eotct > 0) {
-	ch = *tp->tty_intail;
-
-	if (!(ch & IN_EOF)) {
-		/* One character to be delivered to the user. */
-		*bp = ch & IN_CHAR;
-		tp->tty_inleft--;
-		if (++bp == bufend(buf)) {
-			/* Temp buffer full, copy to user space. */
-			sys_vircopy(SELF, D, (vir_bytes) buf, 
-				tp->tty_inproc, D, tp->tty_in_vir,
-				(vir_bytes) buflen(buf));
-			tp->tty_in_vir += buflen(buf);
-			tp->tty_incum += buflen(buf);
-			bp = buf;
-		}
-	}
-
-	/* Remove the character from the input queue. */
-	if (++tp->tty_intail == bufend(tp->tty_inbuf))
-		tp->tty_intail = tp->tty_inbuf;
-	tp->tty_incount--;
-	if (ch & IN_EOT) {
-		tp->tty_eotct--;
-		/* Don't read past a line break in canonical mode. */
-		if (tp->tty_termios.c_lflag & ICANON) tp->tty_inleft = 0;
-	}
-  }
-
-  if (bp > buf) {
-	/* Leftover characters in the buffer. */
-	count = bp - buf;
-	sys_vircopy(SELF, D, (vir_bytes) buf, 
-		tp->tty_inproc, D, tp->tty_in_vir, (vir_bytes) count);
-	tp->tty_in_vir += count;
-	tp->tty_incum += count;
-  }
-
-  /* Usually reply to the reader, possibly even if incum == 0 (EOF). */
-  if (tp->tty_inleft == 0) {
-	if (tp->tty_inrepcode == REVIVE) {
-		notify(tp->tty_incaller);
-		tp->tty_inrevived = 1;
-	} else {
-		tty_reply(tp->tty_inrepcode, tp->tty_incaller, 
-			tp->tty_inproc, tp->tty_incum);
-		tp->tty_inleft = tp->tty_incum = 0;
-	}
-  }
-}
-
-/*===========================================================================*
- *				in_process				     *
- *===========================================================================*/
-PUBLIC int in_process(tp, buf, count)
-register tty_t *tp;		/* terminal on which character has arrived */
-char *buf;			/* buffer with input characters */
-int count;			/* number of input characters */
-{
-/* Characters have just been typed in.  Process, save, and echo them.  Return
- * the number of characters processed.
- */
-
-  int ch, sig, ct;
-  int timeset = FALSE;
-  static unsigned char csize_mask[] = { 0x1F, 0x3F, 0x7F, 0xFF };
-
-  for (ct = 0; ct < count; ct++) {
-	/* Take one character. */
-	ch = *buf++ & BYTE;
-
-	/* Strip to seven bits? */
-	if (tp->tty_termios.c_iflag & ISTRIP) ch &= 0x7F;
-
-	/* Input extensions? */
-	if (tp->tty_termios.c_lflag & IEXTEN) {
-
-		/* Previous character was a character escape? */
-		if (tp->tty_escaped) {
-			tp->tty_escaped = NOT_ESCAPED;
-			ch |= IN_ESC;	/* protect character */
-		}
-
-		/* LNEXT (^V) to escape the next character? */
-		if (ch == tp->tty_termios.c_cc[VLNEXT]) {
-			tp->tty_escaped = ESCAPED;
-			rawecho(tp, '^');
-			rawecho(tp, '\b');
-			continue;	/* do not store the escape */
-		}
-
-		/* REPRINT (^R) to reprint echoed characters? */
-		if (ch == tp->tty_termios.c_cc[VREPRINT]) {
-			reprint(tp);
-			continue;
-		}
-	}
-
-	/* _POSIX_VDISABLE is a normal character value, so better escape it. */
-	if (ch == _POSIX_VDISABLE) ch |= IN_ESC;
-
-	/* Map CR to LF, ignore CR, or map LF to CR. */
-	if (ch == '\r') {
-		if (tp->tty_termios.c_iflag & IGNCR) continue;
-		if (tp->tty_termios.c_iflag & ICRNL) ch = '\n';
-	} else
-	if (ch == '\n') {
-		if (tp->tty_termios.c_iflag & INLCR) ch = '\r';
-	}
-
-	/* Canonical mode? */
-	if (tp->tty_termios.c_lflag & ICANON) {
-
-		/* Erase processing (rub out of last character). */
-		if (ch == tp->tty_termios.c_cc[VERASE]) {
-			(void) back_over(tp);
-			if (!(tp->tty_termios.c_lflag & ECHOE)) {
-				(void) tty_echo(tp, ch);
-			}
-			continue;
-		}
-
-		/* Kill processing (remove current line). */
-		if (ch == tp->tty_termios.c_cc[VKILL]) {
-			while (back_over(tp)) {}
-			if (!(tp->tty_termios.c_lflag & ECHOE)) {
-				(void) tty_echo(tp, ch);
-				if (tp->tty_termios.c_lflag & ECHOK)
-					rawecho(tp, '\n');
-			}
-			continue;
-		}
-
-		/* EOF (^D) means end-of-file, an invisible "line break". */
-		if (ch == tp->tty_termios.c_cc[VEOF]) ch |= IN_EOT | IN_EOF;
-
-		/* The line may be returned to the user after an LF. */
-		if (ch == '\n') ch |= IN_EOT;
-
-		/* Same thing with EOL, whatever it may be. */
-		if (ch == tp->tty_termios.c_cc[VEOL]) ch |= IN_EOT;
-	}
-
-	/* Start/stop input control? */
-	if (tp->tty_termios.c_iflag & IXON) {
-
-		/* Output stops on STOP (^S). */
-		if (ch == tp->tty_termios.c_cc[VSTOP]) {
-			tp->tty_inhibited = STOPPED;
-			tp->tty_events = 1;
-			continue;
-		}
-
-		/* Output restarts on START (^Q) or any character if IXANY. */
-		if (tp->tty_inhibited) {
-			if (ch == tp->tty_termios.c_cc[VSTART]
-					|| (tp->tty_termios.c_iflag & IXANY)) {
-				tp->tty_inhibited = RUNNING;
-				tp->tty_events = 1;
-				if (ch == tp->tty_termios.c_cc[VSTART])
-					continue;
-			}
-		}
-	}
-
-	if (tp->tty_termios.c_lflag & ISIG) {
-		/* Check for INTR (^?) and QUIT (^\) characters. */
-		if (ch == tp->tty_termios.c_cc[VINTR]
-					|| ch == tp->tty_termios.c_cc[VQUIT]) {
-			sig = SIGINT;
-			if (ch == tp->tty_termios.c_cc[VQUIT]) sig = SIGQUIT;
-			sigchar(tp, sig);
-			(void) tty_echo(tp, ch);
-			continue;
-		}
-	}
-
-	/* Is there space in the input buffer? */
-	if (tp->tty_incount == buflen(tp->tty_inbuf)) {
-		/* No space; discard in canonical mode, keep in raw mode. */
-		if (tp->tty_termios.c_lflag & ICANON) continue;
-		break;
-	}
-
-	if (!(tp->tty_termios.c_lflag & ICANON)) {
-		/* In raw mode all characters are "line breaks". */
-		ch |= IN_EOT;
-
-		/* Start an inter-byte timer? */
-		if (!timeset && tp->tty_termios.c_cc[VMIN] > 0
-				&& tp->tty_termios.c_cc[VTIME] > 0) {
-			settimer(tp, TRUE);
-			timeset = TRUE;
-		}
-	}
-
-	/* Perform the intricate function of echoing. */
-	if (tp->tty_termios.c_lflag & (ECHO|ECHONL)) ch = tty_echo(tp, ch);
-
-	/* Save the character in the input queue. */
-	*tp->tty_inhead++ = ch;
-	if (tp->tty_inhead == bufend(tp->tty_inbuf))
-		tp->tty_inhead = tp->tty_inbuf;
-	tp->tty_incount++;
-	if (ch & IN_EOT) tp->tty_eotct++;
-
-	/* Try to finish input if the queue threatens to overflow. */
-	if (tp->tty_incount == buflen(tp->tty_inbuf)) in_transfer(tp);
-  }
-  return ct;
-}
-
-/*===========================================================================*
- *				echo					     *
- *===========================================================================*/
-PRIVATE int tty_echo(tp, ch)
-register tty_t *tp;		/* terminal on which to echo */
-register int ch;		/* pointer to character to echo */
-{
-/* Echo the character if echoing is on.  Some control characters are echoed
- * with their normal effect, other control characters are echoed as "^X",
- * normal characters are echoed normally.  EOF (^D) is echoed, but immediately
- * backspaced over.  Return the character with the echoed length added to its
- * attributes.
- */
-  int len, rp;
-
-  ch &= ~IN_LEN;
-  if (!(tp->tty_termios.c_lflag & ECHO)) {
-	if (ch == ('\n' | IN_EOT) && (tp->tty_termios.c_lflag
-					& (ICANON|ECHONL)) == (ICANON|ECHONL))
-		(*tp->tty_echo)(tp, '\n');
-	return(ch);
-  }
-
-  /* "Reprint" tells if the echo output has been messed up by other output. */
-  rp = tp->tty_incount == 0 ? FALSE : tp->tty_reprint;
-
-  if ((ch & IN_CHAR) < ' ') {
-	switch (ch & (IN_ESC|IN_EOF|IN_EOT|IN_CHAR)) {
-	    case '\t':
-		len = 0;
-		do {
-			(*tp->tty_echo)(tp, ' ');
-			len++;
-		} while (len < TAB_SIZE && (tp->tty_position & TAB_MASK) != 0);
-		break;
-	    case '\r' | IN_EOT:
-	    case '\n' | IN_EOT:
-		(*tp->tty_echo)(tp, ch & IN_CHAR);
-		len = 0;
-		break;
-	    default:
-		(*tp->tty_echo)(tp, '^');
-		(*tp->tty_echo)(tp, '@' + (ch & IN_CHAR));
-		len = 2;
-	}
-  } else
-  if ((ch & IN_CHAR) == '\177') {
-	/* A DEL prints as "^?". */
-	(*tp->tty_echo)(tp, '^');
-	(*tp->tty_echo)(tp, '?');
-	len = 2;
-  } else {
-	(*tp->tty_echo)(tp, ch & IN_CHAR);
-	len = 1;
-  }
-  if (ch & IN_EOF) while (len > 0) { (*tp->tty_echo)(tp, '\b'); len--; }
-
-  tp->tty_reprint = rp;
-  return(ch | (len << IN_LSHIFT));
-}
-
-/*===========================================================================*
- *				rawecho					     *
- *===========================================================================*/
-PRIVATE void rawecho(tp, ch)
-register tty_t *tp;
-int ch;
-{
-/* Echo without interpretation if ECHO is set. */
-  int rp = tp->tty_reprint;
-  if (tp->tty_termios.c_lflag & ECHO) (*tp->tty_echo)(tp, ch);
-  tp->tty_reprint = rp;
-}
-
-/*===========================================================================*
- *				back_over				     *
- *===========================================================================*/
-PRIVATE int back_over(tp)
-register tty_t *tp;
-{
-/* Backspace to previous character on screen and erase it. */
-  u16_t *head;
-  int len;
-
-  if (tp->tty_incount == 0) return(0);	/* queue empty */
-  head = tp->tty_inhead;
-  if (head == tp->tty_inbuf) head = bufend(tp->tty_inbuf);
-  if (*--head & IN_EOT) return(0);		/* can't erase "line breaks" */
-  if (tp->tty_reprint) reprint(tp);		/* reprint if messed up */
-  tp->tty_inhead = head;
-  tp->tty_incount--;
-  if (tp->tty_termios.c_lflag & ECHOE) {
-	len = (*head & IN_LEN) >> IN_LSHIFT;
-	while (len > 0) {
-		rawecho(tp, '\b');
-		rawecho(tp, ' ');
-		rawecho(tp, '\b');
-		len--;
-	}
-  }
-  return(1);				/* one character erased */
-}
-
-/*===========================================================================*
- *				reprint					     *
- *===========================================================================*/
-PRIVATE void reprint(tp)
-register tty_t *tp;		/* pointer to tty struct */
-{
-/* Restore what has been echoed to screen before if the user input has been
- * messed up by output, or if REPRINT (^R) is typed.
- */
-  int count;
-  u16_t *head;
-
-  tp->tty_reprint = FALSE;
-
-  /* Find the last line break in the input. */
-  head = tp->tty_inhead;
-  count = tp->tty_incount;
-  while (count > 0) {
-	if (head == tp->tty_inbuf) head = bufend(tp->tty_inbuf);
-	if (head[-1] & IN_EOT) break;
-	head--;
-	count--;
-  }
-  if (count == tp->tty_incount) return;		/* no reason to reprint */
-
-  /* Show REPRINT (^R) and move to a new line. */
-  (void) tty_echo(tp, tp->tty_termios.c_cc[VREPRINT] | IN_ESC);
-  rawecho(tp, '\r');
-  rawecho(tp, '\n');
-
-  /* Reprint from the last break onwards. */
-  do {
-	if (head == bufend(tp->tty_inbuf)) head = tp->tty_inbuf;
-	*head = tty_echo(tp, *head);
-	head++;
-	count++;
-  } while (count < tp->tty_incount);
-}
-
-/*===========================================================================*
- *				out_process				     *
- *===========================================================================*/
-PUBLIC void out_process(tp, bstart, bpos, bend, icount, ocount)
-tty_t *tp;
-char *bstart, *bpos, *bend;	/* start/pos/end of circular buffer */
-int *icount;			/* # input chars / input chars used */
-int *ocount;			/* max output chars / output chars used */
-{
-/* Perform output processing on a circular buffer.  *icount is the number of
- * bytes to process, and the number of bytes actually processed on return.
- * *ocount is the space available on input and the space used on output.
- * (Naturally *icount < *ocount.)  The column position is updated modulo
- * the TAB size, because we really only need it for tabs.
- */
-
-  int tablen;
-  int ict = *icount;
-  int oct = *ocount;
-  int pos = tp->tty_position;
-
-  while (ict > 0) {
-	switch (*bpos) {
-	case '\7':
-		break;
-	case '\b':
-		pos--;
-		break;
-	case '\r':
-		pos = 0;
-		break;
-	case '\n':
-		if ((tp->tty_termios.c_oflag & (OPOST|ONLCR))
-							== (OPOST|ONLCR)) {
-			/* Map LF to CR+LF if there is space.  Note that the
-			 * next character in the buffer is overwritten, so
-			 * we stop at this point.
-			 */
-			if (oct >= 2) {
-				*bpos = '\r';
-				if (++bpos == bend) bpos = bstart;
-				*bpos = '\n';
-				pos = 0;
-				ict--;
-				oct -= 2;
-			}
-			goto out_done;	/* no space or buffer got changed */
-		}
-		break;
-	case '\t':
-		/* Best guess for the tab length. */
-		tablen = TAB_SIZE - (pos & TAB_MASK);
-
-		if ((tp->tty_termios.c_oflag & (OPOST|XTABS))
-							== (OPOST|XTABS)) {
-			/* Tabs must be expanded. */
-			if (oct >= tablen) {
-				pos += tablen;
-				ict--;
-				oct -= tablen;
-				do {
-					*bpos = ' ';
-					if (++bpos == bend) bpos = bstart;
-				} while (--tablen != 0);
-			}
-			goto out_done;
-		}
-		/* Tabs are output directly. */
-		pos += tablen;
-		break;
-	default:
-		/* Assume any other character prints as one character. */
-		pos++;
-	}
-	if (++bpos == bend) bpos = bstart;
-	ict--;
-	oct--;
-  }
-out_done:
-  tp->tty_position = pos & TAB_MASK;
-
-  *icount -= ict;	/* [io]ct are the number of chars not used */
-  *ocount -= oct;	/* *[io]count are the number of chars that are used */
-}
-
-/*===========================================================================*
- *				dev_ioctl				     *
- *===========================================================================*/
-PRIVATE void dev_ioctl(tp)
-tty_t *tp;
-{
-/* The ioctl's TCSETSW, TCSETSF and TCDRAIN wait for output to finish to make
- * sure that an attribute change doesn't affect the processing of current
- * output.  Once output finishes the ioctl is executed as in do_ioctl().
- */
-  int result;
-
-  if (tp->tty_outleft > 0) return;		/* output not finished */
-
-  if (tp->tty_ioreq != TCDRAIN) {
-	if (tp->tty_ioreq == TCSETSF) tty_icancel(tp);
-	result = sys_vircopy(tp->tty_ioproc, D, tp->tty_iovir,
-			SELF, D, (vir_bytes) &tp->tty_termios,
-			(vir_bytes) sizeof(tp->tty_termios));
-	setattr(tp);
-  }
-  tp->tty_ioreq = 0;
-  tty_reply(REVIVE, tp->tty_iocaller, tp->tty_ioproc, result);
-}
-
-/*===========================================================================*
- *				setattr					     *
- *===========================================================================*/
-PRIVATE void setattr(tp)
-tty_t *tp;
-{
-/* Apply the new line attributes (raw/canonical, line speed, etc.) */
-  u16_t *inp;
-  int count;
-
-  if (!(tp->tty_termios.c_lflag & ICANON)) {
-	/* Raw mode; put a "line break" on all characters in the input queue.
-	 * It is undefined what happens to the input queue when ICANON is
-	 * switched off, a process should use TCSAFLUSH to flush the queue.
-	 * Keeping the queue to preserve typeahead is the Right Thing, however
-	 * when a process does use TCSANOW to switch to raw mode.
-	 */
-	count = tp->tty_eotct = tp->tty_incount;
-	inp = tp->tty_intail;
-	while (count > 0) {
-		*inp |= IN_EOT;
-		if (++inp == bufend(tp->tty_inbuf)) inp = tp->tty_inbuf;
-		--count;
-	}
-  }
-
-  /* Inspect MIN and TIME. */
-  settimer(tp, FALSE);
-  if (tp->tty_termios.c_lflag & ICANON) {
-	/* No MIN & TIME in canonical mode. */
-	tp->tty_min = 1;
-  } else {
-	/* In raw mode MIN is the number of chars wanted, and TIME how long
-	 * to wait for them.  With interesting exceptions if either is zero.
-	 */
-	tp->tty_min = tp->tty_termios.c_cc[VMIN];
-	if (tp->tty_min == 0 && tp->tty_termios.c_cc[VTIME] > 0)
-		tp->tty_min = 1;
-  }
-
-  if (!(tp->tty_termios.c_iflag & IXON)) {
-	/* No start/stop output control, so don't leave output inhibited. */
-	tp->tty_inhibited = RUNNING;
-	tp->tty_events = 1;
-  }
-
-  /* Setting the output speed to zero hangs up the phone. */
-  if (tp->tty_termios.c_ospeed == B0) sigchar(tp, SIGHUP);
-
-  /* Set new line speed, character size, etc at the device level. */
-  (*tp->tty_ioctl)(tp, 0);
-}
-
-/*===========================================================================*
- *				tty_reply				     *
- *===========================================================================*/
-PUBLIC void tty_reply(code, replyee, proc_nr, status)
-int code;			/* TASK_REPLY or REVIVE */
-int replyee;			/* destination address for the reply */
-int proc_nr;			/* to whom should the reply go? */
-int status;			/* reply code */
-{
-/* Send a reply to a process that wanted to read or write data. */
-  message tty_mess;
-
-  tty_mess.m_type = code;
-  tty_mess.REP_ENDPT = proc_nr;
-  tty_mess.REP_STATUS = status;
-
-  if ((status = send(replyee, &tty_mess)) != OK) {
-	printf("TTY: couldn't reply to %d\n", replyee);
-	panic("TTY","tty_reply failed, status\n", status);
-  }
-}
-
-/*===========================================================================*
- *				sigchar					     *
- *===========================================================================*/
-PUBLIC void sigchar(tp, sig)
-register tty_t *tp;
-int sig;			/* SIGINT, SIGQUIT, SIGKILL or SIGHUP */
-{
-/* Process a SIGINT, SIGQUIT or SIGKILL char from the keyboard or SIGHUP from
- * a tty close, "stty 0", or a real RS-232 hangup.  MM will send the signal to
- * the process group (INT, QUIT), all processes (KILL), or the session leader
- * (HUP).
- */
-  int status;
-
-  if (tp->tty_pgrp != 0) 
-      if (OK != (status = sys_kill(tp->tty_pgrp, sig)))
-        panic("TTY","Error, call to sys_kill failed", status);
-
-  if (!(tp->tty_termios.c_lflag & NOFLSH)) {
-	tp->tty_incount = tp->tty_eotct = 0;	/* kill earlier input */
-	tp->tty_intail = tp->tty_inhead;
-	(*tp->tty_ocancel)(tp, 0);			/* kill all output */
-	tp->tty_inhibited = RUNNING;
-	tp->tty_events = 1;
-  }
-}
-
-/*===========================================================================*
- *				tty_icancel				     *
- *===========================================================================*/
-PRIVATE void tty_icancel(tp)
-register tty_t *tp;
-{
-/* Discard all pending input, tty buffer or device. */
-
-  tp->tty_incount = tp->tty_eotct = 0;
-  tp->tty_intail = tp->tty_inhead;
-  (*tp->tty_icancel)(tp, 0);
-}
-
-/*===========================================================================*
- *				tty_init				     *
- *===========================================================================*/
-PRIVATE void tty_init()
-{
-/* Initialize tty structure and call device initialization routines. */
-
-  register tty_t *tp;
-  int s;
-  struct sigaction sa;
-
-  /* Initialize the terminal lines. */
-  for (tp = FIRST_TTY,s=0; tp < END_TTY; tp++,s++) {
-
-  	tp->tty_index = s;
-
-  	tmr_inittimer(&tp->tty_tmr);
-
-  	tp->tty_intail = tp->tty_inhead = tp->tty_inbuf;
-  	tp->tty_min = 1;
-  	tp->tty_termios = termios_defaults;
-  	tp->tty_icancel = tp->tty_ocancel = tp->tty_ioctl = tp->tty_close =
-								tty_devnop;
-  	if (tp < tty_addr(NR_CONS)) {
-		scr_init(tp);
-
-		/* Initialize the keyboard driver. */
-		kb_init(tp);
-
-  		tp->tty_minor = CONS_MINOR + s;
-  	} else
-  	if (tp < tty_addr(NR_CONS+NR_RS_LINES)) {
-		rs_init(tp);
-  		tp->tty_minor = RS232_MINOR + s-NR_CONS;
-  	} else {
-		pty_init(tp);
-		tp->tty_minor = s - (NR_CONS+NR_RS_LINES) + TTYPX_MINOR;
-  	}
-  }
-
-#if DEAD_CODE
-  /* Install signal handlers. Ask PM to transform signal into message. */
-  sa.sa_handler = SIG_MESS;
-  sigemptyset(&sa.sa_mask);
-  sa.sa_flags = 0;
-  if (sigaction(SIGTERM,&sa,NULL)<0) panic("TTY","sigaction failed", errno);
-  if (sigaction(SIGKMESS,&sa,NULL)<0) panic("TTY","sigaction failed", errno);
-  if (sigaction(SIGKSTOP,&sa,NULL)<0) panic("TTY","sigaction failed", errno);
-#endif
-#if DEBUG
-	printf("end of tty_init\n");
-#endif
-}
-
-/*===========================================================================*
- *				tty_timed_out				     *
- *===========================================================================*/
-PRIVATE void tty_timed_out(timer_t *tp)
-{
-/* This timer has expired. Set the events flag, to force processing. */
-  tty_t *tty_ptr;
-  tty_ptr = &tty_table[tmr_arg(tp)->ta_int];
-  tty_ptr->tty_min = 0;			/* force read to succeed */
-  tty_ptr->tty_events = 1;		
-}
-
-/*===========================================================================*
- *				expire_timers			    	     *
- *===========================================================================*/
-PRIVATE void expire_timers(void)
-{
-/* A synchronous alarm message was received. Check if there are any expired 
- * timers. Possibly set the event flag and reschedule another alarm.  
- */
-  clock_t now;				/* current time */
-  int s;
-
-  /* Get the current time to compare the timers against. */
-  if ((s=getuptime(&now)) != OK)
- 	panic("TTY","Couldn't get uptime from clock.", s);
-
-  /* Scan the queue of timers for expired timers. This dispatch the watchdog
-   * functions of expired timers. Possibly a new alarm call must be scheduled.
-   */
-  tmrs_exptimers(&tty_timers, now, NULL);
-  if (tty_timers == NULL) tty_next_timeout = TMR_NEVER;
-  else {  					  /* set new sync alarm */
-  	tty_next_timeout = tty_timers->tmr_exp_time;
-  	if ((s=sys_setalarm(tty_next_timeout, 1)) != OK)
- 		panic("TTY","Couldn't set synchronous alarm.", s);
-  }
-}
-
-/*===========================================================================*
- *				settimer				     *
- *===========================================================================*/
-PRIVATE void settimer(tty_ptr, enable)
-tty_t *tty_ptr;			/* line to set or unset a timer on */
-int enable;			/* set timer if true, otherwise unset */
-{
-  clock_t now;				/* current time */
-  clock_t exp_time;
-  int s;
-
-  /* Get the current time to calculate the timeout time. */
-  if ((s=getuptime(&now)) != OK)
- 	panic("TTY","Couldn't get uptime from clock.", s);
-  if (enable) {
-  	exp_time = now + tty_ptr->tty_termios.c_cc[VTIME] * (HZ/10);
- 	/* Set a new timer for enabling the TTY events flags. */
- 	tmrs_settimer(&tty_timers, &tty_ptr->tty_tmr, 
- 		exp_time, tty_timed_out, NULL);  
-  } else {
-  	/* Remove the timer from the active and expired lists. */
-  	tmrs_clrtimer(&tty_timers, &tty_ptr->tty_tmr, NULL);
-  }
-  
-  /* Now check if a new alarm must be scheduled. This happens when the front
-   * of the timers queue was disabled or reinserted at another position, or
-   * when a new timer was added to the front.
-   */
-  if (tty_timers == NULL) tty_next_timeout = TMR_NEVER;
-  else if (tty_timers->tmr_exp_time != tty_next_timeout) { 
-  	tty_next_timeout = tty_timers->tmr_exp_time;
-  	if ((s=sys_setalarm(tty_next_timeout, 1)) != OK)
- 		panic("TTY","Couldn't set synchronous alarm.", s);
-  }
-}
-
-/*===========================================================================*
- *				tty_devnop				     *
- *===========================================================================*/
-PUBLIC int tty_devnop(tp, try)
-tty_t *tp;
-int try;
-{
-  /* Some functions need not be implemented at the device level. */
-}
-
-/*===========================================================================*
- *				do_select				     *
- *===========================================================================*/
-PRIVATE void do_select(tp, m_ptr)
-register tty_t *tp;		/* pointer to tty struct */
-register message *m_ptr;	/* pointer to message sent to the task */
-{
-	int ops, ready_ops = 0, watch;
-
-	ops = m_ptr->IO_ENDPT & (SEL_RD|SEL_WR|SEL_ERR);
-	watch = (m_ptr->IO_ENDPT & SEL_NOTIFY) ? 1 : 0;
-
-	ready_ops = select_try(tp, ops);
-
-	if (!ready_ops && ops && watch) {
-		tp->tty_select_ops |= ops;
-		tp->tty_select_proc = m_ptr->m_source;
-	}
-
-        tty_reply(TASK_REPLY, m_ptr->m_source, m_ptr->IO_ENDPT, ready_ops);
-
-        return;
-}
-
-#if ENABLE_SRCCOMPAT || ENABLE_BINCOMPAT
-/*===========================================================================*
- *				compat_getp				     *
- *===========================================================================*/
-PRIVATE int compat_getp(tp, sg)
-tty_t *tp;
-struct sgttyb *sg;
-{
-/* Translate an old TIOCGETP to the termios equivalent. */
-  int flgs;
-
-  sg->sg_erase = tp->tty_termios.c_cc[VERASE];
-  sg->sg_kill = tp->tty_termios.c_cc[VKILL];
-  sg->sg_ospeed = tspd2sgspd(cfgetospeed(&tp->tty_termios));
-  sg->sg_ispeed = tspd2sgspd(cfgetispeed(&tp->tty_termios));
-
-  flgs = 0;
-
-  /* XTABS	- if OPOST and XTABS */
-  if ((tp->tty_termios.c_oflag & (OPOST|XTABS)) == (OPOST|XTABS))
-	flgs |= 0006000;
-
-  /* BITS5..BITS8  - map directly to CS5..CS8 */
-  flgs |= (tp->tty_termios.c_cflag & CSIZE) << (8-2);
-
-  /* EVENP	- if PARENB and not PARODD */
-  if ((tp->tty_termios.c_cflag & (PARENB|PARODD)) == PARENB)
-	flgs |= 0000200;
-
-  /* ODDP	- if PARENB and PARODD */
-  if ((tp->tty_termios.c_cflag & (PARENB|PARODD)) == (PARENB|PARODD))
-	flgs |= 0000100;
-
-  /* RAW	- if not ICANON and not ISIG */
-  if (!(tp->tty_termios.c_lflag & (ICANON|ISIG)))
-	flgs |= 0000040;
-
-  /* CRMOD	- if ICRNL */
-  if (tp->tty_termios.c_iflag & ICRNL)
-	flgs |= 0000020;
-
-  /* ECHO	- if ECHO */
-  if (tp->tty_termios.c_lflag & ECHO)
-	flgs |= 0000010;
-
-  /* CBREAK	- if not ICANON and ISIG */
-  if ((tp->tty_termios.c_lflag & (ICANON|ISIG)) == ISIG)
-	flgs |= 0000002;
-
-  sg->sg_flags = flgs;
-  return(OK);
-}
-
-/*===========================================================================*
- *				compat_getc				     *
- *===========================================================================*/
-PRIVATE int compat_getc(tp, tc)
-tty_t *tp;
-struct tchars *tc;
-{
-/* Translate an old TIOCGETC to the termios equivalent. */
-
-  tc->t_intrc = tp->tty_termios.c_cc[VINTR];
-  tc->t_quitc = tp->tty_termios.c_cc[VQUIT];
-  tc->t_startc = tp->tty_termios.c_cc[VSTART];
-  tc->t_stopc = tp->tty_termios.c_cc[VSTOP];
-  tc->t_brkc = tp->tty_termios.c_cc[VEOL];
-  tc->t_eofc = tp->tty_termios.c_cc[VEOF];
-  return(OK);
-}
-
-/*===========================================================================*
- *				compat_setp				     *
- *===========================================================================*/
-PRIVATE int compat_setp(tp, sg)
-tty_t *tp;
-struct sgttyb *sg;
-{
-/* Translate an old TIOCSETP to the termios equivalent. */
-  struct termios termios;
-  int flags;
-
-  termios = tp->tty_termios;
-
-  termios.c_cc[VERASE] = sg->sg_erase;
-  termios.c_cc[VKILL] = sg->sg_kill;
-  cfsetispeed(&termios, sgspd2tspd(sg->sg_ispeed & BYTE));
-  cfsetospeed(&termios, sgspd2tspd(sg->sg_ospeed & BYTE));
-  flags = sg->sg_flags;
-
-  /* Input flags */
-
-  /* BRKINT	- not changed */
-  /* ICRNL	- set if CRMOD is set and not RAW */
-  /*		  (CRMOD also controls output) */
-  termios.c_iflag &= ~ICRNL;
-  if ((flags & 0000020) && !(flags & 0000040))
-	termios.c_iflag |= ICRNL;
-
-  /* IGNBRK	- not changed */
-  /* IGNCR	- forced off (ignoring cr's is not supported) */
-  termios.c_iflag &= ~IGNCR;
-
-  /* IGNPAR	- not changed */
-  /* INLCR	- forced off (mapping nl's to cr's is not supported) */
-  termios.c_iflag &= ~INLCR;
-
-  /* INPCK	- not changed */
-  /* ISTRIP	- not changed */
-  /* IXOFF	- not changed */
-  /* IXON	- forced on if not RAW */
-  termios.c_iflag &= ~IXON;
-  if (!(flags & 0000040))
-	termios.c_iflag |= IXON;
-
-  /* PARMRK	- not changed */
-
-  /* Output flags */
-
-  /* OPOST	- forced on if not RAW */
-  termios.c_oflag &= ~OPOST;
-  if (!(flags & 0000040))
-	termios.c_oflag |= OPOST;
-
-  /* ONLCR	- forced on if CRMOD */
-  termios.c_oflag &= ~ONLCR;
-  if (flags & 0000020)
-	termios.c_oflag |= ONLCR;
-
-  /* XTABS	- forced on if XTABS */
-  termios.c_oflag &= ~XTABS;
-  if (flags & 0006000)
-	termios.c_oflag |= XTABS;
-
-  /* CLOCAL	- not changed */
-  /* CREAD	- forced on (receiver is always enabled) */
-  termios.c_cflag |= CREAD;
-
-  /* CSIZE	- CS5-CS8 correspond directly to BITS5-BITS8 */
-  termios.c_cflag = (termios.c_cflag & ~CSIZE) | ((flags & 0001400) >> (8-2));
-
-  /* CSTOPB	- not changed */
-  /* HUPCL	- not changed */
-  /* PARENB	- set if EVENP or ODDP is set */
-  termios.c_cflag &= ~PARENB;
-  if (flags & (0000200|0000100))
-	termios.c_cflag |= PARENB;
-
-  /* PARODD	- set if ODDP is set */
-  termios.c_cflag &= ~PARODD;
-  if (flags & 0000100)
-	termios.c_cflag |= PARODD;
-
-  /* Local flags */
-
-  /* ECHO		- set if ECHO is set */
-  termios.c_lflag &= ~ECHO;
-  if (flags & 0000010)
-	termios.c_lflag |= ECHO;
-
-  /* ECHOE	- not changed */
-  /* ECHOK	- not changed */
-  /* ECHONL	- not changed */
-  /* ICANON	- set if neither CBREAK nor RAW */
-  termios.c_lflag &= ~ICANON;
-  if (!(flags & (0000002|0000040)))
-	termios.c_lflag |= ICANON;
-
-  /* IEXTEN	- set if not RAW */
-  /* ISIG	- set if not RAW */
-  termios.c_lflag &= ~(IEXTEN|ISIG);
-  if (!(flags & 0000040))
-	termios.c_lflag |= (IEXTEN|ISIG);
-
-  /* NOFLSH	- not changed */
-  /* TOSTOP	- not changed */
-
-  tp->tty_termios = termios;
-  setattr(tp);
-  return(OK);
-}
-
-/*===========================================================================*
- *				compat_setc				     *
- *===========================================================================*/
-PRIVATE int compat_setc(tp, tc)
-tty_t *tp;
-struct tchars *tc;
-{
-/* Translate an old TIOCSETC to the termios equivalent. */
-  struct termios termios;
-
-  termios = tp->tty_termios;
-
-  termios.c_cc[VINTR] = tc->t_intrc;
-  termios.c_cc[VQUIT] = tc->t_quitc;
-  termios.c_cc[VSTART] = tc->t_startc;
-  termios.c_cc[VSTOP] = tc->t_stopc;
-  termios.c_cc[VEOL] = tc->t_brkc;
-  termios.c_cc[VEOF] = tc->t_eofc;
-
-  tp->tty_termios = termios;
-  setattr(tp);
-  return(OK);
-}
-
-/* Table of termios line speed to sgtty line speed translations.   All termios
- * speeds are present even if sgtty didn't know about them.  (Now it does.)
- */
-PRIVATE struct s2s {
-  speed_t	tspd;
-  u8_t		sgspd;
-} ts2sgs[] = {
-  { B0,		  0 },
-  { B50,	 50 },
-  { B75,	 75 },
-  { B110,	  1 },
-  { B134,	134 },
-  { B200,	  2 },
-  { B300,	  3 },
-  { B600,	  6 },
-  { B1200,	 12 },
-  { B1800,	 18 },
-  { B2400,	 24 },
-  { B4800,	 48 },
-  { B9600,	 96 },
-  { B19200,	192 },
-  { B38400,	195 },
-  { B57600,	194 },
-  { B115200,	193 },
-};
-
-/*===========================================================================*
- *				tspd2sgspd				     *
- *===========================================================================*/
-PRIVATE int tspd2sgspd(tspd)
-speed_t tspd;
-{
-/* Translate a termios speed to sgtty speed. */
-  struct s2s *s;
-
-  for (s = ts2sgs; s < ts2sgs + sizeof(ts2sgs)/sizeof(ts2sgs[0]); s++) {
-	if (s->tspd == tspd) return(s->sgspd);
-  }
-  return 96;
-}
-
-/*===========================================================================*
- *				sgspd2tspd				     *
- *===========================================================================*/
-PRIVATE speed_t sgspd2tspd(sgspd)
-int sgspd;
-{
-/* Translate a sgtty speed to termios speed. */
-  struct s2s *s;
-
-  for (s = ts2sgs; s < ts2sgs + sizeof(ts2sgs)/sizeof(ts2sgs[0]); s++) {
-	if (s->sgspd == sgspd) return(s->tspd);
-  }
-  return B9600;
-}
-
-#if ENABLE_BINCOMPAT
-/*===========================================================================*
- *				do_ioctl_compat				     *
- *===========================================================================*/
-PRIVATE void do_ioctl_compat(tp, m_ptr)
-tty_t *tp;
-message *m_ptr;
-{
-/* Handle the old sgtty ioctl's that packed the sgtty or tchars struct into
- * the Minix message.  Efficient then, troublesome now.
- */
-  int minor, proc, func, result, r;
-  long flags, erki, spek;
-  u8_t erase, kill, intr, quit, xon, xoff, brk, eof, ispeed, ospeed;
-  struct sgttyb sg;
-  struct tchars tc;
-  message reply_mess;
-
-  minor = m_ptr->TTY_LINE;
-  proc = m_ptr->IO_ENDPT;
-  func = m_ptr->REQUEST;
-  spek = m_ptr->m2_l1;
-  flags = m_ptr->m2_l2;
-
-  switch(func)
-  {
-    case (('t'<<8) | 8):	/* TIOCGETP */
-	r = compat_getp(tp, &sg);
-	erase = sg.sg_erase;
-	kill = sg.sg_kill;
-	ispeed = sg.sg_ispeed;
-	ospeed = sg.sg_ospeed;
-	flags = sg.sg_flags;
-	erki = ((long)ospeed<<24) | ((long)ispeed<<16) | ((long)erase<<8) |kill;
-	break;
-    case (('t'<<8) | 18):	/* TIOCGETC */
-	r = compat_getc(tp, &tc);
-	intr = tc.t_intrc;
-	quit = tc.t_quitc;
-	xon = tc.t_startc;
-	xoff = tc.t_stopc;
-	brk = tc.t_brkc;
-	eof = tc.t_eofc;
-	erki = ((long)intr<<24) | ((long)quit<<16) | ((long)xon<<8) | xoff;
-	flags = (eof << 8) | brk;
-	break;
-    case (('t'<<8) | 17):	/* TIOCSETC */
-	tc.t_stopc = (spek >> 0) & 0xFF;
-	tc.t_startc = (spek >> 8) & 0xFF;
-	tc.t_quitc = (spek >> 16) & 0xFF;
-	tc.t_intrc = (spek >> 24) & 0xFF;
-	tc.t_brkc = (flags >> 0) & 0xFF;
-	tc.t_eofc = (flags >> 8) & 0xFF;
-	r = compat_setc(tp, &tc);
-	break;
-    case (('t'<<8) | 9):	/* TIOCSETP */
-	sg.sg_erase = (spek >> 8) & 0xFF;
-	sg.sg_kill = (spek >> 0) & 0xFF;
-	sg.sg_ispeed = (spek >> 16) & 0xFF;
-	sg.sg_ospeed = (spek >> 24) & 0xFF;
-	sg.sg_flags = flags;
-	r = compat_setp(tp, &sg);
-	break;
-    default:
-	r = ENOTTY;
-  }
-  reply_mess.m_type = TASK_REPLY;
-  reply_mess.REP_ENDPT = m_ptr->IO_ENDPT;
-  reply_mess.REP_STATUS = r;
-  reply_mess.m2_l1 = erki;
-  reply_mess.m2_l2 = flags;
-  send(m_ptr->m_source, &reply_mess);
-}
-#endif /* ENABLE_BINCOMPAT */
-#endif /* ENABLE_SRCCOMPAT || ENABLE_BINCOMPAT */
-
Index: trunk/minix/drivers/tty/tty.h
===================================================================
--- trunk/minix/drivers/tty/tty.h	(revision 9)
+++ 	(revision )
@@ -1,195 +1,0 @@
-/*	tty.h - Terminals	*/
-
-#include <timers.h>
-#include "../../kernel/const.h"
-#include "../../kernel/type.h"
-
-#undef lock
-#undef unlock
-
-/* First minor numbers for the various classes of TTY devices. */
-#define CONS_MINOR	   0
-#define LOG_MINOR	  15
-#define RS232_MINOR	  16
-#define KBD_MINOR	 127
-#define KBDAUX_MINOR	 126
-#define VIDEO_MINOR	 125
-#define TTYPX_MINOR	 128
-#define PTYPX_MINOR	 192
-
-#define LINEWRAP	   1	/* console.c - wrap lines at column 80 */
-
-#define TTY_IN_BYTES     256	/* tty input queue size */
-#define TAB_SIZE           8	/* distance between tab stops */
-#define TAB_MASK           7	/* mask to compute a tab stop position */
-
-#define ESC             '\33'	/* escape */
-
-#define O_NOCTTY       00400	/* from <fcntl.h>, or cc will choke */
-#define O_NONBLOCK     04000
-
-struct tty;
-typedef _PROTOTYPE( int (*devfun_t), (struct tty *tp, int try_only) );
-typedef _PROTOTYPE( void (*devfunarg_t), (struct tty *tp, int c) );
-
-typedef struct tty {
-  int tty_events;		/* set when TTY should inspect this line */
-  int tty_index;		/* index into TTY table */
-  int tty_minor;		/* device minor number */
-
-  /* Input queue.  Typed characters are stored here until read by a program. */
-  u16_t *tty_inhead;		/* pointer to place where next char goes */
-  u16_t *tty_intail;		/* pointer to next char to be given to prog */
-  int tty_incount;		/* # chars in the input queue */
-  int tty_eotct;		/* number of "line breaks" in input queue */
-  devfun_t tty_devread;		/* routine to read from low level buffers */
-  devfun_t tty_icancel;		/* cancel any device input */
-  int tty_min;			/* minimum requested #chars in input queue */
-  timer_t tty_tmr;		/* the timer for this tty */
-
-  /* Output section. */
-  devfun_t tty_devwrite;	/* routine to start actual device output */
-  devfunarg_t tty_echo;		/* routine to echo characters input */
-  devfun_t tty_ocancel;		/* cancel any ongoing device output */
-  devfun_t tty_break;		/* let the device send a break */
-
-  /* Terminal parameters and status. */
-  int tty_position;		/* current position on the screen for echoing */
-  char tty_reprint;		/* 1 when echoed input messed up, else 0 */
-  char tty_escaped;		/* 1 when LNEXT (^V) just seen, else 0 */
-  char tty_inhibited;		/* 1 when STOP (^S) just seen (stops output) */
-  int tty_pgrp;			/* slot number of controlling process */
-  char tty_openct;		/* count of number of opens of this tty */
-
-  /* Information about incomplete I/O requests is stored here. */
-  char tty_inrepcode;		/* reply code, TASK_REPLY or REVIVE */
-  char tty_inrevived;		/* set to 1 if revive callback is pending */
-  int tty_incaller;		/* process that made the call (usually FS) */
-  int tty_inproc;		/* process that wants to read from tty */
-  vir_bytes tty_in_vir;		/* virtual address where data is to go */
-  int tty_inleft;		/* how many chars are still needed */
-  int tty_incum;		/* # chars input so far */
-  int tty_outrepcode;		/* reply code, TASK_REPLY or REVIVE */
-  int tty_outrevived;		/* set to 1 if revive callback is pending */
-  int tty_outcaller;		/* process that made the call (usually FS) */
-  int tty_outproc;		/* process that wants to write to tty */
-  vir_bytes tty_out_vir;	/* virtual address where data comes from */
-  int tty_outleft;		/* # chars yet to be output */
-  int tty_outcum;		/* # chars output so far */
-  int tty_iocaller;		/* process that made the call (usually FS) */
-  int tty_ioproc;		/* process that wants to do an ioctl */
-  int tty_ioreq;		/* ioctl request code */
-  vir_bytes tty_iovir;		/* virtual address of ioctl buffer */
-
-  /* select() data */
-  int tty_select_ops;		/* which operations are interesting */
-  int tty_select_proc;		/* which process wants notification */
-
-  /* Miscellaneous. */
-  devfun_t tty_ioctl;		/* set line speed, etc. at the device level */
-  devfun_t tty_close;		/* tell the device that the tty is closed */
-  void *tty_priv;		/* pointer to per device private data */
-  struct termios tty_termios;	/* terminal attributes */
-  struct winsize tty_winsize;	/* window size (#lines and #columns) */
-
-  u16_t tty_inbuf[TTY_IN_BYTES];/* tty input buffer */
-
-} tty_t;
-
-/* Memory allocated in tty.c, so extern here. */
-extern tty_t tty_table[NR_CONS+NR_RS_LINES+NR_PTYS];
-extern int ccurrent;		/* currently visible console */
-extern int irq_hook_id;		/* hook id for keyboard irq */
-
-extern unsigned long kbd_irq_set;
-extern unsigned long rs_irq_set;
-
-extern int panicing;	/* From panic.c in sysutil */
-
-/* Values for the fields. */
-#define NOT_ESCAPED        0	/* previous character is not LNEXT (^V) */
-#define ESCAPED            1	/* previous character was LNEXT (^V) */
-#define RUNNING            0	/* no STOP (^S) has been typed to stop output */
-#define STOPPED            1	/* STOP (^S) has been typed to stop output */
-
-/* Fields and flags on characters in the input queue. */
-#define IN_CHAR       0x00FF	/* low 8 bits are the character itself */
-#define IN_LEN        0x0F00	/* length of char if it has been echoed */
-#define IN_LSHIFT          8	/* length = (c & IN_LEN) >> IN_LSHIFT */
-#define IN_EOT        0x1000	/* char is a line break (^D, LF) */
-#define IN_EOF        0x2000	/* char is EOF (^D), do not return to user */
-#define IN_ESC        0x4000	/* escaped by LNEXT (^V), no interpretation */
-
-/* Times and timeouts. */
-#define force_timeout()	((void) (0))
-
-/* Memory allocated in tty.c, so extern here. */
-extern timer_t *tty_timers;		/* queue of TTY timers */
-extern clock_t tty_next_timeout;	/* next TTY timeout */
-
-/* Number of elements and limit of a buffer. */
-#define buflen(buf)	(sizeof(buf) / sizeof((buf)[0]))
-#define bufend(buf)	((buf) + buflen(buf))
-
-/* Memory allocated in tty.c, so extern here. */
-extern struct machine machine;	/* machine information (a.o.: pc_at, ega) */
-
-/* The tty outputs diagnostic messages in a circular buffer. */
-extern struct kmessages kmess;
-
-/* Function prototypes for TTY driver. */
-/* tty.c */
-_PROTOTYPE( void handle_events, (struct tty *tp)			);
-_PROTOTYPE( void sigchar, (struct tty *tp, int sig)			);
-_PROTOTYPE( void tty_task, (void)					);
-_PROTOTYPE( int in_process, (struct tty *tp, char *buf, int count)	);
-_PROTOTYPE( void out_process, (struct tty *tp, char *bstart, char *bpos,
-				char *bend, int *icount, int *ocount)	);
-_PROTOTYPE( void tty_wakeup, (clock_t now)				);
-_PROTOTYPE( void tty_reply, (int code, int replyee, int proc_nr,
-							int status)	);
-_PROTOTYPE( int tty_devnop, (struct tty *tp, int try)			);
-_PROTOTYPE( int select_try, (struct tty *tp, int ops)			);
-_PROTOTYPE( int select_retry, (struct tty *tp)				);
-
-/* rs232.c */
-_PROTOTYPE( void rs_init, (struct tty *tp)				);
-_PROTOTYPE( void rs_interrupt, (message *m)				);
-
-#if (CHIP == INTEL)
-/* console.c */
-_PROTOTYPE( void kputc, (int c)						);
-_PROTOTYPE( void cons_stop, (void)					);
-_PROTOTYPE( void do_new_kmess, (message *m)				);
-_PROTOTYPE( void do_diagnostics, (message *m)				);
-_PROTOTYPE( void do_get_kmess, (message *m)				);
-_PROTOTYPE( void scr_init, (struct tty *tp)				);
-_PROTOTYPE( void toggle_scroll, (void)					);
-_PROTOTYPE( int con_loadfont, (message *m)				);
-_PROTOTYPE( void select_console, (int cons_line)			);
-_PROTOTYPE( void beep_x, ( unsigned freq, clock_t dur)			);
-_PROTOTYPE( void do_video, (message *m)					);
-
-/* keyboard.c */
-_PROTOTYPE( void kb_init, (struct tty *tp)				);
-_PROTOTYPE( void kb_init_once, (void)					);
-_PROTOTYPE( int kbd_loadmap, (message *m)				);
-_PROTOTYPE( void do_panic_dumps, (message *m)				);
-_PROTOTYPE( void do_fkey_ctl, (message *m)				);
-_PROTOTYPE( void kbd_interrupt, (message *m)				);
-_PROTOTYPE( void do_kbd, (message *m)					);
-_PROTOTYPE( void do_kbdaux, (message *m)				);
-_PROTOTYPE( int kbd_status, (message *m_ptr)				);
-
-/* pty.c */
-_PROTOTYPE( void do_pty, (struct tty *tp, message *m_ptr)		);
-_PROTOTYPE( void pty_init, (struct tty *tp)				);
-_PROTOTYPE( void select_retry_pty, (struct tty *tp)			);
-_PROTOTYPE( int pty_status, (message *m_ptr)				);
-
-/* vidcopy.s */
-_PROTOTYPE( void vid_vid_copy, (unsigned src, unsigned dst, unsigned count));
-_PROTOTYPE( void mem_vid_copy, (u16_t *src, unsigned dst, unsigned count));
-
-#endif /* (CHIP == INTEL) */
-
Index: trunk/minix/drivers/tty/vidcopy.s
===================================================================
--- trunk/minix/drivers/tty/vidcopy.s	(revision 9)
+++ 	(revision )
@@ -1,160 +1,0 @@
-# 
-! This file contains two specialized assembly code routines to update the 
-! video memory. The routines can copy from user to video memory, or from
-! video to video memory.   
-
-! sections
-
-.sect .text; .sect .rom; .sect .data; .sect .bss
-
-! exported functions
-
-.define	_mem_vid_copy	! copy data to video ram
-.define	_vid_vid_copy	! move data in video ram
-
-! The routines only guarantee to preserve the registers the C compiler
-! expects to be preserved (ebx, esi, edi, ebp, esp, segment registers, and
-! direction bit in the flags).
-
-.sect .text
-!*===========================================================================*
-!*				mem_vid_copy				     *
-!*===========================================================================*
-! PUBLIC void mem_vid_copy(u16 *src, unsigned dst, unsigned count);
-!
-! Copy count characters from kernel memory to video memory.  Src is an ordinary
-! pointer to a word, but dst and count are character (word) based video offset
-! and count.  If src is null then screen memory is blanked by filling it with
-! blank_color.
-
-_mem_vid_copy:
-	push	ebp
-	mov	ebp, esp
-	push	esi
-	push	edi
-	push	es
-	mov	esi, 8(ebp)		! source
-	mov	edi, 12(ebp)		! destination
-	mov	edx, 16(ebp)		! count
-	mov	es, (_vid_seg)		! segment containing video memory
-	cld				! make sure direction is up
-mvc_loop:
-	and	edi, (_vid_mask)	! wrap address
-	mov	ecx, edx		! one chunk to copy
-	mov	eax, (_vid_size)
-	sub	eax, edi
-	cmp	ecx, eax
-	jbe	0f
-	mov	ecx, eax		! ecx = min(ecx, vid_size - edi)
-0:	sub	edx, ecx		! count -= ecx
-	shl	edi, 1			! byte address
-	add	edi, (_vid_off)		! in video memory
-	test	esi, esi		! source == 0 means blank the screen
-	jz	mvc_blank
-mvc_copy:
-	rep				! copy words to video memory
-    o16	movs
-	jmp	mvc_test
-mvc_blank:
-	mov	eax, (_blank_color)	! ax = blanking character
-	rep
-    o16	stos				! copy blanks to video memory
-	!jmp	mvc_test
-mvc_test:
-	sub	edi, (_vid_off)
-	shr	edi, 1			! back to a word address
-	test	edx, edx
-	jnz	mvc_loop
-mvc_done:
-	pop	es
-	pop	edi
-	pop	esi
-	pop	ebp
-	ret
-
-
-!*===========================================================================*
-!*				vid_vid_copy				     *
-!*===========================================================================*
-! PUBLIC void vid_vid_copy(unsigned src, unsigned dst, unsigned count);
-!
-! Copy count characters from video memory to video memory.  Handle overlap.
-! Used for scrolling, line or character insertion and deletion.  Src, dst
-! and count are character (word) based video offsets and count.
-
-_vid_vid_copy:
-	push	ebp
-	mov	ebp, esp
-	push	esi
-	push	edi
-	push	es
-	mov	esi, 8(ebp)		! source
-	mov	edi, 12(ebp)		! destination
-	mov	edx, 16(ebp)		! count
-	mov	es, (_vid_seg)		! segment containing video memory
-	cmp	esi, edi		! copy up or down?
-	jb	vvc_down
-vvc_up:
-	cld				! direction is up
-vvc_uploop:
-	and	esi, (_vid_mask)	! wrap addresses
-	and	edi, (_vid_mask)
-	mov	ecx, edx		! one chunk to copy
-	mov	eax, (_vid_size)
-	sub	eax, esi
-	cmp	ecx, eax
-	jbe	0f
-	mov	ecx, eax		! ecx = min(ecx, vid_size - esi)
-0:	mov	eax, (_vid_size)
-	sub	eax, edi
-	cmp	ecx, eax
-	jbe	0f
-	mov	ecx, eax		! ecx = min(ecx, vid_size - edi)
-0:	sub	edx, ecx		! count -= ecx
-	call	vvc_copy		! copy video words
-	test	edx, edx
-	jnz	vvc_uploop		! again?
-	jmp	vvc_done
-vvc_down:
-	std				! direction is down
-	lea	esi, -1(esi)(edx*1)	! start copying at the top
-	lea	edi, -1(edi)(edx*1)
-vvc_downloop:
-	and	esi, (_vid_mask)	! wrap addresses
-	and	edi, (_vid_mask)
-	mov	ecx, edx		! one chunk to copy
-	lea	eax, 1(esi)
-	cmp	ecx, eax
-	jbe	0f
-	mov	ecx, eax		! ecx = min(ecx, esi + 1)
-0:	lea	eax, 1(edi)
-	cmp	ecx, eax
-	jbe	0f
-	mov	ecx, eax		! ecx = min(ecx, edi + 1)
-0:	sub	edx, ecx		! count -= ecx
-	call	vvc_copy
-	test	edx, edx
-	jnz	vvc_downloop		! again?
-	cld				! C compiler expects up
-	!jmp	vvc_done
-vvc_done:
-	pop	es
-	pop	edi
-	pop	esi
-	pop	ebp
-	ret
-
-! Copy video words.  (Inner code of both the up and downcopying loop.)
-vvc_copy:
-	shl	esi, 1
-	shl	edi, 1			! byte addresses
-	add	esi, (_vid_off)
-	add	edi, (_vid_off)		! in video memory
-	rep
-eseg o16 movs				! copy video words
-	sub	esi, (_vid_off)
-	sub	edi, (_vid_off)
-	shr	esi, 1
-	shr	edi, 1			! back to word addresses
-	ret
-
