# 2.11BSD#431 - /usr/src/sys/pdp/net_xxx.s

##### Functions

    _badaddr          X
    _delay            X
    _locc             X

       1: /*
       2:  * Copyright (c) 1988 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:  *	@(#)net_xxx.s	1.3 (2.11BSD GTE) 1/12/95
       7:  */
       8:
       9: #include "DEFS.h"
      10: #include "../machine/mch_iopage.h"
      11:
      12: /*
      13:  * delay(usec)
      14:  *	long	usec;
      15:  *
      16:  * Delay (approximately) usec micro-seconds.  It really isn't very acurrate
      17:  * since we can be interrupted and take much longer than we intended, but
      18:  * that's alright - we just don't want to come home early ...
      19:  *
      20:  * Copied to the networking from the kernel (mch_xxx.s) so the network could
      21:  * do delays (if_qt.c).
      22:  */
      23: ENTRY(delay)
      24:         mov     2(sp),r0                / r0 = hiint(usec)
      25:         mov     4(sp),r1                / r1 = loint(usec)
      26:         ashc    $1,r0                   / sob's ~= 1/2 micro second,
      27:         beq     2f                      / oops, got passed a delay of 0L-leave
      28:         tst     r1
      29:         /*
      30: 	 * If the low int of the loop counter is zero, the double sob loop
      31: 	 * below will perform correctly, otherwise the high byte must be
      32: 	 * increment.
      33: 	 */
      34:         beq     1f
      35:         inc     r0                      / correct for looping
      36: 1:
      37:         sob     r1,1b                   / sit on our hands for a while ...
      38:         sob     r0,1b
      39: 2:
      40:         rts     pc
      41:
      42: /*
      43:  * badaddr(addr, len)
      44:  *	caddr_t addr;
      45:  *	int len;
      46:  *
      47:  * See if accessing addr with a len type instruction causes a memory fault.
      48:  * Len is length os access (1=byte, 2=short, 4=long).  Returns 0 if the
      49:  * address is OK, -1 on error.  If either the address or length is odd use
      50:  * a byte test rather than a word test.
      51:  */
      52: ENTRY(badaddr)
      53:         mov     PS,-(sp)                / save current PS and set previous
      54:         bic     $30000,PS               /   mode = kernel
      55:         mfpd    *$nofault               / save current nofault and set up
      56:         mov     $4f,-(sp)               /   our own trap
      57:         mtpd    *$nofault
      58:         mov     10(sp),r0               / if the low bit of either the length
      59:         bis     6(sp),r0                /   or address is
      60:         asr     r0                      /   on then use a tstb
      61:         bcc     1f                      / br if word test to be used
      62:         tstb    *6(sp)                  / yes, just do a tstb on the address
      63:         br      2f
      64: 1:
      65:         tst     *6(sp)                  / no, try a tst ...
      66: 2:
      67:         clr     r0                      / we made it - return success
      68: 3:
      69:         mtpd    *$nofault               / restore previous fault trap
      70:         mov     (sp)+,PS                /   and PS
      71:         rts     pc                      / and return
      72: 4:
      73:         mov     $-1,r0                  / we faulted out - return failure
      74:         br      3b
      75:
      76:
      77: /*
      78:  * locc(mask, size, str)
      79:  * 	u_char mask;
      80:  * 	u_int size;
      81:  * 	u_char *str;
      82:  *
      83:  * Scan through str up to (but not including str[size]) stopping when a
      84:  * character equals mask.  Return number of characters left in str.
      85:  */
      86: ENTRY(locc)
      87:         mov     4(sp),r0                / r0 = size
      88:         beq     3f                      /   exit early if zero
      89:         mov     6(sp),r1                / r1 = str
      90:         mov     r2,-(sp)                / r2 = mask
      91:         mov     2+2(sp),r2
      92: 1:                                      / do
      93:         cmpb    (r1)+,r2                /   if (*str++ == mask)
      94:         beq     2f
      95:         sob     r0,1b                   / while (--size != 0)
      96: 2:
      97:         mov     (sp)+,r2                / restore registers
      98: 3:
      99:         rts     pc                      / and return size

#### Defined functions

_badaddr defined in line 52; used 1 times

- in /usr/src/sys/sys/sys_net.c line 178

_delay defined in line 23; used 8 times

- in /usr/src/sys/pdp/machdep2.c line 410
- in /usr/src/sys/pdpif/if_qt.c line 255, 276
- in /usr/src/sys/pdpuba/dhv.c line 502, 668
- in /usr/src/sys/pdpuba/tmscp.c line 440
- in /usr/src/sys/pdpuba/xp.c line 187, 1024

_locc defined in line 86; used 2 times

- in /usr/src/sys/net/if_sl.c line 310-311(2)

Last modified: 1995-01-13 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 599 |