Print this page
de-linting of .s files
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/sparc/ml/ip_ocsum.s
+++ new/usr/src/uts/sparc/ml/ip_ocsum.s
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License, Version 1.0 only
6 6 * (the "License"). You may not use this file except in compliance
7 7 * with the License.
8 8 *
9 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 * or http://www.opensolaris.org/os/licensing.
11 11 * See the License for the specific language governing permissions
12 12 * and limitations under the License.
13 13 *
14 14 * When distributing Covered Code, include this CDDL HEADER in each
15 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 * If applicable, add the following below this CDDL HEADER, with the
17 17 * fields enclosed by brackets "[]" replaced with your own identifying
18 18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 19 *
20 20 * CDDL HEADER END
↓ open down ↓ |
20 lines elided |
↑ open up ↑ |
21 21 */
22 22 /*
23 23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 25 */
26 26
27 27 #ident "%Z%%M% %I% %E% SMI"
28 28
29 29 #include <sys/asm_linkage.h>
30 30
31 -#if defined(lint)
32 -#include <sys/types.h>
33 -#endif /* lint */
34 -
35 31 /*
36 32 * ip_ocsum(address, halfword_count, sum)
37 33 * Do a 16 bit one's complement sum of a given number of (16-bit)
38 34 * halfwords. The halfword pointer must not be odd.
39 35 * %o0 address; %o1 count; %o2 sum accumulator; %o4 temp
40 36 * %g2 and %g3 used in main loop
41 37 *
42 38 * (from @(#)ocsum.s 1.3 89/02/24 SMI)
43 39 *
44 40 */
45 41
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 42 ENTRY(ip_ocsum)
56 43 cmp %o1, 31 ! less than 62 bytes?
57 44 bl,a .dohw ! just do halfwords
58 45 tst %o1 ! delay slot, test count
59 46
60 47 btst 31, %o0 ! (delay slot)
61 48 bz 2f ! if 32 byte aligned, skip
62 49 nop
63 50
64 51 !
65 52 ! Do first halfwords until 32-byte aligned
66 53 !
67 54 1:
68 55 lduh [%o0], %g2 ! read data
69 56 add %o0, 2, %o0 ! increment address
70 57 add %o2, %g2, %o2 ! add to accumulator, don't need carry yet
71 58 btst 31, %o0 ! 32 byte aligned?
72 59 bnz 1b
73 60 sub %o1, 1, %o1 ! decrement count
74 61 !
75 62 ! loop to add in 32 byte chunks
76 63 ! The loads and adds are staggered to help avoid load/use
77 64 ! interlocks on highly pipelined implementations, and double
78 65 ! loads are used for 64-bit wide memory systems.
79 66 !
80 67 2:
81 68 sub %o1, 16, %o1 ! decrement count to aid testing
82 69 4:
83 70 ldd [%o0], %g2 ! read data
84 71 ldd [%o0+8], %o4 ! read more data
85 72 addcc %o2, %g2, %o2 ! add to accumulator
86 73 addxcc %o2, %g3, %o2 ! add to accumulator with carry
87 74 ldd [%o0+16], %g2 ! read more data
88 75 addxcc %o2, %o4, %o2 ! add to accumulator with carry
89 76 addxcc %o2, %o5, %o2 ! add to accumulator with carry
90 77 ldd [%o0+24], %o4 ! read more data
91 78 addxcc %o2, %g2, %o2 ! add to accumulator with carry
92 79 addxcc %o2, %g3, %o2 ! add to accumulator with carry
93 80 addxcc %o2, %o4, %o2 ! add to accumulator
94 81 addxcc %o2, %o5, %o2 ! add to accumulator with carry
95 82 addxcc %o2, 0, %o2 ! if final carry, add it in
96 83 subcc %o1, 16, %o1 ! decrement count (in halfwords)
97 84 bge 4b
98 85 add %o0, 32, %o0 ! delay slot, increment address
99 86
100 87 add %o1, 16, %o1 ! add back in
101 88 !
102 89 ! Do any remaining halfwords
103 90 !
104 91 b .dohw
105 92 tst %o1 ! delay slot, for more to do
106 93
107 94 3:
108 95 add %o0, 2, %o0 ! increment address
109 96 addcc %o2, %g2, %o2 ! add to accumulator
110 97 addxcc %o2, 0, %o2 ! if carry, add it in
111 98 subcc %o1, 1, %o1 ! decrement count
112 99 .dohw:
113 100 bg,a 3b ! more to do?
114 101 lduh [%o0], %g2 ! read data
115 102
116 103 !
↓ open down ↓ |
52 lines elided |
↑ open up ↑ |
117 104 ! at this point the 32-bit accumulator
118 105 ! has the result that needs to be returned in 16-bits
119 106 !
120 107 sll %o2, 16, %o4 ! put low halfword in high halfword %o4
121 108 addcc %o4, %o2, %o2 ! add the 2 halfwords in high %o2, set carry
122 109 srl %o2, 16, %o2 ! shift to low halfword
123 110 retl ! return
124 111 addxcc %o2, 0, %o0 ! add in carry if any. result in %o0
125 112 SET_SIZE(ip_ocsum)
126 113
127 -#endif /* lint */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX