From: H. Peter Anvin Date: Fri, 15 May 2009 01:04:25 +0000 (-0700) Subject: core/diskstart: handle more than 2^16 dwords X-Git-Tag: syslinux-4.00-pre1~132 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8af553fa455f857e151994acec91ad957e4b910b;p=profile%2Fivi%2Fsyslinux.git core/diskstart: handle more than 2^16 dwords Handle more than 2^16 dwords in the checksumming loop. Signed-off-by: H. Peter Anvin --- diff --git a/core/diskstart.inc b/core/diskstart.inc index c4fefbf..81b284f 100644 --- a/core/diskstart.inc +++ b/core/diskstart.inc @@ -577,22 +577,23 @@ load_rest: ; verify_checksum: mov si,ldlinux_sys - mov cx,[LDLDwords] - mov edx,-LDLINUX_MAGIC + mov ecx,[LDLDwords] + mov eax,-LDLINUX_MAGIC push ds .checksum: - lodsd - add edx,eax - and di,di + add eax,[si] + add si,4 jnz .nowrap - mov ax,ds - add ax,1000h - mov ds,ax + ; Handle segment wrap + mov dx,ds + add dx,1000h + mov ds,dx .nowrap: - loop .checksum + dec ecx + jnz .checksum pop ds - and edx,edx ; Should be zero + and eax,eax ; Should be zero jz all_read ; We're cool, go for it! ;