Browse Source

[prefix] Avoid using base memory for temporary decompression area

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>
tags/v1.20.1
Michael Brown 13 years ago
parent
commit
5924e65cea
1 changed files with 7 additions and 3 deletions
  1. 7
    3
      src/arch/i386/prefix/libprefix.S

+ 7
- 3
src/arch/i386/prefix/libprefix.S View File

@@ -753,21 +753,25 @@ payload_death_message:
753 753
 	lcall	*init_libkir_vector
754 754
 #else
755 755
 	/* Find a suitable decompression temporary area, if none specified */
756
+	pushl	%eax
756 757
 	testl	%ebp, %ebp
757 758
 	jnz	1f
758 759
 	/* Use INT 15,88 to find the highest available address via INT
759 760
 	 * 15,88.  This limits us to around 64MB, which should avoid
760 761
 	 * all of the POST-time memory map failure modes.
761 762
 	 */
762
-	pushl	%eax
763 763
 	movb	$0x88, %ah
764 764
 	int	$0x15
765 765
 	movw	%ax, %bp
766 766
 	addl	$0x400, %ebp
767 767
 	subl	$_textdata_memsz_kb, %ebp
768 768
 	shll	$10, %ebp
769
-	popl	%eax
770
-1:
769
+	/* Sanity check: if we have ended up below 1MB, use 1MB */
770
+	cmpl	$0x100000, %ebp
771
+	jae	1f
772
+	movl	$0x100000, %ebp
773
+1:	popl	%eax
774
+
771 775
 	/* Install .text and .data to temporary area in high memory,
772 776
 	 * prior to reading the E820 memory map and relocating
773 777
 	 * properly.

Loading…
Cancel
Save