From: Harry Kalogirou <harkal@gmx.net>
To: jb1@btstream.com
Cc: Linux-8086 <linux-8086@vger.kernel.org>
Subject: Re: [SOLVED] Re: webserver stalls [was Re: bug in (linux) slattach]
Date: 23 Oct 2002 14:42:25 +0300 [thread overview]
Message-ID: <1035372121.2230.30.camel@cool> (raw)
In-Reply-To: <Pine.LNX.4.33.0210230153270.12560-100000@olympus.btstream.com>
> Maybe not. I found ip.c Version 1.9 by browsing the CVS repository and, as
> far as I can tell, the only change was that you moved the first "dec cx";
> this will have *no* effect. The algorithm can still fail if the carry flag
> happens to be set going into the routine, or if there is a carry generated
> the last time "adc [di]" is executed. I suggest something like this for
> _ip_calc_chksum:
>
> push bp
> mov bp,sp
> push di
>
> mov cx, 6[bp]
> sar cx, 1
> dec cx
> xor ax,ax ; clear carry flag (as well as AX)
> mov di, 4[bp]
> mov ax, [di]
> inc di
> inc di
> loop1:
> adc ax, [di]
> inc di
> inc di
>
> loop loop1; ; a byte shorter and a clock faster
> ; than DEC CX/JNZ LOOP1
>
> adc ax,0 ; add (just) the final carry
> not ax
>
> pop di
> pop bp
>
> ret
>
You can't be more right 8). I just thought I could get away without
opening the 8086 instruction manual, and I just made bad assumptions
about when the carry flag is cleared.
The CVS now contains all your bugfixes (clear carry before entering the loop,
adding last carry), the use of "loop" and I also unrolled the
loop once. A code review would be gladly appreciated.
> Of course, this algorithm is valid only if the length (6[bp]) is an even
> number of bytes. While this is always true for IP headers, for TCP packet
> checksums there would have to be a final test of the length's low bit and
> appropriate handling of an additional odd byte.
TCP uses another routine.
Harry
next prev parent reply other threads:[~2002-10-23 11:42 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1035036158.454.17.camel@cool>
2002-10-20 9:34 ` webserver stalls [was Re: bug in (linux) slattach] jb1
2002-10-20 17:06 ` Harry Kalogirou
2002-10-21 9:44 ` jb1
2002-10-21 9:55 ` Harry Kalogirou
2002-10-22 10:16 ` jb1
2002-10-22 13:56 ` Harry Kalogirou
2002-10-22 13:57 ` [SOLVED] " Harry Kalogirou
2002-10-22 16:02 ` Harry Kalogirou
2002-10-23 9:37 ` jb1
2002-10-23 11:42 ` Harry Kalogirou [this message]
2002-10-24 8:55 ` jb1
2002-10-29 10:25 ` jb1
2002-10-29 12:37 ` Harry Kalogirou
[not found] <Pine.LNX.4.33.0210300110270.32451-100000@olympus.btstream.com>
2002-10-30 10:31 ` Harry Kalogirou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1035372121.2230.30.camel@cool \
--to=harkal@gmx.net \
--cc=jb1@btstream.com \
--cc=linux-8086@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox