Annotation of coherent/d/PS2_KERNEL/io.286/rpas.s, revision 1.1.1.1

1.1       root        1: ////////
                      2: /
                      3: / Ram Pipe Device Driver Assembler Support
                      4: /
                      5: /      urcopy( up, np, n )     -- copy user data to pipe
                      6: /      rucopy( np, up, n )     -- copy pipe data to user
                      7: /
                      8: ////////
                      9: 
                     10:        .globl  urcopy_
                     11:        .globl  rucopy_
                     12: 
                     13: ////////
                     14: /
                     15: / Offsets of fields within the ram pipe structure
                     16: /
                     17: ////////
                     18: 
                     19:        Q_SIZE  = 0
                     20:        Q_MASK  = 2
                     21:        Q_IX    = 4
                     22:        Q_ISEG  = 6
                     23:        Q_OX    = 8
                     24:        Q_OSEG  = 10
                     25:        Q_IGATE = 12
                     26:        Q_OGATE = 14
                     27: 
                     28: ////////
                     29: /
                     30: / Urcopy ( up, rp, cnt )
                     31: / char * up;
                     32: / struct ring * rp;
                     33: / unsigned cnt;
                     34: /
                     35: /      Input:  up  = pointer to user data to copy.
                     36: /              rp  = pointer to ring structure to copy data to.
                     37: /              cnt = number of data bytes to copy.
                     38: /
                     39: /      Action: Copy CNT bytes from UP to RP->Q_IX.
                     40: /
                     41: /      Return: Number of bytes transferred.
                     42: /
                     43: ////////
                     44: 
                     45: urcopy_:                               / urcopy ( up, rp, cnt )
                     46:        push    si                      / register char *up;            /* SI */
                     47:        push    di                      / register struct ring *rp;     /* BX */
                     48:        push    bp                      / unsigned cnt;
                     49:        mov     bp, sp                  / {
                     50:        pushf                           /       register char *cp;      /* DI */
                     51:        push    ds                      /       register unsigned ret;  /* AX */
                     52:        push    es                      /       register unsigned n;    /* CX */
                     53:                                        /       register unsigned m;    /* DX */
                     54:        mov     si, 8(bp)               /
                     55:        mov     bx, 10(bp)              /
                     56:        mov     cx, 12(bp)              /       n  = cnt;
                     57:        mov     dx, Q_MASK(bx)          /       m  = rp->q_mask;
                     58:        les     di, Q_IX(bx)            /       cp = rp->q_ix;
                     59:        mov     ds, uds_                /
                     60:                                        /
                     61:        cld                             /
                     62: 0:     movsb                           /       do {    *cp++ = *up++;
                     63:        and     di, dx                  /               wrap(cp);
                     64:        loop    0b                      /       } while (--n != 0);
                     65:                                        /
                     66:        pop     es                      /
                     67:        pop     ds                      /
                     68:        mov     ax, 12(bp)              /       ret = cnt;
                     69:        cli                             /       s   = sphi();
                     70:        mov     Q_IX(bx), di            /       rp->q_ix = cp;
                     71:        add     Q_SIZE(bx), ax          /       rp->q_size += ret;
                     72:        popf                            /       spl( s );
                     73:        pop     bp                      /
                     74:        pop     di                      /       return ret;
                     75:        pop     si                      /
                     76:        ret                             / }
                     77: 
                     78: ////////
                     79: /
                     80: / Rucopy ( rp, up, cnt )
                     81: / struct ring * rp;
                     82: / char * up;
                     83: / unsigned cnt;
                     84: /
                     85: /      Input:  rp  = pointer to ring structure to copy data from.
                     86: /              up  = pointer to user data.
                     87: /              cnt = number of data bytes to copy.
                     88: /
                     89: /      Action: Copy CNT bytes from RP->Q_OX to UP.
                     90: /
                     91: /      Return: None.
                     92: /
                     93: ////////
                     94: 
                     95: rucopy_:                               / rucopy ( rp, up, cnt )
                     96:        push    si                      / register struct ring *rp;     /* BX */
                     97:        push    di                      / register char * up;           /* DI */
                     98:        push    bp                      / unsigned cnt;
                     99:        mov     bp, sp                  / {
                    100:        pushf                           /       register char *cp;      /* SI */
                    101:        push    ds                      /       register unsigned ret;  /* AX */
                    102:        push    es                      /       register unsigned n;    /* CX */
                    103:                                        /       register unsigned m;    /* DX */
                    104:        mov     bx, 8(bp)               /
                    105:        mov     di, 10(bp)              /
                    106:        mov     cx, 12(bp)              /
                    107:        mov     dx, Q_MASK(bx)          /       m = rp->q_mask;
                    108:        mov     es, uds_                /
                    109:        lds     si, Q_OX(bx)            /       cp = rp->q_ox;
                    110:                                        /
                    111:        cld                             /
                    112: 0:     movsb                           /       do {    *up++ = *cp++;
                    113:        and     si, dx                  /               wrap(cp);
                    114:        loop    0b                      /       } while (--cnt != 0);
                    115:                                        /
                    116:        pop     es                      /
                    117:        pop     ds                      /
                    118:        mov     ax, 12(bp)              /       ret = cnt;
                    119:        cli                             /       s   = sphi();
                    120:        mov     Q_OX(bx), si            /       rp->q_ox = cp;
                    121:        sub     Q_SIZE(bx), ax          /       rp->q_size -= ret;
                    122:        popf                            /       spl( s );
                    123:        pop     bp                      /
                    124:        pop     di                      /       return ret;
                    125:        pop     si                      /
                    126:        ret                             / }

unix.superglobalmegacorp.com

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