Annotation of researchv9/sys/inet/vecadd.s.save, revision 1.1.1.1

1.1       root        1:        .text
                      2: /*
                      3:  * Compute a 16-bit checksum
                      4:  *
                      5:  * vecadd(w, len, sum)
                      6:  *     unsigned long *w;
                      7:  *     int len;
                      8:  *     unsigned sum;
                      9:  */
                     10:        .globl  _vecadd
                     11: _vecadd:
                     12:        movl    d2,sp@-
                     13:        movl    sp@(8),a0
                     14:        movl    sp@(12),d0
                     15:        movl    sp@(16),d1
                     16:        movl    d0,d2
                     17:        lsrl    #2,d0
                     18:        lsll    #2,d0
                     19:        subl    d0,d2
                     20:        lsrl    #2,d0
                     21:        movw    #0,cc
                     22:        jra     L_2
                     23: L_1:
                     24:        addl    a0@+,d1
                     25: L_2:
                     26:        dbcs    d0,L_1
                     27:        jcc     L_3
                     28:        addql   #1,d1
                     29:        jra     L_2
                     30: L_3:
                     31:        btst    #1,d2           | if there is another short add it in
                     32:        jeq     L_4
                     33:        moveq   #0,d0
                     34:        movw    a0@+,d0
                     35:        addl    d0,d1
                     36:        jcc     L_4
                     37:        addql   #1,d1
                     38: L_4:
                     39:        btst    #0,d2           | if there is another byte add it in
                     40:        jeq     L_5
                     41:        moveq   #0,d0
                     42:        movb    a0@+,d0
                     43:        lsll    #8,d0
                     44:        addl    d0,d1
                     45:        jcc     L_5
                     46:        addql   #1,d1
                     47: L_5:
                     48:        movl    d1,d0           | fold the 32 bits into 16
                     49:        lsrl    #16,d0
                     50:        andl    #0xFFFF,d1
                     51:        addw    d1,d0
                     52:        jcc     L_6
                     53:        addql   #1,d0
                     54: L_6:
                     55:        movl    sp@+,d2
                     56:        rts

unix.superglobalmegacorp.com

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