Annotation of 43BSDReno/usr.bin/tn3270/general/vaxbsubs.s, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1988 Regents of the University of California.
                      3:  * All rights reserved.
                      4:  *
                      5:  * Redistribution and use in source and binary forms are permitted
                      6:  * provided that the above copyright notice and this paragraph are
                      7:  * duplicated in all such forms and that any documentation,
                      8:  * advertising materials, and other materials related to such
                      9:  * distribution and use acknowledge that the software was developed
                     10:  * by the University of California, Berkeley.  The name of the
                     11:  * University may not be used to endorse or promote products derived
                     12:  * from this software without specific prior written permission.
                     13:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
                     14:  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
                     15:  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
                     16:  *
                     17:  *     @(#)vaxbsubs.s  4.1 (Berkeley) 12/4/88
                     18:  */
                     19: 
                     20: /* This is taken from bcmp.s from 4.2.
                     21:  * The output of bunequal is the offset of the byte which didn't match;
                     22:  * if all the bytes match, then we return n.
                     23:  *
                     24:  * BUGNOTE:  This has no chance of working for lengths greater than 64K.
                     25:  *             (so, if you use this somewhere else, you may need to
                     26:  *             fix it...)
                     27:  */
                     28: 
                     29: /* bunequal(s1, s2, n) */
                     30: 
                     31: #include "defs.h"
                     32: 
                     33: ENTRY(bunequal)
                     34:        movl    4(ap),r1
                     35:        movl    8(ap),r3
                     36:        movl    12(ap),r4
                     37: 1:
                     38:        movzwl  $65535,r0
                     39:        cmpl    r4,r0
                     40:        jleq    2f
                     41:        subl2   r0,r4
                     42:        cmpc3   r0,(r1),(r3)
                     43:        jeql    1b
                     44:        addl2   r4,r0
                     45:        /* changes... */
                     46:        subl3   r0,12(ap),r0
                     47:        /* end of changes for bunequal... */
                     48:        ret
                     49: 2:
                     50:        cmpc3   r4,(r1),(r3)
                     51:        /* changes... */
                     52:        subl3   r0,12(ap),r0
                     53:        /* end of changes for bunequal... */
                     54:        ret
                     55: 
                     56: 
                     57: 
                     58: 
                     59: /* brand new code, using the above as base... */
                     60: /* bskip(s1, n, b) : finds the first occurrence of any byte != 'b' in the 'n'
                     61:  * bytes beginning at 's1'.
                     62:  *
                     63:  * BUGNOTE:  This has no chance of working for lengths greater than 64K.
                     64:  *             (so, if you use this somewhere else, you may need to
                     65:  *             fix it...)
                     66:  */
                     67: 
                     68: ENTRY(bskip)
                     69:        movl    4(ap),r1
                     70:        movl    8(ap),r3
                     71:        movl    12(ap),r4
                     72: 1:
                     73:        movzwl  $65535,r0
                     74:        cmpl    r3,r0
                     75:        jleq    2f
                     76:        subl2   r0,r3
                     77:        skpc    r4,r0,(r1)
                     78:        jeql    1b
                     79:        addl2   r3,r0
                     80:        subl3   r0,8(ap),r0
                     81:        ret
                     82: 2:
                     83:        skpc    r4,r3,(r1)
                     84:        subl3   r0,8(ap),r0
                     85:        ret

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.