Annotation of Gnu-Mach/i386/i386at/if_de6s.S, revision 1.1.1.1

1.1       root        1: /* 
                      2:  * Mach Operating System
                      3:  * Copyright (c) 1992 Carnegie Mellon University
                      4:  * All Rights Reserved.
                      5:  * 
                      6:  * Permission to use, copy, modify and distribute this software and its
                      7:  * documentation is hereby granted, provided that both the copyright
                      8:  * notice and this permission notice appear in all copies of the
                      9:  * software, derivative works or modified versions, and any portions
                     10:  * thereof, and that both notices appear in supporting documentation.
                     11:  * 
                     12:  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
                     13:  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
                     14:  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
                     15:  * 
                     16:  * Carnegie Mellon requests users of this software to return to
                     17:  * 
                     18:  *  Software Distribution Coordinator  or  [email protected]
                     19:  *  School of Computer Science
                     20:  *  Carnegie Mellon University
                     21:  *  Pittsburgh PA 15213-3890
                     22:  * 
                     23:  * any improvements or extensions that they make and grant Carnegie Mellon
                     24:  * the rights to redistribute these changes.
                     25:  */
                     26: 
                     27: /* 
                     28:  * HISTORY
                     29:  * $Log: if_de6s.S,v $
                     30:  * Revision 1.1.1.1  1997/02/25 21:27:16  thomas
                     31:  * Initial source
                     32:  *
                     33:  * Revision 1.1.1.1  1996/10/30 01:39:26  thomas
                     34:  * Imported from UK22
                     35:  *
                     36: # Revision 1.3  1995/04/26  19:22:12  baford
                     37: # got alignment working right for both ELF and a.out
                     38: #
                     39: # Revision 1.2  1995/04/25  16:13:28  baford
                     40: # got kernel working with ELF build tools
                     41: #
                     42: # Revision 1.1  1994/11/08  20:47:25  baford
                     43: # merged in CMU's MK83-MK83a diffs
                     44: #
                     45:  * Revision 2.2  93/11/17  18:33:19  dbg
                     46:  *     Moved source into kernel/i386at/DLINK/if_de6c.c, since we
                     47:  *     can't release it but don't want to lose it.
                     48:  *     [93/11/17            dbg]
                     49:  * 
                     50:  * Revision 2.2.2.1  93/09/21  21:00:39  dbg
                     51:  *     <no changes>
                     52:  * 
                     53:  * Revision 2.2.1.1  93/09/03  15:06:26  dbg
                     54:  *     Created.
                     55:  *     [92/08/13            rvb]
                     56:  * 
                     57:  *
                     58:  *     File:   if_de6s.s
                     59:  *     Author: Robert V. Baron
                     60:  */
                     61: 
                     62: #include <mach/machine/asm.h>
                     63: #undef DATA
                     64: 
                     65: #include <i386at/if_de6c.h>
                     66: 
                     67:        P2ALIGN(2)
                     68: de6csetmemaddr:
                     69:        movl    8(%ebp), %ebx           /* addr */
                     70:        movb    %bl, %al                /* low byte; low nibble */
                     71:        salb    $4, %al
                     72:        orb     $(RW_ADR), %al
                     73:        outb    %al, %dx
                     74:          movl  %edi, %ecx
                     75: 0:       loop  0b
                     76: 
                     77:        movb    %bl, %al                /* low byte; high nibble */
                     78:        andb    $0xf0, %al
                     79:        orb     $(RW_ADR|STROBE), %al
                     80:        outb    %al, %dx
                     81:          movl  %edi, %ecx
                     82: 0:       loop  0b
                     83: 
                     84:        movb    %bh, %al                /* high byte; low nibble */
                     85:        salb    $4, %al
                     86:        orb     $(RW_ADR), %al
                     87:        outb    %al, %dx
                     88:          movl  %edi, %ecx
                     89: 0:       loop  0b
                     90: 
                     91:        movb    %bh, %al                /* high byte; high nibble */
                     92:        andb    $0xf0, %al
                     93:        orb     $(RW_ADR|STROBE), %al
                     94:        outb    %al, %dx
                     95:          movl  %edi, %ecx
                     96: 0:       loop  0b
                     97:        ret
                     98: 
                     99: /* de6cwriteasm(address, buf, len, port, delay) */
                    100: ENTRY(de6cwriteasm)
                    101:        pushl   %ebp
                    102:        movl    %esp, %ebp
                    103:        pushl   %edi
                    104:        pushl   %esi
                    105:        pushl   %ebx
                    106:        movl    20(%ebp), %edx          /* port */
                    107:        movl    24(%ebp), %edi          /* delay */
                    108: 
                    109:        call    de6csetmemaddr
                    110: 
                    111:        cld
                    112:        movl    16(%ebp), %ecx          /* cnt */
                    113:        movl    12(%ebp), %esi          /* source */
                    114: 
                    115:        cmpl    $1, %edi                /* no delay/latency */
                    116:        je      2f
                    117: 1:     lodsb                           /* leave delay/latency */
                    118:          pushl %ecx
                    119:          movb  %al, %bl                /* high byte; low nibble */
                    120:          salb  $4, %al
                    121:          outb  %al, %dx
                    122:            movl  %edi, %ecx
                    123: 0:         loop  0b
                    124: 
                    125:          movb  %bl, %al                /* high byte; high nibble */
                    126:          andb  $0xf0, %al
                    127:          orb   $(WRITE|STROBE), %al    /* NB: WRITE == 0 */
                    128:          outb  %al, %dx
                    129:            movl  %edi, %ecx
                    130: 0:         loop  0b
                    131:          popl  %ecx
                    132:        loop    1b
                    133: 
                    134:        popl    %ebx
                    135:        popl    %esi
                    136:        popl    %edi
                    137:        leave
                    138:        ret
                    139:                                        /* edi and ebx free */
                    140: 2:     lodsb
                    141:          movb  %al, %bl                /* high byte; low nibble */
                    142:          salb  $4, %al
                    143:          outb  %al, %dx
                    144: 
                    145:          movb  %bl, %al                /* high byte; high nibble */
                    146:          andb  $0xf0, %al
                    147:          orb   $(WRITE|STROBE), %al    /* NB: WRITE == 0 */
                    148:          outb  %al, %dx
                    149:        loop    2b
                    150: 
                    151: 6:     popl    %ebx
                    152:        popl    %esi
                    153:        popl    %edi
                    154:        leave
                    155:        ret
                    156: 
                    157: 
                    158: /* de6creadasm(address, buf, len, port, delay) */
                    159: ENTRY(de6creadasm)
                    160:        pushl   %ebp
                    161:        movl    %esp, %ebp
                    162:        pushl   %edi
                    163:        pushl   %esi
                    164:        pushl   %ebx
                    165:        movl    20(%ebp), %edx          /* port */
                    166:        movl    24(%ebp), %edi          /* delay for desetmemaddr*/
                    167:        movl    %edi, %esi              /* delay; cause edi used by stosl */
                    168: 
                    169:        call    de6csetmemaddr
                    170: 
                    171:        cld
                    172:        movl    16(%ebp), %ecx          /* cnt */
                    173:        movl    12(%ebp), %edi          /* destination */
                    174:        movw    $0x0901, %bx            /* bl = 1 = READ; bh = READ|STROBE */
                    175: 
                    176: #ifdef out_in
                    177:        cmpl    $1, %esi                /* no delay/latency */
                    178:        je      2f
                    179: #endif /* out_in */
                    180: 1:     xorw    %ax, %ax                /* leave delay/latency */
                    181:        pushl   %ecx
                    182:          movb  %bl, %al
                    183:          outb  %al, %dx
                    184:            movl  %esi, %ecx
                    185: 0:         loop  0b
                    186:           incw %dx                     /* inb from STAT == port + 1 */
                    187:           inb  %dx, %al                /* first byte high nibble goes into */
                    188:           decw %dx
                    189:          salw  $4, %ax                 /* ... low nibble formed byte */
                    190: 
                    191:          movb  %bh, %al
                    192:          outb  %al, %dx
                    193:            movl  %esi, %ecx
                    194: 0:         loop  0b
                    195:           incw %dx                     /* inb from STAT == port + 1 */
                    196:           inb  %dx, %al                /* second byte high nibble goes into */
                    197:           decw %dx
                    198:          andb  $0xf0, %al              /* ... high nibble formed byte */
                    199:          orb   %ah, %al
                    200:        stosb
                    201:        popl    %ecx
                    202:        loop    1b
                    203: 
                    204:        popl    %ebx
                    205:        popl    %esi
                    206:        popl    %edi
                    207:        leave
                    208:        ret
                    209: 
                    210: 2:     xorw    %ax, %ax                /* leave delay/latency */
                    211:          movb  %bl, %al
                    212:          outb  %al, %dx
                    213:           incw %dx                     /* inb from STAT == port + 1 */
                    214:           inb  %dx, %al                /* high nibble goes into low nibble */
                    215:           decw %dx
                    216:          salw  $4, %ax
                    217: 
                    218:          movb  %bh, %al
                    219:          outb  %al, %dx
                    220:           incw %dx                     /* inb from STAT == port + 1 */
                    221:           inb  %dx, %al
                    222:           decw %dx
                    223:          andb  $0xf0, %al
                    224:          orb   %ah, %al
                    225:        stosb
                    226:        loop    2b
                    227: 
                    228:        popl    %ebx
                    229:        popl    %esi
                    230:        popl    %edi
                    231:        leave
                    232:        ret
                    233: 
                    234: 
                    235: #ifdef unroll_wins
                    236:        unrolled loop for write iff no delay
                    237: 2:     lodsl
                    238:          movl  %eax, %ebx              /* byte one; low nibble */
                    239:          salb  $4, %al
                    240:          outb  %al, %dx
                    241: 
                    242:          movb  %bl, %al                /* byte one; high nibble */
                    243:          andb  $0xf0, %al
                    244:          orb   $8, %al
                    245:          outb  %al, %dx
                    246: loop   3f
                    247: jmp    6f
                    248: 3:       sarl  $8, %ebx
                    249:          movb  %bl, %al                /* byte two; low nibble */
                    250:          salb  $4, %al
                    251:          outb  %al, %dx
                    252: 
                    253:          movb  %bl, %al                /* byte two; high nibble */
                    254:          andb  $0xf0, %al
                    255:          orb   $8, %al
                    256:          outb  %al, %dx
                    257: loop   4f
                    258: jmp    6f
                    259: 4:       sarl  $8, %ebx
                    260:          movb  %bl, %al                /* byte three; low nibble */
                    261:          salb  $4, %al
                    262:          outb  %al, %dx
                    263: 
                    264:          movb  %bl, %al                /* byte three; high nibble */
                    265:          andb  $0xf0, %al
                    266:          orb   $8, %al
                    267:          outb  %al, %dx
                    268: loop   5f
                    269: jmp    6f
                    270: 5:       sarl  $8, %ebx
                    271:          movb  %bl, %al                /* byte three; low nibble */
                    272:          salb  $4, %al
                    273:          outb  %al, %dx
                    274: 
                    275:          movb  %bl, %al                /* byte four; high nibble */
                    276:          andb  $0xf0, %al
                    277:          orb   $8, %al
                    278:          outb  %al, %dx
                    279:        loop    2b
                    280: #endif /* unroll_wins */
                    281: 

unix.superglobalmegacorp.com

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