[comp.os.minix] V1.3 posting #28 - revision to kernel directory

ast@cs.vu.nl (Andy Tanenbaum) (07/14/88)

: This is a shar archive.  Extract with sh, not csh.
: This archive ends with exit, so do not worry about trailing junk.
: --------------------------- cut here --------------------------
PATH=/bin:/usr/bin:/usr/ucb
echo Extracting 'LISTING'
sed 's/^X//' > 'LISTING' << '+ END-OF-FILE ''LISTING'
X-rw-r--r--  1 ast          3370 Jul 14 14:21 at_wini.c.cdif
X-rw-r--r--  1 ast          2324 Jul 14 14:21 clock.c.cdif
X-rw-r--r--  1 ast           540 Jul 14 14:21 dmp.c.cdif
X-rw-r--r--  1 ast          4409 Jul 14 14:21 floppy.c.cdif
X-rw-r--r--  1 ast          3587 Jul 14 14:21 klib88.s.cdif
X-rw-r--r--  1 ast          3477 Jul 14 14:21 main.c.cdif
X-rw-r--r--  1 ast          2549 Jul 14 14:21 mpx88.s.cdif
X-rw-r--r--  1 ast          1953 Jul 14 14:21 printer.c.cdif
X-rw-r--r--  1 ast          8615 Jul 14 14:22 proc.c.cdif
X-rw-r--r--  1 ast           543 Jul 14 14:22 table.c.cdif
X-rw-r--r--  1 ast         55255 Jul 14 14:22 tty.c.cdif
X-rw-r--r--  1 ast         16044 Jul 14 14:22 wini.c.new
+ END-OF-FILE LISTING
chmod 'u=rw,g=r,o=r' 'LISTING'
set `wc -c 'LISTING'`
count=$1
case $count in
694)	:;;
*)	echo 'Bad character count in ''LISTING' >&2
		echo 'Count should be 694' >&2
