qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: malc <av1474@comtv.ru>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] compute checksum for roms bigger than a segment
Date: Tue, 24 Mar 2009 04:27:50 +0300 (MSK)	[thread overview]
Message-ID: <Pine.LNX.4.64.0903240421100.7610@linmac.oyster.ru> (raw)
In-Reply-To: <5d6222a80903231802r648aa025ieef9f61008fd1a37@mail.gmail.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1150 bytes --]

On Mon, 23 Mar 2009, Glauber Costa wrote:

> On Mon, Mar 23, 2009 at 9:48 PM, malc <av1474@comtv.ru> wrote:
> > On Mon, 23 Mar 2009, Glauber Costa wrote:
> >
> >>    xor  ax, ax
> >>    xor  bx, bx
> >>    xor  cx, cx
> >> +  xor  dx, dx
> >> +
> >>    mov  ch, [2]
> >>    shl  cx, #1
> >> +
> >> +  jnc checksum_loop
> >> +  mov  dx, cx
> >> +  mov  cx, #0xffff
> >
> >     xchg dx, cx
> >     dec  cx
> >
> >> +
> >>  checksum_loop:
> >>    add  al, [bx]
> >>    inc  bx
> >>    loop checksum_loop
> >> +
> >> +  cmp  dx, #0
> >
> >     test dx, dx
> 
> ok.
> 
> >
> >> +  je checksum_out
> >> +
> >> +  add  al, [bx]
> >
> >     DS:[0] is added twice, intended?
> it's not DS:[0]. It's the last byte from the previous segment that is
> not caught by the loop
> Note it happens before cleaning bx and increasing cs. It works with
> it, does not without it.

Yes missed that.

> >
> >> +  mov  cx, dx
> >> +  mov  dx, ds
> >> +  add  dx, #0x1000
> >
> >     add  dh, #0x10
> 
> Why is it preferred?

Same reason test and xchg/dec were proposed - takes less space.

-- 
mailto:av1474@comtv.ru

  reply	other threads:[~2009-03-24  1:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-23 23:23 [Qemu-devel] [PATCH] compute checksum for roms bigger than a segment Glauber Costa
2009-03-24  0:48 ` malc
2009-03-24  1:02   ` Glauber Costa
2009-03-24  1:27     ` malc [this message]
2009-03-24  1:53   ` Glauber Costa
2009-03-24  3:14     ` malc
  -- strict thread matches above, loose matches on Subject: below --
2009-03-25 15:06 Glauber Costa
2009-03-23 21:55 Glauber Costa

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=Pine.LNX.4.64.0903240421100.7610@linmac.oyster.ru \
    --to=av1474@comtv.ru \
    --cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).