summaryrefslogtreecommitdiff
path: root/memdisk/memdisk.asm
diff options
context:
space:
mode:
authorhpa <hpa>2004-01-24 21:12:20 +0000
committerhpa <hpa>2004-01-24 21:12:20 +0000
commit0b52217d645e3457194d2514f3f52da8c90f6e4b (patch)
tree16912460b8d96314527a24a8ca7a1299649672a4 /memdisk/memdisk.asm
parent834e9d5623967dfa7c04b573a72901e24e484ffd (diff)
downloadsyslinux-0b52217d645e3457194d2514f3f52da8c90f6e4b.tar.gz
Fail if C/H/S geometry is wrong. This is necessary for things that probe
for geometry.
Diffstat (limited to 'memdisk/memdisk.asm')
-rw-r--r--memdisk/memdisk.asm4
1 files changed, 4 insertions, 0 deletions
diff --git a/memdisk/memdisk.asm b/memdisk/memdisk.asm
index 1f18ae79..053fa41d 100644
--- a/memdisk/memdisk.asm
+++ b/memdisk/memdisk.asm
@@ -308,8 +308,12 @@ setup_regs:
movzx ebx,cl ; Sector number
and bl,3Fh
dec ebx ; Sector number is 1-based
+ cmp bx,[Sectors]
+ jae .overrun
movzx edi,P_DH ; Head number
movzx eax,word [Heads]
+ cmp di,ax
+ jae .overrun
shr cl,6
xchg cl,ch ; Now (E)CX <- cylinder number
mul ecx ; eax <- Heads*cyl# (edx <- 0)