esac
echo Extracting 'at_wini.c.cdif'
sed 's/^X//' > 'at_wini.c.cdif' << '+ END-OF-FILE ''at_wini.c.cdif'
X*** /local/ast/minix/tape3a/kernel/at_wini.c	Sun Jun 26 23:10:37 1988
X--- at_wini.c	Wed Jul 13 16:59:17 1988
X***************
X*** 189,195 ****
X  {
X    extern phys_bytes umap();
X    phys_bytes usr_buf = umap(proc_addr(wn->wn_procnr), D, wn->wn_address, BLOCK_SIZE);
X!   register int i;
X    int r = 0;
X  
X    /* The command is issued by outputing 7 bytes to the controller chip. */
X--- 189,195 ----
X  {
X    extern phys_bytes umap();
X    phys_bytes usr_buf = umap(proc_addr(wn->wn_procnr), D, wn->wn_address, BLOCK_SIZE);
X!   register int i, old_state;
X    int r = 0;
X  
X    /* The command is issued by outputing 7 bytes to the controller chip. */
X***************
X*** 212,220 ****
X    if (wn->wn_opcode == DISK_READ) {
X  	for (i=0; i<BLOCK_SIZE/SECTOR_SIZE; i++) {
X  		receive(HARDWARE, &w_mess);
X! 		lock();
X  		dma_read((unsigned)(usr_buf >> 4), (unsigned)(usr_buf & 0x0F));
X! 		unlock();
X  		usr_buf += 0x200;
X  		if (win_results() != OK) {
X  			w_need_reset = TRUE;
X--- 212,220 ----
X    if (wn->wn_opcode == DISK_READ) {
X  	for (i=0; i<BLOCK_SIZE/SECTOR_SIZE; i++) {
X  		receive(HARDWARE, &w_mess);
X! 		old_state = lock();
X  		dma_read((unsigned)(usr_buf >> 4), (unsigned)(usr_buf & 0x0F));
X! 		restore(old_state);
X  		usr_buf += 0x200;
X  		if (win_results() != OK) {
X  			w_need_reset = TRUE;
X***************
X*** 230,238 ****
X  		return(ERR);
X  	}
X  	for (i=0; i<BLOCK_SIZE/SECTOR_SIZE; i++) {
X! 		lock();
X! 		dma_write((unsigned)(usr_buf >> 4), (unsigned)(usr_buf & 0x0F));
X! 		unlock();
X  		usr_buf += 0x200;
X  		receive(HARDWARE, &w_mess);
X  		if (win_results() != OK) {
X--- 230,238 ----
X  		return(ERR);
X  	}
X  	for (i=0; i<BLOCK_SIZE/SECTOR_SIZE; i++) {
X! 		old_state = lock();
X! 		dma_write((unsigned)(usr_buf >> 4), (unsigned)(usr_buf&0x0F));
X! 		restore(old_state);
X  		usr_buf += 0x200;
X  		receive(HARDWARE, &w_mess);
X  		if (win_results() != OK) {
X***************
X*** 257,271 ****
X   * like the controller refusing to respond.
X   */
X  
X!   int i, r;
X  
X    /* Strobe reset bit low. */
X!   lock();
X    port_out(WIN_REG9, 4);
X    for (i = 0; i < 10; i++)
X  	 ;
X    port_out(WIN_REG9, wini[0].wn_ctlbyte & 0x0F);
X!   unlock();
X    for (i = 0; i < MAX_WIN_RETRY && drive_busy(); i++)
X  	;
X    if (drive_busy()) {
X--- 257,271 ----
X   * like the controller refusing to respond.
X   */
X  
X!   int i, r, old_state;
X  
X    /* Strobe reset bit low. */
X!   old_state = lock();
X    port_out(WIN_REG9, 4);
X    for (i = 0; i < 10; i++)
X  	 ;
X    port_out(WIN_REG9, wini[0].wn_ctlbyte & 0x0F);
X!   restore(old_state);
X    for (i = 0; i < MAX_WIN_RETRY && drive_busy(); i++)
X  	;
X    if (drive_busy()) {
X***************
X*** 385,391 ****
X  {
X  /* Output the command block to the winchester controller and return status */
X  
X! 	register int i;
X  	int r;
X  
X  	if (drive_busy()) {
X--- 385,391 ----
X  {
X  /* Output the command block to the winchester controller and return status */
X  
X! 	register int i, old_state;
X  	int r;
X  
X  	if (drive_busy()) {
X***************
X*** 393,403 ****
X  		return(ERR);
X  	}
X  	r = WIN_REG2;
X! 	lock();
X  	port_out(WIN_REG9, command[0]);
X  	for (i=1; i<8; i++, r++)
X  		port_out(r, command[i]);
X! 	unlock();
X  	return(OK);
X  }
X  
X--- 393,403 ----
X  		return(ERR);
X  	}
X  	r = WIN_REG2;
X! 	old_state = lock();
X  	port_out(WIN_REG9, command[0]);
X  	for (i=1; i<8; i++, r++)
X  		port_out(r, command[i]);
X! 	restore(old_state);
X  	return(OK);
X  }
X  
+ END-OF-FILE at_wini.c.cdif
chmod 'u=rw,g=r,o=r' 'at_wini.c.cdif'
set `wc -c 'at_wini.c.cdif'`
count=$1
case $count in
3370)	:;;
*)	echo 'Bad character count in ''at_wini.c.cdif' >&2
		echo 'Count should be 3370' >&2
esac
echo Extracting 'clock.c.cdif'
sed 's/^X//' > 'clock.c.cdif' << '+ END-OF-FILE ''clock.c.cdif'
X*** /local/ast/minix/tape3a/kernel/clock.c	Fri Jun  3 21:40:38 1988
X--- clock.c	Thu Jul 14 00:00:18 1988
X***************
X*** 53,58 ****
X--- 53,59 ----
X  PRIVATE struct proc *prev_ptr;	/* last user process run by clock task */
X  PRIVATE message mc;		/* message buffer for both input and output */
X  PRIVATE int (*watch_dog[NR_TASKS+1])();	/* watch_dog functions to call */
X+ extern int flush_flag;		/* tells clock when to flush the tty buf */
X  
X  /*===========================================================================*
X   *				clock_task				     *
X***************
X*** 189,194 ****
X--- 190,196 ----
X    }
X  
X    accounting();			/* keep track of who is using the cpu */
X+   if (flush_flag) rs_flush();	/* flush accumulated tty input */
X  
X    /* If a user process has been running too long, pick another one. */
X    if (--sched_ticks == 0) {
X***************
X*** 203,223 ****
X  
X  }
X  
X  /*===========================================================================*
X   *				accounting				     *
X   *===========================================================================*/
X  PRIVATE accounting()
X  {
X! /* Update user and system accounting times.  The variable 'bill_ptr' is always
X!  * kept pointing to the process to charge for CPU usage.  If the CPU was in
X!  * user code prior to this clock tick, charge the tick as user time, otherwise
X!  * charge it as system time.
X   */
X  
X!   if (prev_proc >= LOW_USER)
X! 	bill_ptr->user_time++;	/* charge CPU time */
X!   else
X! 	bill_ptr->sys_time++;	/* charge system time */
X  }
X  
X  
X--- 205,232 ----
X  
X  }
X  
X+ 
X  /*===========================================================================*
X   *				accounting				     *
X   *===========================================================================*/
X  PRIVATE accounting()
X  {
X! /*
X!  * Update user and system accounting times.  Charge the current process for 
X!  * user time or system time.  In addition, if the current proces (i.e.
X!  * prev_proc, because cur_proc is always CLOCK) is a task, charge it too.
X!  * This is just for the F1 display.
X   */
X  
X!   register struct proc *rp;
X! 
X!   if (prev_proc >= LOW_USER) {
X! 	bill_ptr->user_time++;				/* user time */
X!   } else {
X! 	bill_ptr->sys_time++;				/* system time */
X! 	rp = proc_addr(prev_proc);
X! 	if (prev_proc != IDLE) rp->sys_time++;
X!   }
X  }
X  
X  
+ END-OF-FILE clock.c.cdif
chmod 'u=rw,g=r,o=r' 'clock.c.cdif'
set `wc -c 'clock.c.cdif'`
count=$1
case $count in
2324)	:;;
*)	echo 'Bad character count in ''clock.c.cdif' >&2
		echo 'Count should be 2324' >&2
esac
echo Extracting 'dmp.c.cdif'
sed 's/^X//' > 'dmp.c.cdif' << '+ END-OF-FILE ''dmp.c.cdif'
X*** /local/ast/minix/tape3a/kernel/dmp.c	Fri Jun  3 21:40:39 1988
X--- dmp.c	Wed Jul 13 16:59:18 1988
X***************
X*** 32,38 ****
X    extern phys_bytes umap();
X  
X    printf(
X!   "\nproc  -pid- -pc-  -sp-  flag  user  -sys-  base limit recv   command\n");
X  
X    dst = umap(proc_addr(SYSTASK), D, (vir_bytes)nbuff, NSIZE);
X  
X--- 32,38 ----
X    extern phys_bytes umap();
X  
X    printf(
X!  "\nproc  -pid- -pc-  -sp-  flag  user  -sys-  base limit recv   command\r\n");
X  
X    dst = umap(proc_addr(SYSTASK), D, (vir_bytes)nbuff, NSIZE);
X  
+ END-OF-FILE dmp.c.cdif
chmod 'u=rw,g=r,o=r' 'dmp.c.cdif'
set `wc -c 'dmp.c.cdif'`
count=$1
case $count in
540)	:;;
*)	echo 'Bad character count in ''dmp.c.cdif' >&2
		echo 'Count should be 540' >&2
esac
echo Extracting 'floppy.c.cdif'
sed 's/^X//' > 'floppy.c.cdif' << '+ END-OF-FILE ''floppy.c.cdif'
X*** /local/ast/minix/tape3a/kernel/floppy.c	Sun Jun 26 23:10:39 1988
X--- floppy.c	Wed Jul 13 16:59:18 1988
X***************
X*** 283,289 ****
X   * 512-byte block starting at physical address 65520).
X   */
X  
X!   int mode, low_addr, high_addr, top_addr, low_ct, high_ct, top_end;
X    vir_bytes vir, ct;
X    phys_bytes user_phys;
X    extern phys_bytes umap();
X--- 283,289 ----
X   * 512-byte block starting at physical address 65520).
X   */
X  
X!   int mode, low_addr, high_addr, top_addr, low_ct, high_ct, top_end, s;
X    vir_bytes vir, ct;
X    phys_bytes user_phys;
X    extern phys_bytes umap();
X***************
X*** 308,314 ****
X    if (top_end != top_addr) panic("Trying to DMA across 64K boundary", top_addr);
X  
X    /* Now set up the DMA registers. */
X!   lock();
X    port_out(DMA_M2, mode);	/* set the DMA mode */
X    port_out(DMA_M1, mode);	/* set it again */
X    port_out(DMA_ADDR, low_addr);	/* output low-order 8 bits */
X--- 308,314 ----
X    if (top_end != top_addr) panic("Trying to DMA across 64K boundary", top_addr);
X  
X    /* Now set up the DMA registers. */
X!   s = lock();
X    port_out(DMA_M2, mode);	/* set the DMA mode */
X    port_out(DMA_M1, mode);	/* set it again */
X    port_out(DMA_ADDR, low_addr);	/* output low-order 8 bits */
X***************
X*** 316,322 ****
X    port_out(DMA_TOP, top_addr);	/* output highest 4 bits */
X    port_out(DMA_COUNT, low_ct);	/* output low 8 bits of count - 1 */
X    port_out(DMA_COUNT, high_ct);	/* output high 8 bits of count - 1 */
X!   unlock();
X    port_out(DMA_INIT, 2);	/* initialize DMA */
X  }
X  
X--- 316,322 ----
X    port_out(DMA_TOP, top_addr);	/* output highest 4 bits */
X    port_out(DMA_COUNT, low_ct);	/* output low 8 bits of count - 1 */
X    port_out(DMA_COUNT, high_ct);	/* output high 8 bits of count - 1 */
X!   restore(s);
X    port_out(DMA_INIT, 2);	/* initialize DMA */
X  }
X  
X***************
X*** 339,347 ****
X   * turning off motors while we are testing the bits.
X   */
X  
X!   int motor_bit, running, send_mess();
X  
X!   lock();			/* no interrupts while checking out motor */
X    motor_bit = 1 << (fp->fl_drive + 4);	/* bit mask for this drive */
X    motor_goal = motor_bit | ENABLE_INT | fp->fl_drive;
X    if (motor_status & prev_motor) motor_goal |= prev_motor;
X--- 339,347 ----
X   * turning off motors while we are testing the bits.
X   */
X  
X!   int motor_bit, running, send_mess(), old_state;
X  
X!   old_state = lock();		/* no interrupts while checking out motor */
X    motor_bit = 1 << (fp->fl_drive + 4);	/* bit mask for this drive */
X    motor_goal = motor_bit | ENABLE_INT | fp->fl_drive;
X    if (motor_status & prev_motor) motor_goal |= prev_motor;
X***************
X*** 349,355 ****
X    port_out(DOR, motor_goal);
X    motor_status = motor_goal;
X    prev_motor = motor_bit;	/* record motor started for next time */
X!   unlock();
X  
X    /* If the motor was already running, we don't have to wait for it. */
X    if (running) return;			/* motor was already running */
X--- 349,355 ----
X    port_out(DOR, motor_goal);
X    motor_status = motor_goal;
X    prev_motor = motor_bit;	/* record motor started for next time */
X!   restore(old_state);
X  
X    /* If the motor was already running, we don't have to wait for it. */
X    if (running) return;			/* motor was already running */
X***************
X*** 581,596 ****
X   * like the controller refusing to respond.
X   */
X  
X!   int i, r, status;
X    register struct floppy *fp;
X    /* Disable interrupts and strobe reset bit low. */
X    need_reset = FALSE;
X!   lock();
X    motor_status = 0;
X    motor_goal = 0;
X    port_out(DOR, 0);		/* strobe reset bit low */
X    port_out(DOR, ENABLE_INT);	/* strobe it high again */
X!   unlock();			/* interrupts allowed again */
X    receive(HARDWARE, &mess);	/* collect the RESET interrupt */
X  
X    /* Interrupt from the reset has been received.  Continue resetting. */
X--- 581,597 ----
X   * like the controller refusing to respond.
X   */
X  
X!   int i, r, status, old_state;
X    register struct floppy *fp;
X+ 
X    /* Disable interrupts and strobe reset bit low. */
X    need_reset = FALSE;
X!   old_state = lock();
X    motor_status = 0;
X    motor_goal = 0;
X    port_out(DOR, 0);		/* strobe reset bit low */
X    port_out(DOR, ENABLE_INT);	/* strobe it high again */
X!   restore(old_state);		/* interrupts allowed again */
X    receive(HARDWARE, &mess);	/* collect the RESET interrupt */
X  
X    /* Interrupt from the reset has been received.  Continue resetting. */
+ END-OF-FILE floppy.c.cdif
chmod 'u=rw,g=r,o=r' 'floppy.c.cdif'
set `wc -c 'floppy.c.cdif'`
count=$1
case $count in
4409)	:;;
*)	echo 'Bad character count in ''floppy.c.cdif' >&2
		echo 'Count should be 4409' >&2
