Deleted Added
full compact
in_cksum_arm.S (130164) in_cksum_arm.S (137463)
1/* $NetBSD: in_cksum_arm.S,v 1.2 2003/09/23 10:01:36 scw Exp $ */
2
3/*
4 * Copyright 2003 Wasabi Systems, Inc.
5 * All rights reserved.
6 *
7 * Written by Steve C. Woodford for Wasabi Systems, Inc.
8 *

--- 30 unchanged lines hidden (view full) ---

39/*
40 * Hand-optimised in_cksum() and in4_cksum() implementations for ARM/Xscale
41 */
42
43#include "opt_inet.h"
44
45#include <machine/asm.h>
46#include "assym.s"
1/* $NetBSD: in_cksum_arm.S,v 1.2 2003/09/23 10:01:36 scw Exp $ */
2
3/*
4 * Copyright 2003 Wasabi Systems, Inc.
5 * All rights reserved.
6 *
7 * Written by Steve C. Woodford for Wasabi Systems, Inc.
8 *

--- 30 unchanged lines hidden (view full) ---

39/*
40 * Hand-optimised in_cksum() and in4_cksum() implementations for ARM/Xscale
41 */
42
43#include "opt_inet.h"
44
45#include <machine/asm.h>
46#include "assym.s"
47__FBSDID("$FreeBSD: head/sys/arm/arm/in_cksum_arm.S 130164 2004-06-06 21:26:49Z phk $");
47__FBSDID("$FreeBSD: head/sys/arm/arm/in_cksum_arm.S 137463 2004-11-09 16:47:47Z cognet $");
48
49/*
50 * int in_cksum(struct mbuf *m, int len)
51 *
52 * Entry:
53 * r0 m
54 * r1 len
55 *

--- 213 unchanged lines hidden (view full) ---

269 orrne r2, r2, r6, lsl #16
270#else
271 orreq r2, r4, r5, lsl #8
272 orreq r2, r2, r6, lsl #16
273 orrne r2, r5, r4, lsl #8
274 orrne r2, r2, r6, lsl #24
275#endif
276 subs r1, r1, r7 /* Update length */
48
49/*
50 * int in_cksum(struct mbuf *m, int len)
51 *
52 * Entry:
53 * r0 m
54 * r1 len
55 *

--- 213 unchanged lines hidden (view full) ---

269 orrne r2, r2, r6, lsl #16
270#else
271 orreq r2, r4, r5, lsl #8
272 orreq r2, r2, r6, lsl #16
273 orrne r2, r5, r4, lsl #8
274 orrne r2, r2, r6, lsl #24
275#endif
276 subs r1, r1, r7 /* Update length */
277 moveq pc, lr /* All done? */
277 RETeq /* All done? */
278
279 /* Buffer is now word aligned */
280.Lcksumdata_wordaligned:
281#ifdef __XSCALE__
282 cmp r1, #0x04 /* Less than 4 bytes left? */
283 blt .Lcksumdata_endgame /* Yup */
284
285 /* Now quad-align, if necessary */

--- 75 unchanged lines hidden (view full) ---

361 adcs r2, r2, r7
362 adc r2, r2, #0x00
363 subs r1, r1, #0x40
364 bge .Lcksumdata_bigloop
365.Lcksumdata_bigloop_end:
366#endif
367
368 adds r1, r1, #0x40
278
279 /* Buffer is now word aligned */
280.Lcksumdata_wordaligned:
281#ifdef __XSCALE__
282 cmp r1, #0x04 /* Less than 4 bytes left? */
283 blt .Lcksumdata_endgame /* Yup */
284
285 /* Now quad-align, if necessary */

--- 75 unchanged lines hidden (view full) ---

