mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
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>
This commit is contained in:
1 parent
83fd7b933e
commit
39c0fe0403
1 file changed
+28
-6
@@ -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
|
||||
|
||||
|
||||
|
||||