From 8daaa1843b50292ac12e9701f81579480905353b Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Tue, 29 Jun 2010 17:17:58 -0700 Subject: [PATCH] diskstart: don't let the function number clobber the LBA The LBA for getonesec and getlinsec is in EDX:EAX, but both DL and AX are function inputs to INT 13h (drive number and function number). We need to preserve the LBA across *both* those, otherwise retries will not function. Signed-off-by: H. Peter Anvin --- core/diskstart.inc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/diskstart.inc b/core/diskstart.inc index 01439b8..c0ba52a 100644 --- a/core/diskstart.inc +++ b/core/diskstart.inc @@ -294,8 +294,10 @@ getonesec_ebios: push word 1 push word 16 mov si,sp + pushad mov ah,42h ; Extended Read call xint13 + popad lea sp,[si+16] ; Remove DAPA jc .error ret @@ -308,7 +310,7 @@ getonesec_ebios: pushad ; Try resetting the device xor ax,ax - int 13h + call xint13 popad loop .retry ; CX-- and jump if not zero @@ -407,9 +409,7 @@ writestr_early: ; xint13: mov dl,[DriveNumber] - pushad int 13h - popad ret ; @@ -641,12 +641,14 @@ getlinsec_ebios: push di push word 16 mov si,sp + pushad mov ah,42h ; Extended Read push ds push ss pop ds call xint13 pop ds + popad lea sp,[si+16] ; Remove DAPA jc .error pop bp @@ -738,7 +740,9 @@ getlinsec_cbios: mov ah,02h ; Read sectors mov bp,retry_count .retry: + pushad call xint13 + popad jc .error .resume: movzx ecx,al ; ECX <- sectors transferred -- 2.7.4