From owner-freebsd-current@FreeBSD.ORG Mon Jul 9 03:14:13 2007 Return-Path: X-Original-To: freebsd-current@FreeBSD.org Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2F83316A46D for ; Mon, 9 Jul 2007 03:14:13 +0000 (UTC) (envelope-from zhouzhouyi@FreeBSD.org) Received: from ercist.iscas.ac.cn (ercist.iscas.ac.cn [124.16.138.3]) by mx1.freebsd.org (Postfix) with SMTP id CA04813C46A for ; Mon, 9 Jul 2007 03:14:11 +0000 (UTC) (envelope-from zhouzhouyi@FreeBSD.org) Received: (qmail 57435 invoked by uid 98); 9 Jul 2007 03:05:00 -0000 Received: from 222.191.237.170 by ercist.iscas.ac.cn (envelope-from , uid 89) with qmail-scanner-1.25 (spamassassin: 3.1.0. Clear:RC:1(222.191.237.170):SA:0(0.0/10.0):. Processed in 12.211863 secs); 09 Jul 2007 03:05:00 -0000 X-Spam-Status: No, hits=0.0 required=10.0 X-Qmail-Scanner-Mail-From: zhouzhouyi@FreeBSD.org via ercist.iscas.ac.cn X-Qmail-Scanner: 1.25 (Clear:RC:1(222.191.237.170):SA:0(0.0/10.0):. Processed in 12.211863 secs) Received: from unknown (HELO zzy.H.qngy.gscas) (zhouzhouyi@ercist.iscas.ac.cn@222.191.237.170) by 0 with SMTP; 9 Jul 2007 03:04:48 -0000 Date: Mon, 9 Jul 2007 11:02:16 +0800 From: zhouyi zhou To: zhouyi zhou Message-Id: <20070709110216.459ca250.zhouzhouyi@FreeBSD.org> In-Reply-To: <20070709105547.71827eb8.zhouzhouyi@FreeBSD.org> References: <20070709105547.71827eb8.zhouzhouyi@FreeBSD.org> Organization: Institute of Software X-Mailer: Sylpheed version 1.0.4 (GTK+ 1.2.10; i386-portbld-freebsd5.4) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@FreeBSD.org, freebsd-current@FreeBSD.org Subject: Re: rewrite src/sys/i386/i386/in_cksum.c X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2007 03:14:13 -0000 Sorry, previously send the preprocessed version of in_cksum.c: What really needs to be replaced is for example: 408 if (mlen >= 16) { 409 ADD(0); 410 ADDC(4); 411 ADDC(8); 412 ADDC(12); 413 MOP; 414 w += 8; 415 mlen -= 16; 416 } On Mon, 9 Jul 2007 10:55:47 +0800 zhouyi zhou wrote: > Hey, > Since FreeBSD update gcc from 3.4.x to 4.2.0, the FreeBSD gdb remote debugger in i386 platform > will find the TCP/UPD checksum will not be computed right, when calling macro in_cksum > which calls in_cksum_skip in src/sys/i386/i386/in_cksum.c in case of getting rid of -O flag > supplied to gcc when compiling(The optimize will interfere with comfortable gdb debugging). > > The reason is for example in src/sys/i386/i386/in_cksum.c: > 126 if (mlen >= 16) { > 127 __asm volatile ("addl %1, %0" : "+r" (sum) : "g" (((const unsigned int *)w)[0 / 4])); > 128 __asm volatile ("adcl %1, %0" : "+r" (sum) : "g" (((const unsigned int *)w)[4 / 4])); > 129 __asm volatile ("adcl %1, %0" : "+r" (sum) : "g" (((const unsigned int *)w)[8 / 4])); > 130 __asm volatile ("adcl %1, %0" : "+r" (sum) : "g" (((const unsigned int *)w)[12 / 4])); > 131 __asm volatile ("adcl $0, %0" : "+r" (sum)); > 132 w += 8; > 133 mlen -= 16; > 134 } >