esac
echo Extracting 'klib88.s.cdif'
sed 's/^X//' > 'klib88.s.cdif' << '+ END-OF-FILE ''klib88.s.cdif'
X*** /local/ast/minix/tape3a/kernel/klib88.s	Fri Jun  3 21:40:50 1988
X--- klib88.s	Wed Jul 13 16:59:16 1988
X***************
X*** 6,12 ****
X  |   port_out:	outputs data on an I/O port
X  |   port_in:	inputs data from an I/O port
X  |   lock:	disable interrupts
X- |   unlock:	enable interrupts
X  |   restore:	restore interrupts (enable/disabled) as they were before lock()
X  |   build_sig:	build 4 word structure pushed onto stack for signals
X  |   csv:	procedure prolog to save the registers
X--- 6,11 ----
X***************
X*** 23,29 ****
X  |   em_xfer:	read or write AT extended memory using the BIOS
X  
X  | The following procedures are defined in this file and called from outside it.
X! .globl _phys_copy, _cp_mess, _port_out, _port_in, _lock, _unlock, _restore
X  .globl _build_sig, csv, cret, _get_chrome, _vid_copy, _get_byte, _reboot
X  .globl _wreboot, _dma_read, _dma_write, _em_xfer, _scr_up, _scr_down
X  
X--- 22,28 ----
X  |   em_xfer:	read or write AT extended memory using the BIOS
X  
X  | The following procedures are defined in this file and called from outside it.
X! .globl _phys_copy, _cp_mess, _port_out, _port_in, _lock, _restore
X  .globl _build_sig, csv, cret, _get_chrome, _vid_copy, _get_byte, _reboot
X  .globl _wreboot, _dma_read, _dma_write, _em_xfer, _scr_up, _scr_down
X  
X***************
X*** 221,250 ****
X  |*===========================================================================*
X  |*				lock					     *
X  |*===========================================================================*
X! | Disable CPU interrupts.
X  _lock:  
X  	pushf			| save flags on stack
X  	cli			| disable interrupts
X! 	pop lockvar		| save flags for possible restoration later
X  	ret			| return to caller
X  
X  
X  |*===========================================================================*
X- |*				unlock					     *
X- |*===========================================================================*
X- | Enable CPU interrupts.
X- _unlock:
X- 	sti			| enable interrupts
X- 	ret			| return to caller
X- 
X- 
X- |*===========================================================================*
X  |*				restore					     *
X  |*===========================================================================*
X! | Restore enable/disable bit to the value it had before last lock.
X  _restore:
X! 	push lockvar		| push flags as they were before previous lock
X  	popf			| restore flags
X  	ret			| return to caller
X  
X  
X--- 220,243 ----
X  |*===========================================================================*
X  |*				lock					     *
X  |*===========================================================================*
X! | Disable CPU interrupts.  Return old psw as function value.
X  _lock:  
X  	pushf			| save flags on stack
X  	cli			| disable interrupts
X! 	pop ax	 		| return flags for restoration later
X  	ret			| return to caller
X  
X  
X  |*===========================================================================*
X  |*				restore					     *
X  |*===========================================================================*
X! | restore enable/disable bit to the value it had before last lock.
X  _restore:
X! 	push bp			| save it
X! 	mov bp,sp		| set up base for indexing
X! 	push 4(bp)		| bp is the psw to be restored
X  	popf			| restore flags
X+ 	pop bp			| restore bp
X  	ret			| return to caller
X  
X  
X***************
X*** 773,779 ****
X  	jmp _exit
X  
X  .data
X- lockvar:	.word 0		| place to store flags for lock()/restore()
X  vidlock:	.word 0		| dummy variable for use with lock prefix
X  splimit:	.word 0		| stack limit for current task (kernel only)
X  tmp:		.word 0		| count of bytes already copied
X--- 766,771 ----
+ END-OF-FILE klib88.s.cdif
chmod 'u=rw,g=r,o=r' 'klib88.s.cdif'
set `wc -c 'klib88.s.cdif'`
count=$1
case $count in
3587)	:;;
*)	echo 'Bad character count in ''klib88.s.cdif' >&2
		echo 'Count should be 3587' >&2