361 adcs r2, r2, r7
362 adc r2, r2, #0x00
363 subs r1, r1, #0x40
364 bge .Lcksumdata_bigloop
365.Lcksumdata_bigloop_end:
366#endif
367
368 adds r1, r1, #0x40
369 moveq pc, lr
369 RETeq
370 cmp r1, #0x20
371
372#ifdef __XSCALE__
373 ldrged r4, [r0], #0x08 /* Avoid stalling pld and result */
374 blt .Lcksumdata_less_than_32
375 pld [r0, #0x18]
376 ldrd r6, [r0], #0x08
377 adds r2, r2, r4

--- 16 unchanged lines hidden (view full) ---

394 adcs r2, r2, r6
395 adcs r2, r2, r3
396 adcs r2, r2, r4
397 adcs r2, r2, r5
398 adcs r2, r2, r7
399#endif
400 adc r2, r2, #0x00
401 subs r1, r1, #0x20
370 cmp r1, #0x20
371
372#ifdef __XSCALE__
373 ldrged r4, [r0], #0x08 /* Avoid stalling pld and result */
374 blt .Lcksumdata_less_than_32
375 pld [r0, #0x18]
376 ldrd r6, [r0], #0x08
377 adds r2, r2, r4

--- 16 unchanged lines hidden (view full) ---

394 adcs r2, r2, r6
395 adcs r2, r2, r3
396 adcs r2, r2, r4
397 adcs r2, r2, r5
398 adcs r2, r2, r7
399#endif
400 adc r2, r2, #0x00
401 subs r1, r1, #0x20
402 moveq pc, lr
402 RETeq
403
404.Lcksumdata_less_than_32:
405 /* There are less than 32 bytes left */
406 and r3, r1, #0x18
407 rsb r4, r3, #0x18
408 sub r1, r1, r3
409 adds r4, r4, r4, lsr #1 /* Side effect: Clear carry flag */
410 addne pc, pc, r4

--- 26 unchanged lines hidden (view full) ---

437 ldr r4, [r0], #0x04
438 sub r1, r1, #0x04
439 adds r2, r2, r4
440 adc r2, r2, #0x00
441
442 /* Deal with < 4 bytes remaining */
443.Lcksumdata_lessthan4:
444 adds r1, r1, #0x04
403
404.Lcksumdata_less_than_32:
405 /* There are less than 32 bytes left */
406 and r3, r1, #0x18
407 rsb r4, r3, #0x18
408 sub r1, r1, r3
409 adds r4, r4, r4, lsr #1 /* Side effect: Clear carry flag */
410 addne pc, pc, r4

--- 26 unchanged lines hidden (view full) ---

437 ldr r4, [r0], #0x04
438 sub r1, r1, #0x04
439 adds r2, r2, r4
440 adc r2, r2, #0x00
441
442 /* Deal with < 4 bytes remaining */
443.Lcksumdata_lessthan4:
444 adds r1, r1, #0x04
445 moveq pc, lr
445 RETeq
446
447 /* Deal with 1 to 3 remaining bytes, possibly misaligned */
448.Lcksumdata_endgame:
449 ldrb r3, [r0] /* Fetch first byte */
450 cmp r1, #0x02
451 ldrgeb r4, [r0, #0x01] /* Fetch 2nd and 3rd as necessary */
452 movlt r4, #0x00
453 ldrgtb r5, [r0, #0x02]

--- 8 unchanged lines hidden (view full) ---

462#else
463 orreq r3, r3, r4, lsl #8
464 orreq r3, r3, r5, lsl #16
465 orrne r3, r4, r3, lsl #8
466 orrne r3, r3, r5, lsl #24
467#endif
468 adds r2, r2, r3
469 adc r2, r2, #0x00
446
447 /* Deal with 1 to 3 remaining bytes, possibly misaligned */
448.Lcksumdata_endgame:
449 ldrb r3, [r0] /* Fetch first byte */
450 cmp r1, #0x02
451 ldrgeb r4, [r0, #0x01] /* Fetch 2nd and 3rd as necessary */
452 movlt r4, #0x00
453 ldrgtb r5, [r0, #0x02]

--- 8 unchanged lines hidden (view full) ---

462#else
463 orreq r3, r3, r4, lsl #8
464 orreq r3, r3, r5, lsl #16
465 orrne r3, r4, r3, lsl #8
466 orrne r3, r3, r5, lsl #24
467#endif
468 adds r2, r2, r3
469 adc r2, r2, #0x00
470 mov pc, lr
470 RET