2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Quick'n'dirty IP checksum ...
8 * Copyright (C) 1998, 1999 Ralf Baechle
9 * Copyright (C) 1999 Silicon Graphics, Inc.
12 #include <asm/regdef.h>
16 * As we are sharing code base with the mips32 tree (which use the o32 ABI
17 * register definitions). We need to redefine the register definitions from
18 * the n64 ABI register naming to the o32 ABI register naming.
34 #define ADDC(sum,reg) \
39 #define CSUM_BIGCHUNK(src, offset, sum, _t0, _t1, _t2, _t3) \
40 lw _t0, (offset + 0x00)(src); \
41 lw _t1, (offset + 0x04)(src); \
42 lw _t2, (offset + 0x08)(src); \
43 lw _t3, (offset + 0x0c)(src); \
48 lw _t0, (offset + 0x10)(src); \
49 lw _t1, (offset + 0x14)(src); \
50 lw _t2, (offset + 0x18)(src); \
51 lw _t3, (offset + 0x1c)(src); \
59 * a1: length of the area to checksum
60 * a2: partial checksum
69 /* unknown src alignment and < 8 bytes to go */
77 /* Still a full word to go */
86 /* Still a halfword to go */
110 /* odd buffer alignment? */
119 /* Add the passed partial csum. */
124 /* ------------------------------------------------------------------------- */
132 bnez t8, small_csumcpy /* < 8 bytes to copy */
136 andi t7, src, 0x1 /* odd buffer? */
143 LONG_SUBU a1, a1, 0x1
148 PTR_ADDU src, src, 0x1
156 LONG_SUBU a1, a1, 0x2
159 PTR_ADDU src, src, 0x2
162 bnez t8, do_end_words
170 LONG_SUBU a1, a1, 0x4
172 PTR_ADDU src, src, 0x4
181 LONG_SUBU a1, a1, 0x8
184 PTR_ADDU src, src, 0x8
188 beqz t8, begin_movement
199 LONG_SUBU a1, a1, 0x10
200 PTR_ADDU src, src, 0x10
208 CSUM_BIGCHUNK(src, 0x00, sum, t0, t1, t3, t4)
209 CSUM_BIGCHUNK(src, 0x20, sum, t0, t1, t3, t4)
210 CSUM_BIGCHUNK(src, 0x40, sum, t0, t1, t3, t4)
211 CSUM_BIGCHUNK(src, 0x60, sum, t0, t1, t3, t4)
212 LONG_SUBU t8, t8, 0x01
213 bnez t8, move_128bytes
214 PTR_ADDU src, src, 0x80
221 CSUM_BIGCHUNK(src, 0x00, sum, t0, t1, t3, t4)
222 CSUM_BIGCHUNK(src, 0x20, sum, t0, t1, t3, t4)
223 PTR_ADDU src, src, 0x40
226 beqz t2, do_end_words
230 CSUM_BIGCHUNK(src, 0x00, sum, t0, t1, t3, t4)
232 PTR_ADDU src, src, 0x20
235 beqz t8, maybe_end_cruft
240 LONG_SUBU t8, t8, 0x1
243 PTR_ADDU src, src, 0x4
249 j small_csumcpy; move a1, t2 /* XXX ??? */
255 LONG_SUBU a1, a1, 0x1
257 PTR_ADDU src, src, 0x1