esac
echo Extracting 'main.c.cdif'
sed 's/^X//' > 'main.c.cdif' << '+ END-OF-FILE ''main.c.cdif'
X*** /local/ast/minix/tape3a/kernel/main.c	Mon Jun 27 22:39:00 1988
X--- main.c	Wed Jul 13 16:59:19 1988
X***************
X*** 5,12 ****
X   * 
X   * The entries into this file are:
X   *   main:		MINIX main program
X!  *   unexpected_int:	called when an interrupt to an unused vector < 16 occurs
X!  *   trap:		called when an unexpected trap to a vector >= 16 occurs
X   *   panic:		abort MINIX due to a fatal error
X   */
X  
X--- 5,12 ----
X   * 
X   * The entries into this file are:
X   *   main:		MINIX main program
X!  *   unexpected_int:	called on an interrupt to an unused vector < 16 occurs
X!  *   trap:		called on an unexpected trap to a vector >= 16 occurs
X   *   panic:		abort MINIX due to a fatal error
X   */
X  
X***************
X*** 47,53 ****
X  
X    register struct proc *rp;
X    register int t;
X!   int i;
X    vir_clicks size;
X    phys_clicks base_click, mm_base, previous_base;
X    phys_bytes phys_b;
X--- 47,53 ----
X  
X    register struct proc *rp;
X    register int t;
X!   int i, old_state;
X    vir_clicks size;
X    phys_clicks base_click, mm_base, previous_base;
X    phys_bytes phys_b;
X***************
X*** 56,62 ****
X    extern unsigned sizes[8];	/* table filled in by build */
X    extern int color, vec_table[], get_chrome();
X    extern int s_call(), disk_int(), tty_int(), clock_int(), disk_int();
X!   extern int wini_int(), lpr_int(), trp(), rs232_int();
X    extern phys_bytes umap();
X    extern char get_byte();
X    extern struct tasktab tasktab[];	/* see table.c */
X--- 56,62 ----
X    extern unsigned sizes[8];	/* table filled in by build */
X    extern int color, vec_table[], get_chrome();
X    extern int s_call(), disk_int(), tty_int(), clock_int(), disk_int();
X!   extern int wini_int(), lpr_int(), trp(), rs232_int(), secondary_int();
X    extern phys_bytes umap();
X    extern char get_byte();
X    extern struct tasktab tasktab[];	/* see table.c */
X***************
X*** 76,82 ****
X     * the words at 0x000A, 0x000C, and 0x000E free.
X     */
X  
X!   lock();			/* we can't handle interrupts yet */
X    base_click = BASE >> CLICK_SHIFT;
X    size = sizes[0] + sizes[1];	/* kernel text + data size in clicks */
X    mm_base = base_click + size;	/* place where MM starts (in clicks) */
X--- 76,82 ----
X     * the words at 0x000A, 0x000C, and 0x000E free.
X     */
X  
X!   old_state = lock();			/* we can't handle interrupts yet */
X    base_click = BASE >> CLICK_SHIFT;
X    size = sizes[0] + sizes[1];	/* kernel text + data size in clicks */
X    mm_base = base_click + size;	/* place where MM starts (in clicks) */
X***************
X*** 154,165 ****
X    set_vec(SYS_VECTOR, s_call, base_click);
X    set_vec(CLOCK_VECTOR, clock_int, base_click);
X    set_vec(KEYBOARD_VECTOR, tty_int, base_click);
X    set_vec(RS232_VECTOR, rs232_int, base_click);
X    set_vec(FLOPPY_VECTOR, disk_int, base_click);
X    set_vec(PRINTER_VECTOR, lpr_int, base_click);
X  #ifdef AM_KERNEL
X  #ifndef NONET
X!   set_vec(ETHER_VECTOR, eth_int, base_click);
X  #endif
X  #endif
X    if (pc_at) {
X--- 154,166 ----
X    set_vec(SYS_VECTOR, s_call, base_click);
X    set_vec(CLOCK_VECTOR, clock_int, base_click);
X    set_vec(KEYBOARD_VECTOR, tty_int, base_click);
X+   set_vec(SECONDARY_VECTOR, secondary_int, base_click);
X    set_vec(RS232_VECTOR, rs232_int, base_click);
X    set_vec(FLOPPY_VECTOR, disk_int, base_click);
X    set_vec(PRINTER_VECTOR, lpr_int, base_click);
X  #ifdef AM_KERNEL
X  #ifndef NONET
X!   set_vec(ETHER_VECTOR, eth_int, base_click);	/* overwrites RS232 port 2 */
X  #endif
X  #endif
X    if (pc_at) {
+ END-OF-FILE main.c.cdif
chmod 'u=rw,g=r,o=r' 'main.c.cdif'
set `wc -c 'main.c.cdif'`
count=$1
case $count in
3477)	:;;
*)	echo 'Bad character count in ''main.c.cdif' >&2
		echo 'Count should be 3477' >&2
