The top 40 bits of the LBA must be zero on CHS mode. Enforce this,
and also fix leak of the drive number into a divide instruction with
resulting overflow.
Reported-by: Gert Hulselmans <gerth@zytor.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
push eax
push bp
+ and edx,edx ; > 2 TiB not possible
+ jnz .cb_overflow
+
mov dl,[ADVDrive]
and dl,dl
; Floppies: can't trust INT 13h 08h, we better know
; Dividing by sectors to get (track,sector): we may have
; up to 2^18 tracks, so we need to use 32-bit arithmetric.
;
+ xor edx,edx
div esi
xor cx,cx
xchg cx,dx ; CX <- sector index (0-based)