isohdpfx: actually generate the stack frame isolinux expects syslinux-3.82-pre2
authorH. Peter Anvin <hpa@zytor.com>
Mon, 1 Jun 2009 04:29:59 +0000 (21:29 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Mon, 1 Jun 2009 04:29:59 +0000 (21:29 -0700)
Actually generate the stack frame isolinux expects.  This is not the
optimal order, but it appears to be what both earlier and later
versions of isolinux expects...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
mbr/isohdpfx.S

index 375c846..801115c 100644 (file)
@@ -48,9 +48,9 @@ isolinux_start_hybrid         = 0x7c00+64+4
 stack          = 0x7c00
 partoffset     = (stack-8)
 driveno                = (stack-14)
-ebios_flag     = (stack-16)
+heads          = (stack-16)
 sectors                = (stack-18)
-heads          = (stack-20)
+ebios_flag     = (stack-20)
 secpercyl      = (stack-24)
 
 BIOS_kbdflags  = 0x417
@@ -138,18 +138,21 @@ next:
        jmp     1f
 1:
        popw    %dx
-       pushw   %cx             /* -16: Save EBIOS flag */
+       pushw   %cx             /* EBIOS flag */
 
        /* Get (C)HS geometry */
        movb    $0x08, %ah
        int     $0x13
        andw    $0x3f, %cx      /* Sector count */
-       pushw   %cx             /* -18: Save sectors on the stack */
+       popw    %bx             /* EBIOS flag */
+       pushw   %cx             /* -16: Save sectors on the stack */
        movzbw  %dh, %ax        /* dh = max head */
        incw    %ax             /* From 0-based max to count */
-       pushw   %ax             /* -20: Save heads on the stack */
+       pushw   %ax             /* -18: Save heads on the stack */
        mulw    %cx             /* Heads*sectors -> sectors per cylinder */
 
+       pushw   %bx             /* -20: EBIOS flag */
+       
        /* Save sectors/cylinder on the stack */
        pushw   %dx             /* -22: High word */
        pushw   %ax             /* -24: Low word */
@@ -177,7 +180,7 @@ next:
        jne     bad_signature
 
        cli
-       movw    $heads, %sp
+       movw    $ebios_flag, %sp
 
        /*
         * Use a ljmpw here to work around a bug in some unknown version