qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] compute checksum for roms bigger than a segmen


From: malc
Subject: Re: [Qemu-devel] [PATCH] compute checksum for roms bigger than a segment
Date: Tue, 24 Mar 2009 04:27:50 +0300 (MSK)

On Mon, 23 Mar 2009, Glauber Costa wrote:

> On Mon, Mar 23, 2009 at 9:48 PM, malc <address@hidden> 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:address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]