Date: Sat, 22 Jun 2002 15:35:53 -0700 (PDT) From: John Polstra <jdp@FreeBSD.org> To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/sys/i386/i386 in_cksum.c src/sys/i386/include in_cksum.h Message-ID: <200206222235.g5MMZrd58098@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
jdp 2002/06/22 15:35:53 PDT
Modified files:
sys/i386/i386 in_cksum.c
sys/i386/include in_cksum.h
Log:
Fix several bugs in the i386 asm statements used to speed up Internet
checksumming. These bugs could possibly cause bad code to be
generated at elevated optimization levels.
First, eliminate the use of preprocessor magic to form the address
fields of asm instructions. It hid the actual addresses being
referenced from the compiler. Without knowledge of all the data
dependencies, the compiler might possibly use optimizations which
would result in incorrect code.
Use "__asm __volatile" rather than "__asm" for instruction sequences
that pass information through the condition codes (the carry bit, in
this case). Without __volatile, the compiler might add unrelated
code between consecutive __asm instructions, modifying the condition
codes. I have seen GCC insert stack pointer adjustments in this
way, for example. Unfortunately, GCC doesn't provide a way to
specify dependencies on the condition codes. You can specify that
they are clobbered, but not that you are going to use them as input.
Finally, simplify the LOAD macro. This macro is used as a poor
man's prefetch. The simpler version gives the compiler more leeway
about just how it performs the prefetch.
MFC after: 1 week
Revision Changes Path
1.24 +13 -6 src/sys/i386/i386/in_cksum.c
1.13 +14 -11 src/sys/i386/include/in_cksum.h
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200206222235.g5MMZrd58098>
