From owner-cvs-src@FreeBSD.ORG Fri Jun 27 20:25:13 2008 Return-Path: Delivered-To: cvs-src@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC8A81065675 for ; Fri, 27 Jun 2008 20:25:13 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.freebsd.org (Postfix) with SMTP id 592298FC28 for ; Fri, 27 Jun 2008 20:25:13 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: (qmail invoked by alias); 27 Jun 2008 19:58:32 -0000 Received: from p54A3C7AC.dip.t-dialin.net (EHLO tron.homeunix.org) [84.163.199.172] by mail.gmx.net (mp039) with SMTP; 27 Jun 2008 21:58:32 +0200 X-Authenticated: #1673122 X-Provags-ID: V01U2FsdGVkX18bQy4wZ08bl4JA9LXXqpnPs5qVH5vEvLuMreF81B bVafjdO/WuaneR Message-ID: <48654667.1040401@gmx.de> Date: Fri, 27 Jun 2008 21:58:31 +0200 From: Christoph Mallon User-Agent: Thunderbird 2.0.0.9 (X11/20071230) MIME-Version: 1.0 To: Marius Strobl References: <200806252105.m5PL5AUp064418@repoman.freebsd.org> In-Reply-To: <200806252105.m5PL5AUp064418@repoman.freebsd.org> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/sparc64/include in_cksum.h X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jun 2008 20:25:14 -0000 Marius Strobl wrote: > marius 2008-06-25 21:04:59 UTC > > FreeBSD src repository > > Modified files: > sys/sparc64/include in_cksum.h > Log: > SVN rev 180011 on 2008-06-25 21:04:59Z by marius > > 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 This approach seems wrong to me and I think it works only by chance. The condition codes ("cc") should be added to the clobbered list of the asm statement instead of making the statement volatile: __asm("..." : $OUT : $IN : "cc"); This very case is also mentioned in the GCC documentation: "If your assembler instruction can alter the condition code register, add `cc' to the list of clobbered registers. GCC on some machines represents the condition codes as a specific hardware register; `cc' serves to name this register. On other machines, the condition code is handled differently, and specifying `cc' has no effect. But it is valid no matter what the machine." (Section 5.35 Assembler Instructions with C Expression Operands) I wrote a letter directly to Marius about this issue two days ago, but I got no response so far. Because this change has a MFC after 3 days, I'm writing to this list. Regards Christoph