From: Dave A. <ai...@us...> - 2001-03-03 02:16:55
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/vax/lib In directory usw-pr-cvs1:/tmp/cvs-serv16746 Modified Files: Makefile Added Files: checksum.S Removed Files: checksum.c Log Message: DA: My implementation of csum_partial.. seems to work ...removed checksum.c no longer needed --- NEW FILE --- /* $Id: checksum.S,v 1.1 2001/03/03 02:18:22 airlied Exp $ * * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * IP/TCP/UDP checksumming routines * * Authors: Jorge Cwik, <jo...@la...> * Arnt Gulbrandsen, <ag...@nv...> * Tom May, <ft...@ne...> * Pentium Pro/II routines: * Alexander Kjeldaas <as...@gu...> * Finn Arne Gangstad <fi...@gu...> * Lots of code moved from tcp.c and ip.c; see those files * for more names. * * Changes: Ingo Molnar, converted csum_partial_copy() to 2.1 exception * handling. * Andi Kleen, add zeroing on error * converted to pure assembler * * SuperH version: Copyright (C) 1999 Niibe Yutaka * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ /* VAX Hackery - Copyright (C) 2001 Dave Airlie <ai...@li...> Thanks to ragge for giving me info on calling conventions */ #include <asm/errno.h> #include <linux/linkage.h> /* * computes a partial checksum, e.g. for TCP/UDP fragments */ /* * unsigned int csum_partial(const unsigned char *buf, int len, * unsigned int sum); */ .text ENTRY(csum_partial) .word 0x3e movl 4(ap), r2 /* r2 now has buf */ movl 8(ap), r3 /* r3 has len */ movl 12(ap), r0 /* r4 has sum */ /* test stuff */ # Check Alignment # Jump if it okay # Alignment uses up two bytes # Jump if we have two bytes # something < 2 deal with it bbc $1, r2, 2f # Check is bit 1 , jump if clear subl2 $2, r3 # Alignment uses up 2 bytes bgequ 1f # Jump if we have at least two bytes addl2 $2, r3 # Deal with it if we haven't jmp 6f 1: /* If here copy halfword, and checksum it, */ addw2 (r2), r0 # Add the half double-word to r0 adwc $0, r0 # Carry addl2 $2, r2 # move pointer on two bytes 2: /* Get 32-bit word count and do 3 checksum on it */ /* if 0 count jump over it */ # divl3 $32, r3, r5 ashl $-5, r3, r5 beqlu 4f 3: addl2 (r2), r0 # Checksum 32 bytes adwc 4(r2), r0 adwc 8(r2), r0 adwc 12(r2), r0 adwc 16(r2), r0 adwc 20(r2), r0 adwc 24(r2), r0 adwc 28(r2), r0 adwc $0, r0 addl2 $32, r2 sobgtr r5,3b /* jump not equal back to 3b*/ 4: bicl3 $0xFFFFFFE3, r3, r5 /* D.A. My method for an AND, AND r3 with 0x1C (00011100) */ /* this put in r5 a value of 4, 8, 12, 16, 20, 24, 28 bytes */ beqlu 6f /* rotate r5 by -2 gives 1, 2, 3, 4, 5, 6, 7 */ rotl $-2, r5, r5 5: addl2 (r2), r0 /* Add in long from R2 */ adwc $0, r0 /* Add in carry */ addl2 $4, r2 /* move r2 pointer along 4 bytes */ sobgtr r5, 5b /* jump to 5: if r5 is > 0 */ 6: bicl3 $0xFFFFFFFC, r3, r5 /* AND either 1 or 2 into r5 */ beqlu 9f /* if no further bytes we are finished */ cmpl $2, r5 /* compare what we have left with 2 */ blssu 7f /* if 2 or greater go to 7f */ movw (r2), r3 /* move a word into r3 */ addl2 $2, r2 /* move r2 on two bytes */ cmpl $2, r5 beqlu 8f /* if what are we checking here?? */ rotl $16, r3, r3 /* rotate r3 by a half word. */ bicl2 $0xFFFF, r3 /* AND off bottom half */ 7: addb2 (r2), r3 /* ADD Byte from R2 to R3 */ 8: addl2 r3, r0 /* Add Long R3 */ adwc $0, r0 /* Add in any carry */ 9: ret Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/lib/Makefile,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- Makefile 2001/02/25 00:37:31 1.6 +++ Makefile 2001/03/03 02:18:22 1.7 @@ -7,6 +7,12 @@ # # Note 2! The CFLAGS definitions are now in the main makefile... +.S.s: + $(CPP) $(AFLAGS) -traditional -o $*.o $< + +.S.o: + $(CC) $(AFLAGS) -traditional -c -o $*.o $< + all: libio.a L_TARGET := libio.a --- checksum.c DELETED --- |