esac
echo Extracting 'mpx88.s.cdif'
sed 's/^X//' > 'mpx88.s.cdif' << '+ END-OF-FILE ''mpx88.s.cdif'
X*** /local/ast/minix/tape3a/kernel/mpx88.s	Sun Jun 26 23:13:45 1988
X--- mpx88.s	Wed Jul 13 16:59:15 1988
X***************
X*** 10,16 ****
X  | The external entry points into this file are:
X  |   s_call:	process or task wants to send or receive a message
X  |   tty_int:	interrupt routine for each key depression and release
X! |   rs232_int:	interrupt routine for each rs232 interrupt
X  |   lpr_int:	interrupt routine for each line printer interrupt
X  |   disk_int:	disk interrupt routine
X  |   wini_int:	winchester interrupt routine
X--- 10,17 ----
X  | The external entry points into this file are:
X  |   s_call:	process or task wants to send or receive a message
X  |   tty_int:	interrupt routine for each key depression and release
X! |   rs232_int:	interrupt routine for each rs232 interrupt on port 1
X! |   secondary:	interrupt routine for each rs232 interrupt on port 2
X  |   lpr_int:	interrupt routine for each line printer interrupt
X  |   disk_int:	disk interrupt routine
X  |   wini_int:	winchester interrupt routine
X***************
X*** 31,37 ****
X  
X  | The following procedures are defined in this file and called from outside it.
X  .globl _tty_int, _rs232_int, _lpr_int, _clock_int, _disk_int, _wini_int
X! .globl _eth_int, _s_call, _trp, _restart
X  .globl _int00, _int01, _int02, _int03, _int04, _int05, _int06, _int07
X  .globl _int08, _int09, _int10, _int11, _int12, _int13, _int14, _int15
X  
X--- 32,38 ----
X  
X  | The following procedures are defined in this file and called from outside it.
X  .globl _tty_int, _rs232_int, _lpr_int, _clock_int, _disk_int, _wini_int
X! .globl _eth_int, _s_call, _trp, _restart, _secondary_int
X  .globl _int00, _int01, _int02, _int03, _int04, _int05, _int06, _int07
X  .globl _int08, _int09, _int10, _int11, _int12, _int13, _int14, _int15
X  
X***************
X*** 106,111 ****
X--- 107,123 ----
X  _rs232_int:			| Interrupt routine for rs232 I/O.
X  	call save		| save the machine state
X  	mov ax,#1		| which unit caused the interrupt
X+ 	push ax			| pass it as a parameter
X+ 	call _rs232		| process a rs232 interrupt
X+ 	jmp _restart		| continue execution
X+ 
X+ 
X+ |*============================================================================
X+ |*				secondary_int				     *
X+ |*============================================================================
X+ _secondary_int:			| Interrupt routine for rs232 port 2
X+ 	call save		| save the machine state
X+ 	mov ax,#2		| which unit caused the interrupt
X  	push ax			| pass it as a parameter
X  	call _rs232		| process a rs232 interrupt
X  	jmp _restart		| continue execution
+ END-OF-FILE mpx88.s.cdif
chmod 'u=rw,g=r,o=r' 'mpx88.s.cdif'
set `wc -c 'mpx88.s.cdif'`
count=$1
case $count in
2549)	:;;
*)	echo 'Bad character count in ''mpx88.s.cdif' >&2
		echo 'Count should be 2549' >&2
