summaryrefslogtreecommitdiffstats
path: root/sys/sparc64
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2008-06-25 21:04:59 +0000
committermarius <marius@FreeBSD.org>2008-06-25 21:04:59 +0000
commit762f29e950fd1511beb76c95c5014bb779d4f5ed (patch)
tree21030df4cb541765bdaedd12c3aa316481b0b10e /sys/sparc64
parentae81de5ecb29ad447d9bdb8bacda9a37a92a4ed6 (diff)
downloadFreeBSD-src-762f29e950fd1511beb76c95c5014bb779d4f5ed.zip
FreeBSD-src-762f29e950fd1511beb76c95c5014bb779d4f5ed.tar.gz
Use "__asm __volatile" rather than "__asm" for instruction sequences
that modify condition codes (the carry bit, in this case). Without "__volatile", the compiler might add the inline assembler instructions between unrelated code which also uses condition codes, modifying the latter. This prevents the TCP pseudo header checksum calculation done in tcp_output() from having effects on other conditions when compiled with GCC 4.2.1 at "-O2" and "options INET6" left out. [1] Reported & tested by: Boris Kochergin [1] MFC after: 3 days
Diffstat (limited to 'sys/sparc64')
-rw-r--r--sys/sparc64/include/in_cksum.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/sparc64/include/in_cksum.h b/sys/sparc64/include/in_cksum.h
index 2e46f46..ad08585 100644
--- a/sys/sparc64/include/in_cksum.h
+++ b/sys/sparc64/include/in_cksum.h
@@ -63,7 +63,7 @@
#include <sys/cdefs.h>
-#define in_cksum(m, len) in_cksum_skip(m, len, 0)
+#define in_cksum(m, len) in_cksum_skip(m, len, 0)
static __inline void
in_cksum_update(struct ip *ip)
@@ -79,7 +79,7 @@ in_addword(u_short sum, u_short b)
{
u_long __ret, __tmp;
- __asm(
+ __asm __volatile(
"sll %2, 16, %0\n"
"sll %3, 16, %1\n"
"addcc %0, %1, %0\n"
@@ -93,8 +93,8 @@ static __inline u_short
in_pseudo(u_int sum, u_int b, u_int c)
{
u_long __tmp;
-
- __asm(
+
+ __asm __volatile(
"addcc %0, %3, %0\n"
"addccc %0, %4, %0\n"
"addc %0, 0, %0\n"
@@ -121,11 +121,11 @@ in_cksum_hdr(struct ip *ip)
* a generic implementation for both in_cksum_skip and in_cksum_hdr
* should not be too much more expensive.
*/
-#define __LD_ADD(addr, tmp, sum, offs, mod) \
- "lduw [" #addr " + " #offs "], " #tmp "\n" \
+#define __LD_ADD(addr, tmp, sum, offs, mod) \
+ "lduw [" #addr " + " #offs "], " #tmp "\n" \
"add" # mod " " #sum ", " #tmp ", " #sum "\n"
- __asm(
+ __asm __volatile(
"and %5, 3, %3\n"
"andn %5, 3, %1\n"
"brz,pt %3, 0f\n"
OpenPOWER on IntegriCloud