# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1244108161 -3600
# Node ID e638b32985fb133217b7057a1db892458cc2a62f
# Parent 7a215fae6f1f9b520e27e3140dfa101834fc7638
rombios: compute checksum for roms bigger than a segment
From: Glauber Costa <glommer@xxxxxxxxxx>
From: "Sebastian Herbszt" <herbszt@xxxxxx>
Ported by: Akio Takebe <takebe_akio@xxxxxxxxxxxxxx>
---
tools/firmware/rombios/rombios.c | 34 ++++++++++++++++++++++++++++------
1 files changed, 28 insertions(+), 6 deletions(-)
diff -r 7a215fae6f1f -r e638b32985fb tools/firmware/rombios/rombios.c
--- a/tools/firmware/rombios/rombios.c Thu Jun 04 10:35:03 2009 +0100
+++ b/tools/firmware/rombios/rombios.c Thu Jun 04 10:36:01 2009 +0100
@@ -10439,22 +10439,44 @@ 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
+ jz checksum_loop
+ xchg dx, cx
+ dec cx
+
checksum_loop:
add al, [bx]
inc bx
loop checksum_loop
+
+ test dx, dx
+ je checksum_out
+
+ add al, [bx]
+ mov cx, dx
+ mov dx, ds
+ add dh, #0x10
+ mov ds, dx
+ xor dx, dx
+ xor bx, bx
+
+ jmp checksum_loop
+
+checksum_out:
and al, #0xff
- pop cx
- pop bx
- pop ax
+ pop ds
+ popa
ret
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|