From 8af553fa455f857e151994acec91ad957e4b910b Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Thu, 14 May 2009 18:04:25 -0700 Subject: [PATCH] core/diskstart: handle more than 2^16 dwords Handle more than 2^16 dwords in the checksumming loop. Signed-off-by: H. Peter Anvin --- core/diskstart.inc | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) 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! ; -- 2.7.4