Print this page
de-linting of .s files


  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 #ident  "%Z%%M% %I%     %E% SMI"
  28 
  29 #include <sys/asm_linkage.h>
  30 
  31 #if defined(lint)
  32 #include <sys/types.h>
  33 #endif  /* lint */
  34 
  35 /*
  36  * ip_ocsum(address, halfword_count, sum)
  37  * Do a 16 bit one's complement sum of a given number of (16-bit)
  38  * halfwords. The halfword pointer must not be odd.
  39  *      %o0 address; %o1 count; %o2 sum accumulator; %o4 temp
  40  *      %g2 and %g3 used in main loop
  41  *
  42  * (from @(#)ocsum.s 1.3 89/02/24 SMI)
  43  *
  44  */
  45 
  46 #if defined(lint) 
  47 
  48 /* ARGSUSED */
  49 unsigned int
  50 ip_ocsum(u_short *address, int halfword_count, unsigned int sum)
  51 { return (0); }
  52 
  53 #else   /* lint */
  54 
  55         ENTRY(ip_ocsum)
  56         cmp     %o1, 31         ! less than 62 bytes?
  57         bl,a    .dohw           !   just do halfwords
  58         tst     %o1             ! delay slot, test count
  59 
  60         btst    31, %o0         ! (delay slot)
  61         bz      2f              ! if 32 byte aligned, skip
  62         nop
  63 
  64         !
  65         ! Do first halfwords until 32-byte aligned
  66         !
  67 1:
  68         lduh    [%o0], %g2      ! read data
  69         add     %o0, 2, %o0     ! increment address
  70         add     %o2, %g2, %o2   ! add to accumulator, don't need carry yet
  71         btst    31, %o0         ! 32 byte aligned?
  72         bnz     1b
  73         sub     %o1, 1, %o1     ! decrement count
  74         !


 107 3:
 108         add     %o0, 2, %o0     ! increment address
 109         addcc   %o2, %g2, %o2   ! add to accumulator
 110         addxcc  %o2, 0, %o2     ! if carry, add it in
 111         subcc   %o1, 1, %o1     ! decrement count
 112 .dohw:
 113         bg,a    3b              ! more to do?
 114         lduh    [%o0], %g2      ! read data
 115 
 116         !
 117         ! at this point the 32-bit accumulator
 118         ! has the result that needs to be returned in 16-bits
 119         !
 120         sll     %o2, 16, %o4    ! put low halfword in high halfword %o4
 121         addcc   %o4, %o2, %o2   ! add the 2 halfwords in high %o2, set carry
 122         srl     %o2, 16, %o2    ! shift to low halfword
 123         retl                    ! return
 124         addxcc  %o2, 0, %o0     ! add in carry if any. result in %o0
 125         SET_SIZE(ip_ocsum)
 126 
 127 #endif  /* lint */


  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 #ident  "%Z%%M% %I%     %E% SMI"
  28 
  29 #include <sys/asm_linkage.h>
  30 




  31 /*
  32  * ip_ocsum(address, halfword_count, sum)
  33  * Do a 16 bit one's complement sum of a given number of (16-bit)
  34  * halfwords. The halfword pointer must not be odd.
  35  *      %o0 address; %o1 count; %o2 sum accumulator; %o4 temp
  36  *      %g2 and %g3 used in main loop
  37  *
  38  * (from @(#)ocsum.s 1.3 89/02/24 SMI)
  39  *
  40  */
  41 









  42         ENTRY(ip_ocsum)
  43         cmp     %o1, 31         ! less than 62 bytes?
  44         bl,a    .dohw           !   just do halfwords
  45         tst     %o1             ! delay slot, test count
  46 
  47         btst    31, %o0         ! (delay slot)
  48         bz      2f              ! if 32 byte aligned, skip
  49         nop
  50 
  51         !
  52         ! Do first halfwords until 32-byte aligned
  53         !
  54 1:
  55         lduh    [%o0], %g2      ! read data
  56         add     %o0, 2, %o0     ! increment address
  57         add     %o2, %g2, %o2   ! add to accumulator, don't need carry yet
  58         btst    31, %o0         ! 32 byte aligned?
  59         bnz     1b
  60         sub     %o1, 1, %o1     ! decrement count
  61         !


  94 3:
  95         add     %o0, 2, %o0     ! increment address
  96         addcc   %o2, %g2, %o2   ! add to accumulator
  97         addxcc  %o2, 0, %o2     ! if carry, add it in
  98         subcc   %o1, 1, %o1     ! decrement count
  99 .dohw:
 100         bg,a    3b              ! more to do?
 101         lduh    [%o0], %g2      ! read data
 102 
 103         !
 104         ! at this point the 32-bit accumulator
 105         ! has the result that needs to be returned in 16-bits
 106         !
 107         sll     %o2, 16, %o4    ! put low halfword in high halfword %o4
 108         addcc   %o4, %o2, %o2   ! add the 2 halfwords in high %o2, set carry
 109         srl     %o2, 16, %o2    ! shift to low halfword
 110         retl                    ! return
 111         addxcc  %o2, 0, %o0     ! add in carry if any. result in %o0
 112         SET_SIZE(ip_ocsum)
 113