Subject: Re: VAX code generation problem wrt IPSEC?
To: Johnny Billquist <email@example.com>
From: Olaf Seibert <firstname.lastname@example.org>
Date: 11/12/2001 23:36:52
I am trying to find out how long this code has been this way. According
to cvsweb, these assembler calls have "always" been like that (that is,
since 2 april 1996). NetBSD's version is apparently derived from
"@(#)in_cksum.c 8.1 (Berkeley) 6/10/93".
So I started looking through my copy of the PUPS archive, and I found
(strangely enough) the file
PUPS/Archive/Trees/2.11BSD/usr/src/usr.sbin/timed/vax/cksum.c with SCCS
tag "@(#)cksum.c 1.2 (Berkeley) 9/18/85";
It has not been gcc-ified yet because it just contains asm("adwc
(r9)+,r8;"); for the addition (thereby strongly depending on the
compiler specifics), and also other things clearly show it as a an
earlier version of in_cksum.c.
I found "@(#)in_cksum.c 7.6 (Berkeley) 12/16/90" in
usr/src/sys/vax/vax/in_cksum.c and it is more or less the same as the
one from 2.11BSD.
I recommend adding some of the original comments back into the source:
* Do as much of the checksum as possible 32 bits at at time.
* In fact, this loop is unrolled to make overhead from
* branches &c small.
* We can do a 16 bit ones complement sum 32 bits at a time
* because the 32 bit register is acting as two 16 bit
* registers for adding, with carries from the low added
* into the high (by normal carry-chaining) and carries
* from the high carried into the low on the next word
* by use of the adwc instruction. This lets us run
* this loop at almost memory speed.
* Here there is the danger of high order carry out, and
* we carefully use adwc.
The Net2 release also contains version 7.6 of 12/16/90. I haven't been
able to find a newer version. I wanted to look at the Quasiarus sources
but the .Z files were apparently not .Z files and therefore unreadable.
___ Olaf 'Rhialto' Seibert - rhialto@polder --They that can give up essential
\X/ land.nl --liberty to purchase a little temporary safety
--------------deserve neither liberty or safety. - Benjamin Franklin, 1759
---People will accept your ideas much more readily if you tell them that
---Benjamin Franklin said it first. - Unknown