esac
echo Extracting 'printer.c.cdif'
sed 's/^X//' > 'printer.c.cdif' << '+ END-OF-FILE ''printer.c.cdif'
X*** /local/ast/minix/tape3a/kernel/printer.c	Fri Jun  3 21:40:44 1988
X--- printer.c	Wed Jul 13 16:59:19 1988
X***************
X*** 90,96 ****
X  {
X  /* The printer is used by sending TTY_WRITE messages to it. Process one. */
X  
X!   int i, j, r, value;
X    struct proc *rp;
X    phys_bytes phys;
X    extern phys_bytes umap();
X--- 90,96 ----
X  {
X  /* The printer is used by sending TTY_WRITE messages to it. Process one. */
X  
X!   int i, j, r, value, old_state;
X    struct proc *rp;
X    phys_bytes phys;
X    extern phys_bytes umap();
X***************
X*** 98,104 ****
X    r = OK;			/* so far, no errors */
X  
X    /* Reject command if printer is busy or count is not positive. */
X!   if (pr_busy) r = EAGAIN;
X    if (m_ptr->COUNT <= 0) r = EINVAL;
X  
X    /* Compute the physical address of the data buffer within user space. */
X--- 98,104 ----
X    r = OK;			/* so far, no errors */
X  
X    /* Reject command if printer is busy or count is not positive. */
X!   if (pr_busy) r = EIO;
X    if (m_ptr->COUNT <= 0) r = EINVAL;
X  
X    /* Compute the physical address of the data buffer within user space. */
X***************
X*** 108,114 ****
X  
X    if (r == OK) {
X    	/* Save information needed later. */
X! 	lock();			/* no interrupts now please */
X    	caller = m_ptr->m_source;
X    	proc_nr = m_ptr->PROC_NR;
X    	pcount = m_ptr->COUNT;
X--- 108,114 ----
X  
X    if (r == OK) {
X    	/* Save information needed later. */
X! 	old_state = lock();		/* no interrupts now please */
X    	caller = m_ptr->m_source;
X    	proc_nr = m_ptr->PROC_NR;
X    	pcount = m_ptr->COUNT;
X***************
X*** 137,143 ****
X    }
X  
X    /* Reply to FS, no matter what happened. */
X!   if ((value&STATUS_MASK) == BUSY_STATUS) r = EAGAIN;
X    reply(TASK_REPLY, m_ptr->m_source, m_ptr->PROC_NR, r);
X  }
X  
X--- 137,143 ----
X    }
X  
X    /* Reply to FS, no matter what happened. */
X!   if ((value&STATUS_MASK) == BUSY_STATUS) r = EIO;
X    reply(TASK_REPLY, m_ptr->m_source, m_ptr->PROC_NR, r);
X  }
X  
+ END-OF-FILE printer.c.cdif
chmod 'u=rw,g=r,o=r' 'printer.c.cdif'
set `wc -c 'printer.c.cdif'`
count=$1
case $count in
1953)	:;;
*)	echo 'Bad character count in ''printer.c.cdif' >&2
		echo 'Count should be 1953' >&2
