david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[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>
This commit is contained in:
Michael Brown 2011-03-28 00:55:15 +01:00
parent d161ebff94
commit 5924e65cea
1 changed files with 7 additions and 3 deletions

View File

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