Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Jul 2007 11:02:16 +0800
From:      zhouyi zhou <zhouzhouyi@FreeBSD.org>
To:        zhouyi zhou <zhouzhouyi@FreeBSD.org>
Cc:        freebsd-hackers@FreeBSD.org, freebsd-current@FreeBSD.org
Subject:   Re: rewrite src/sys/i386/i386/in_cksum.c
Message-ID:  <20070709110216.459ca250.zhouzhouyi@FreeBSD.org>
In-Reply-To: <20070709105547.71827eb8.zhouzhouyi@FreeBSD.org>
References:  <20070709105547.71827eb8.zhouzhouyi@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <zhouzhouyi@FreeBSD.org> 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   }
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070709110216.459ca250.zhouzhouyi>