[syslinux:master] diskstart: fix CHS mode, reinstate cyl 1023 check

syslinux-bot for H. Peter Anvin hpa at zytor.com
Mon Jun 21 10:42:03 PDT 2010


Commit-ID:  88dd13080be414afa5ea2a47f08c632bc143dc58
Gitweb:     http://syslinux.zytor.com/commit/88dd13080be414afa5ea2a47f08c632bc143dc58
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Mon, 21 Jun 2010 10:39:38 -0700
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Mon, 21 Jun 2010 10:39:38 -0700

diskstart: fix CHS mode, reinstate cyl 1023 check

Fix loading in CHS mode; we were missing a popad.  Also reinstate the
check for exceeding cylinder 1023.

Signed-off-by: H. Peter Anvin <hpa at zytor.com>


---
 core/diskstart.inc |   23 +++++++++++------------
 1 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/core/diskstart.inc b/core/diskstart.inc
index 40330dd..4f15ad2 100644
--- a/core/diskstart.inc
+++ b/core/diskstart.inc
@@ -159,12 +159,13 @@ floppy:
 		fs rep movsw		; Faster to move words
 		mov cl,[bsSecPerTrack]  ; Patch the sector count
 		mov [di-76+8],cl
-		int 13h			; Some BIOSes need this
 
-		push cx			; Partition offset == 0
-		push cx
-		push cx
-		push cx
+		push ax			; Partition offset == 0
+		push ax
+		push ax
+		push ax
+
+		int 13h			; Some BIOSes need this
 		jmp short not_harddisk
 ;
 ; The drive number and possibly partition information was passed to us
@@ -326,9 +327,8 @@ getonesec_cbios:
 		; eax = track #
 		div edi			; Convert track to head/cyl
 
-		; We should test this, but it doesn't fit...
-		; cmp eax,1023
-		; ja .error
+		cmp eax,1023		; Outside the CHS range?
+		ja kaboom
 
 		;
 		; Now we have AX = cyl, DX = head, CX = sector (0-based),
@@ -343,11 +343,11 @@ getonesec_cbios:
 		mov dh,dl
 		mov ax,0201h		; Read one sector
 		call xint13
+		popad
 		jc .error
 		ret
 
 .error:
-		popad
 		loop .retry
 		; Fall through to disk_error
 
@@ -699,9 +699,8 @@ getlinsec_cbios:
 		; eax = track #
 		div edi			; Convert track to head/cyl
 
-		; We should test this, but it doesn't fit...
-		; cmp eax,1023
-		; ja .error
+		cmp eax,1023		; Outside the CHS range?
+		ja kaboom
 
 		;
 		; Now we have AX = cyl, DX = head, CX = sector (0-based),



More information about the Syslinux-commits mailing list