esac
echo Extracting 'proc.c.cdif'
sed 's/^X//' > 'proc.c.cdif' << '+ END-OF-FILE ''proc.c.cdif'
X*** /local/ast/minix/tape3a/kernel/proc.c	Mon Jun 27 22:39:00 1988
X--- proc.c	Wed Jul 13 16:59:20 1988
X***************
X*** 114,120 ****
X    }
X  
X    if (function & RECEIVE) {
X! 	n = mini_rec(caller, src_dest, m_ptr);      /* func = RECEIVE or BOTH */
X  	rp->p_reg[RET_REG] = n;
X    }
X  }
X--- 114,120 ----
X    }
X  
X    if (function & RECEIVE) {
X! 	n = mini_rec(caller, src_dest, m_ptr);      /* func = RECEIVE or BOTH*/
X  	rp->p_reg[RET_REG] = n;
X    }
X  }
X***************
X*** 148,155 ****
X    len = caller_ptr->p_map[D].mem_len;
X    vb = (vir_bytes) m_ptr;
X    vlo = vb >> CLICK_SHIFT;	/* vir click for bottom of message */
X!   vhi = (vb + MESS_SIZE - 1) >> CLICK_SHIFT;	/* vir click for top of message */
X!   if (vhi < vlo || vhi - caller_ptr->p_map[D].mem_vir >= len)return(E_BAD_ADDR);
X  
X    /* Check for deadlock by 'caller' and 'dest' sending to each other. */
X    if (dest_ptr->p_flags & SENDING) {
X--- 148,155 ----
X    len = caller_ptr->p_map[D].mem_len;
X    vb = (vir_bytes) m_ptr;
X    vlo = vb >> CLICK_SHIFT;	/* vir click for bottom of message */
X!   vhi = (vb + MESS_SIZE - 1) >> CLICK_SHIFT;	/* vir click for top of msg */
X!   if (vhi < vlo || vhi - caller_ptr->p_map[D].mem_vir >=len)return(E_BAD_ADDR);
X  
X    /* Check for deadlock by 'caller' and 'dest' sending to each other. */
X    if (dest_ptr->p_flags & SENDING) {
X***************
X*** 166,172 ****
X  		(dest_ptr->p_getfrom == ANY || dest_ptr->p_getfrom == caller)){
X  	/* Destination is indeed waiting for this message. */
X  	cp_mess(caller, caller_ptr->p_map[D].mem_phys, m_ptr, 
X! 				dest_ptr->p_map[D].mem_phys, dest_ptr->p_messbuf);
X  	dest_ptr->p_flags &= ~RECEIVING;	/* deblock destination */
X  	if (dest_ptr->p_flags == 0) ready(dest_ptr);
X    } else {
X--- 166,172 ----
X  		(dest_ptr->p_getfrom == ANY || dest_ptr->p_getfrom == caller)){
X  	/* Destination is indeed waiting for this message. */
X  	cp_mess(caller, caller_ptr->p_map[D].mem_phys, m_ptr, 
X! 			   dest_ptr->p_map[D].mem_phys, dest_ptr->p_messbuf);
X  	dest_ptr->p_flags &= ~RECEIVING;	/* deblock destination */
X  	if (dest_ptr->p_flags == 0) ready(dest_ptr);
X    } else {
X***************
X*** 205,214 ****
X   * Calls from the tasks, MM, and FS are trusted.
X   */
X  
X!   register struct proc *caller_ptr, *sender_ptr, *prev_ptr;
X    int sender;
X  
X!   caller_ptr = proc_addr(caller);	/* pointer to caller's proc structure */
X  
X    /* Check to see if a message from desired source is already available. */
X    sender_ptr = caller_ptr->p_callerq;
X--- 205,214 ----
X   * Calls from the tasks, MM, and FS are trusted.
X   */
X  
X!   register struct proc *caller_ptr, *sender_ptr, *previous_ptr;
X    int sender;
X  
X!   caller_ptr = proc_addr(caller);	/* pointer to caller's proc struct */
X  
X    /* Check to see if a message from desired source is already available. */
X    sender_ptr = caller_ptr->p_callerq;
X***************
X*** 217,233 ****
X  	sender = sender_ptr - proc - NR_TASKS;
X  	if (src == ANY || src == sender) {
X  		/* An acceptable message has been found. */
X! 		cp_mess(sender, sender_ptr->p_map[D].mem_phys, sender_ptr->p_messbuf,
X! 					caller_ptr->p_map[D].mem_phys, m_ptr);
X  		sender_ptr->p_flags &= ~SENDING;	/* deblock sender */
X  		if (sender_ptr->p_flags == 0) ready(sender_ptr);
X  		if (sender_ptr == caller_ptr->p_callerq)
X  			caller_ptr->p_callerq = sender_ptr->p_sendlink;
X  		else
X! 			prev_ptr->p_sendlink = sender_ptr->p_sendlink;
X  		return(OK);
X  	}
X! 	prev_ptr = sender_ptr;
X  	sender_ptr = sender_ptr->p_sendlink;
X       }
X    }
X--- 217,233 ----
X  	sender = sender_ptr - proc - NR_TASKS;
X  	if (src == ANY || src == sender) {
X  		/* An acceptable message has been found. */
X! 		cp_mess(sender, sender_ptr->p_map[D].mem_phys, 
X! 		  sender_ptr->p_messbuf, caller_ptr->p_map[D].mem_phys, m_ptr);
X  		sender_ptr->p_flags &= ~SENDING;	/* deblock sender */
X  		if (sender_ptr->p_flags == 0) ready(sender_ptr);
X  		if (sender_ptr == caller_ptr->p_callerq)
X  			caller_ptr->p_callerq = sender_ptr->p_sendlink;
X  		else
X! 			previous_ptr->p_sendlink = sender_ptr->p_sendlink;
X  		return(OK);
X  	}
X! 	previous_ptr = sender_ptr;
X  	sender_ptr = sender_ptr->p_sendlink;
X       }
X    }
X***************
X*** 264,271 ****
X     * slot, namely, that of task -1 (HARDWARE), so save() will have somewhere to
X     * deposit the registers when an interrupt occurs on an idle machine.
X     * Record previous process so that when clock tick happens, the clock task
X!    * can find out who was running just before it began to run.  (While the
X!    * clock task is running, 'cur_proc' = CLOCKTASK.) In addition, set 'bill_ptr'
X     * to always point to the process to be billed for CPU time.
X     */
X    prev_proc = cur_proc;
X--- 264,271 ----
X     * slot, namely, that of task -1 (HARDWARE), so save() will have somewhere to
X     * deposit the registers when an interrupt occurs on an idle machine.
X     * Record previous process so that when clock tick happens, the clock task
X!    * can find out who was running just before it began to run. (While the clock
X!    * task is running, 'cur_proc' = CLOCKTASK.) In addition, set 'bill_ptr'
X     * to always point to the process to be billed for CPU time.
X     */
X    prev_proc = cur_proc;
X***************
X*** 296,304 ****
X   */
X  
X    register int q;		/* TASK_Q, SERVER_Q, or USER_Q */
X!   int r;
X  
X!   lock();			/* disable interrupts */
X    r = (rp - proc) - NR_TASKS;	/* task or proc number */
X    q = (r < 0 ? TASK_Q : r < LOW_USER ? SERVER_Q : USER_Q);
X  
X--- 296,304 ----
X   */
X  
X    register int q;		/* TASK_Q, SERVER_Q, or USER_Q */
X!   int r, old_state;
X  
X!   old_state = lock();		/* disable interrupts */
X    r = (rp - proc) - NR_TASKS;	/* task or proc number */
X    q = (r < 0 ? TASK_Q : r < LOW_USER ? SERVER_Q : USER_Q);
X  
X***************
X*** 309,315 ****
X  	rdy_tail[q]->p_nextready = rp;	/* add to tail of nonempty queue */
X    rdy_tail[q] = rp;		/* new entry has no successor */
X    rp->p_nextready = NIL_PROC;
X!   restore();			/* restore interrupts to previous state */
X  }
X  
X  
X--- 309,315 ----
X  	rdy_tail[q]->p_nextready = rp;	/* add to tail of nonempty queue */
X    rdy_tail[q] = rp;		/* new entry has no successor */
X    rp->p_nextready = NIL_PROC;
X!   restore(old_state);		/* restore interrupts to previous state */
X  }
X  
X  
X***************
X*** 322,334 ****
X  /* A process has blocked. */
X  
X    register struct proc *xp;
X!   int r, q;
X  
X!   lock();			/* disable interrupts */
X    r = rp - proc - NR_TASKS;
X    q = (r < 0 ? TASK_Q : r < LOW_USER ? SERVER_Q : USER_Q);
X    if ( (xp = rdy_head[q]) == NIL_PROC) {
X! 	restore();
X  	return;
X    }
X    if (xp == rp) {
X--- 322,334 ----
X  /* A process has blocked. */
X  
X    register struct proc *xp;
X!   int r, q, old_state;
X  
X!   old_state = lock();			/* disable interrupts */
X    r = rp - proc - NR_TASKS;
X    q = (r < 0 ? TASK_Q : r < LOW_USER ? SERVER_Q : USER_Q);
X    if ( (xp = rdy_head[q]) == NIL_PROC) {
X! 	restore(old_state);
X  	return;
X    }
X    if (xp == rp) {
X***************
X*** 341,354 ****
X  	 */
X  	while (xp->p_nextready != rp)
X  		if ( (xp = xp->p_nextready) == NIL_PROC) {
X! 			restore();
X  			return;
X  		}
X  	xp->p_nextready = xp->p_nextready->p_nextready;
X  	while (xp->p_nextready != NIL_PROC) xp = xp->p_nextready;
X  	rdy_tail[q] = xp;
X    }
X!   restore();			/* restore interrupts to previous state */
X  }
X  
X  
X--- 341,354 ----
X  	 */
X  	while (xp->p_nextready != rp)
X  		if ( (xp = xp->p_nextready) == NIL_PROC) {
X! 			restore(old_state);
X  			return;
X  		}
X  	xp->p_nextready = xp->p_nextready->p_nextready;
X  	while (xp->p_nextready != NIL_PROC) xp = xp->p_nextready;
X  	rdy_tail[q] = xp;
X    }
X!   restore(old_state);			/* restore interrupts to prev state */
X  }
X  
X  
X***************
X*** 362,370 ****
X   * possibly promoting another user to head of the queue.
X   */
X  
X!   lock();			/* disable interrupts */
X    if (rdy_head[USER_Q] == NIL_PROC) {
X! 	restore();		/* restore interrupts to previous state */
X  	return;
X    }
X  
X--- 362,372 ----
X   * possibly promoting another user to head of the queue.
X   */
X  
X!   int old_state;
X! 
X!   old_state = lock();			/* disable interrupts */
X    if (rdy_head[USER_Q] == NIL_PROC) {
X! 	restore(old_state);		/* restore interrupts to prev state */
X  	return;
X    }
X  
X***************
X*** 374,378 ****
X    rdy_head[USER_Q] = rdy_head[USER_Q]->p_nextready;
X    rdy_tail[USER_Q]->p_nextready = NIL_PROC;
X    pick_proc();
X!   restore();			/* restore interrupts to previous state */
X  }
X--- 376,380 ----
X    rdy_head[USER_Q] = rdy_head[USER_Q]->p_nextready;
X    rdy_tail[USER_Q]->p_nextready = NIL_PROC;
X    pick_proc();
X!   restore(old_state);			/* restore interrupts to prev state */
X  }
+ END-OF-FILE proc.c.cdif
chmod 'u=rw,g=r,o=r' 'proc.c.cdif'
set `wc -c 'proc.c.cdif'`
count=$1
case $count in
8615)	:;;
*)	echo 'Bad character count in ''proc.c.cdif' >&2
		echo 'Count should be 8615' >&2
