qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Glauber Costa <glommer@gmail.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] compute checksum for roms bigger than a segment
Date: Mon, 23 Mar 2009 22:53:40 -0300	[thread overview]
Message-ID: <5d6222a80903231853l1331de5brea477b0801dabfff@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0903240341080.4172@linmac.oyster.ru>

On Mon, Mar 23, 2009 at 9:48 PM, malc <av1474@comtv.ru> wrote:
> On Mon, 23 Mar 2009, Glauber Costa wrote:
>
>> Some option roms (e1000 provided by gpxe project as an example)
>> are bigger than a segment. The current algorithm to compute the
>> checksum fails in such case. To proper compute the checksum, this
>> patch deals with the possibility of the rom's size crossing a
>> segment border.
>>
>> We don't need to worry about it crossing more than one segment
>> border, since the option roms format only save one byte to store
>> the image size (thus, maximum size = 0xff = 128k = 2 segments)
>>
>> Signed-off-by: Glauber Costa <glommer@redhat.com>
>> ---
>>  bios/rombios.c |   33 +++++++++++++++++++++++++++------
>>  1 files changed, 27 insertions(+), 6 deletions(-)
>>
>> diff --git a/bios/rombios.c b/bios/rombios.c
>> index bc43251..6fede17 100644
>> --- a/bios/rombios.c
>> +++ b/bios/rombios.c
>> @@ -10162,22 +10162,43 @@ no_serial:
>>    ret
>>
>>  rom_checksum:
>> -  push ax
>> -  push bx
>> -  push cx
>> +  pusha
>> +  push ds
>> +
>>    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
I actually skipped this one.

Ok for xchg, but cx at this time holds the remaining bytes, so dec cx won't
have the effect you think it will.


-- 
Glauber  Costa.
"Free as in Freedom"
http://glommer.net

"The less confident you are, the more serious you have to act."

  parent reply	other threads:[~2009-03-24  1:53 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
2009-03-24  1:53   ` Glauber Costa [this message]
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=5d6222a80903231853l1331de5brea477b0801dabfff@mail.gmail.com \
    --to=glommer@gmail.com \
    --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).