1: /*
   2:  * Copyright (c) 1987 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  *
   6:  *	@(#)mch_dzpdma.s	1.1 (2.10BSD Berkeley) 2/10/87
   7:  */
   8: #include "DEFS.h"
   9: #include "../machine/mch_iopage.h"
  10: #include "../machine/koverlay.h"
  11: #include "dz.h"
  12: 
  13: 
  14: #if NDZ > 0
  15: /*
  16:  * DZ-11 pseudo-DMA interrupt routine.  Called directly from the
  17:  * interrupt vector; the device number is in the low bits of the PS.
  18:  * Calls dzxint when the end of the buffer is reached.  The pdma
  19:  * structure is known to be:
  20:  *
  21:  * struct pdma {
  22:  * 	struct	dzdevice *pd_addr;	/ address of controlling device
  23:  *	char	*p_mem;			/ start of buffer
  24:  *	char	*p_end;			/ end of buffer
  25:  *	struct	tty *p_arg;		/ tty structure for this line
  26:  * };
  27:  */
  28: ASENTRY(dzdma)
  29:         mov     PS,-(sp)                / save new PS, r0-r3 and __ovno (r0
  30:         mov     r0,-(sp)                /   saved before __ovno so we can
  31:         mov     __ovno,-(sp)            /   use it to restore overlay
  32:         mov     r1,-(sp)                /   mapping if necessary)
  33:         mov     r2,-(sp)
  34:         mov     r3,-(sp)
  35: #ifdef UCB_METER
  36:         /*
  37: 	 * 4.3BSD doesn't count this as an interrupt (cnt.v_intr) so we don't
  38: 	 * either.
  39: 	 */
  40:         inc     _cnt+V_PDMA             / cnt.v_pdma++
  41: #endif
  42:         mov     12(sp),r3               / new PS
  43:         bic     $!37,r3                 / extract device number
  44:         ash     $3+3,r3                 / r3 = &_dzpdma[dev*8] - 8 lines per DZ
  45:         add     $_dzpdma,r3
  46:         mov     (r3)+,r2                / pd_addr in r2; r3 points to p_mem
  47: #ifdef UCB_CLIST
  48:         mov     KDSA5,-(sp)             / save previous mapping
  49:         mov     KDSD5,-(sp)
  50:         mov     _clststrt,KDSA5         / map in clists
  51:         mov     _clstdesc,KDSD5
  52: #endif
  53: 1:                                      / loop until no line is ready
  54:         movb    1(r2),r1                / dzcsr high byte
  55:         bge     3f                      / test TRDY; branch if none
  56:         bic     $!7,r1                  / extract line number
  57:         ash     $3,r1                   / convert to pdma offset
  58:         add     r3,r1                   / r1 is pointer to pdma.p_mem for line
  59:         mov     (r1)+,r0                / pdma->p_mem
  60:         cmp     r0,(r1)+                / cmp p_mem to p_end
  61:         bhis    2f                      / if p_mem >= p_end
  62:         movb    (r0)+,6(r2)             / dztbuf = *p_mem++
  63:         mov     r0,-4(r1)               / update p_mem
  64:         br      1b
  65: 2:                                      / buffer is empty; call dzxint
  66:         mov     (r1),-(sp)              / p_arg
  67:         jsr     pc,_dzxint              / r0, r1 are modified!
  68:         tst     (sp)+
  69:         br      1b
  70:                                         / no more lines ready; return
  71: 3:
  72: #ifdef UCB_CLIST
  73:         mov     (sp)+,KDSD5
  74:         mov     (sp)+,KDSA5             / restore previous mapping
  75: #endif
  76:         mov     (sp)+,r3                / restore saved registers
  77:         mov     (sp)+,r2
  78:         mov     (sp)+,r1
  79:         SPL7
  80:         mov     (sp)+,r0                / overlays get switched while we were
  81:         cmp     r0,__ovno               /   doing our thing?
  82:         beq     4f
  83:         mov     r0,__ovno               / yes, have to restore the earlier
  84:         asl     r0                      /   overlay mapping
  85:         mov     ova(r0),OVLY_PAR
  86:         mov     ovd(r0),OVLY_PDR
  87: 4:
  88:         mov     (sp)+,r0                / restore r0, toss new PS value
  89:         tst     (sp)+                   /   and return from the interrupt
  90:         rtt
  91: #endif NDZ > 0

Defined functions

dzdma defined in line 28; never used
Last modified: 1988-05-01
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2334
Valid CSS Valid XHTML 1.0 Strict