ia64/xen-unstable

changeset 19713:e638b32985fb

rombios: compute checksum for roms bigger than a segment

From: Glauber Costa <glommer@redhat.com>
From: "Sebastian Herbszt" <herbszt@gmx.de>
Ported by: Akio Takebe <takebe_akio@jp.fujitsu.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jun 04 10:36:01 2009 +0100 (2009-06-04)
parents 7a215fae6f1f
children 76afaac7df86
files tools/firmware/rombios/rombios.c
line diff
     1.1 --- a/tools/firmware/rombios/rombios.c	Thu Jun 04 10:35:03 2009 +0100
     1.2 +++ b/tools/firmware/rombios/rombios.c	Thu Jun 04 10:36:01 2009 +0100
     1.3 @@ -10439,22 +10439,44 @@ no_serial:
     1.4    ret
     1.5  
     1.6  rom_checksum:
     1.7 -  push ax
     1.8 -  push bx
     1.9 -  push cx
    1.10 +  pusha
    1.11 +  push ds
    1.12 +
    1.13    xor  ax, ax
    1.14    xor  bx, bx
    1.15    xor  cx, cx
    1.16 +  xor  dx, dx
    1.17 +
    1.18    mov  ch, [2]
    1.19    shl  cx, #1
    1.20 +
    1.21 +  jnc checksum_loop
    1.22 +  jz  checksum_loop
    1.23 +  xchg dx, cx
    1.24 +  dec  cx
    1.25 +
    1.26  checksum_loop:
    1.27    add  al, [bx]
    1.28    inc  bx
    1.29    loop checksum_loop
    1.30 +
    1.31 +  test dx, dx
    1.32 +  je checksum_out
    1.33 +
    1.34 +  add  al, [bx]
    1.35 +  mov  cx, dx
    1.36 +  mov  dx, ds
    1.37 +  add  dh, #0x10
    1.38 +  mov  ds, dx
    1.39 +  xor  dx, dx
    1.40 +  xor  bx, bx
    1.41 +
    1.42 +  jmp  checksum_loop
    1.43 +
    1.44 +checksum_out:
    1.45    and  al, #0xff
    1.46 -  pop  cx
    1.47 -  pop  bx
    1.48 -  pop  ax
    1.49 +  pop  ds
    1.50 +  popa
    1.51    ret
    1.52  
    1.53