]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[prefix] Avoid using base memory for temporary decompression area
authorMichael Brown <mcb30@ipxe.org>
Sun, 27 Mar 2011 23:55:15 +0000 (00:55 +0100)
committerMichael Brown <mcb30@ipxe.org>
Mon, 28 Mar 2011 00:00:59 +0000 (01:00 +0100)
In the unlikely (but observable) event that INT 15,88 returns less
memory above 1MB than is required for the temporary decompression
area, ignore it and use the 1MB point anyway.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/arch/i386/prefix/libprefix.S

index 76f45586247ccd1f7661137ae1ce0daa69a29f3e..77151a67e0bb75a63d468f29d0f93244cf6ed3bb 100644 (file)
@@ -753,21 +753,25 @@ payload_death_message:
        lcall   *init_libkir_vector
 #else
        /* Find a suitable decompression temporary area, if none specified */
+       pushl   %eax
        testl   %ebp, %ebp
        jnz     1f
        /* Use INT 15,88 to find the highest available address via INT
         * 15,88.  This limits us to around 64MB, which should avoid
         * all of the POST-time memory map failure modes.
         */
-       pushl   %eax
        movb    $0x88, %ah
        int     $0x15
        movw    %ax, %bp
        addl    $0x400, %ebp
        subl    $_textdata_memsz_kb, %ebp
        shll    $10, %ebp
-       popl    %eax
-1:
+       /* Sanity check: if we have ended up below 1MB, use 1MB */
+       cmpl    $0x100000, %ebp
+       jae     1f
+       movl    $0x100000, %ebp
+1:     popl    %eax
+
        /* Install .text and .data to temporary area in high memory,
         * prior to reading the E820 memory map and relocating
         * properly.