esac
echo Extracting 'table.c.cdif'
sed 's/^X//' > 'table.c.cdif' << '+ END-OF-FILE ''table.c.cdif'
X*** /local/ast/minix/tape3a/kernel/table.c	Fri Jun  3 21:40:45 1988
X--- table.c	Wed Jul 13 16:59:21 1988
X***************
X*** 93,99 ****
X  	mem_task,		MEM_STACK,	"RAMDSK",
X  	clock_task,		CLOCK_STACK,	"CLOCK ",
X  	sys_task,		SYS_STACK,	"SYS   ",
X! 	0,			0,		"HARDWR",
X  	0,			0,		"MM    ",
X  	0,			0,		"FS    ",
X  	0,			0,		"INIT  "
X--- 93,99 ----
X  	mem_task,		MEM_STACK,	"RAMDSK",
X  	clock_task,		CLOCK_STACK,	"CLOCK ",
X  	sys_task,		SYS_STACK,	"SYS   ",
X! 	0,			0,		"IDLE  ",
X  	0,			0,		"MM    ",
X  	0,			0,		"FS    ",
X  	0,			0,		"INIT  "
+ END-OF-FILE table.c.cdif
chmod 'u=rw,g=r,o=r' 'table.c.cdif'
set `wc -c 'table.c.cdif'`
count=$1
case $count in
543)	:;;
*)	echo 'Bad character count in ''table.c.cdif' >&2
		echo 'Count should be 543' >&2
esac
exit 0