mirror of https://github.com/ipxe/ipxe.git
[prefix] Use area at top of INT 15,88 memory map for temporary decompression
Use INT 15,88 to find a suitable temporary decompression area, rather than a fixed address. This hopefully gives us a better chance of not treading on any PMM-allocated areas, in BIOSes where PMM support exists but tends not to give us the large blocks that we ask for. Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/1/head
parent
bae3964e6f
commit
f0ae1d58e8
|
@ -21,16 +21,6 @@ FILE_LICENCE ( GPL2_OR_LATER )
|
||||||
|
|
||||||
.arch i386
|
.arch i386
|
||||||
|
|
||||||
/**
|
|
||||||
* High memory temporary load address
|
|
||||||
*
|
|
||||||
* Temporary buffer into which to copy (or decompress) our runtime
|
|
||||||
* image, prior to calling get_memmap() and relocate(). We don't
|
|
||||||
* actually leave anything here once install() has returned.
|
|
||||||
*/
|
|
||||||
.globl HIGHMEM_LOADPOINT
|
|
||||||
.equ HIGHMEM_LOADPOINT, ( 1 << 20 )
|
|
||||||
|
|
||||||
/* Image compression enabled */
|
/* Image compression enabled */
|
||||||
#define COMPRESS 1
|
#define COMPRESS 1
|
||||||
|
|
||||||
|
@ -451,8 +441,8 @@ install:
|
||||||
call alloc_basemem
|
call alloc_basemem
|
||||||
/* Image source = %cs:0000 */
|
/* Image source = %cs:0000 */
|
||||||
xorl %esi, %esi
|
xorl %esi, %esi
|
||||||
/* Image destination = HIGHMEM_LOADPOINT */
|
/* Image destination = default */
|
||||||
movl $HIGHMEM_LOADPOINT, %edi
|
xorl %edi, %edi
|
||||||
/* Install text and data segments */
|
/* Install text and data segments */
|
||||||
call install_prealloc
|
call install_prealloc
|
||||||
/* Restore registers and return */
|
/* Restore registers and return */
|
||||||
|
@ -470,7 +460,7 @@ install:
|
||||||
* %ax : .text16 segment address
|
* %ax : .text16 segment address
|
||||||
* %bx : .data16 segment address
|
* %bx : .data16 segment address
|
||||||
* %esi : Image source physical address (or zero for %cs:0000)
|
* %esi : Image source physical address (or zero for %cs:0000)
|
||||||
* %edi : Decompression temporary area physical address
|
* %edi : Decompression temporary area physical address (or zero for default)
|
||||||
* Corrupts:
|
* Corrupts:
|
||||||
* none
|
* none
|
||||||
****************************************************************************
|
****************************************************************************
|
||||||
|
@ -550,6 +540,22 @@ a20_death_message:
|
||||||
movw %ax, (init_libkir_vector+2)
|
movw %ax, (init_libkir_vector+2)
|
||||||
lcall *init_libkir_vector
|
lcall *init_libkir_vector
|
||||||
#else
|
#else
|
||||||
|
/* Find a suitable decompression temporary area, if none specified */
|
||||||
|
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:
|
||||||
/* 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.
|
||||||
|
|
|
@ -483,9 +483,10 @@ init_message_done:
|
||||||
.asciz "\n\n"
|
.asciz "\n\n"
|
||||||
.size init_message_done, . - init_message_done
|
.size init_message_done, . - init_message_done
|
||||||
|
|
||||||
/* ROM image location
|
/* Image source area
|
||||||
*
|
*
|
||||||
* May be either within option ROM space, or within PMM-allocated block.
|
* May be either zero (indicating to use option ROM space as source),
|
||||||
|
* or within a PMM-allocated block.
|
||||||
*/
|
*/
|
||||||
.globl image_source
|
.globl image_source
|
||||||
image_source:
|
image_source:
|
||||||
|
@ -507,11 +508,12 @@ shrunk_rom_size:
|
||||||
|
|
||||||
/* Temporary decompression area
|
/* Temporary decompression area
|
||||||
*
|
*
|
||||||
* May be either at HIGHMEM_LOADPOINT, or within PMM-allocated block.
|
* May be either zero (indicating to use default decompression area in
|
||||||
|
* high memory), or within a PMM-allocated block.
|
||||||
*/
|
*/
|
||||||
.globl decompress_to
|
.globl decompress_to
|
||||||
decompress_to:
|
decompress_to:
|
||||||
.long HIGHMEM_LOADPOINT
|
.long 0
|
||||||
.size decompress_to, . - decompress_to
|
.size decompress_to, . - decompress_to
|
||||||
|
|
||||||
/* BBS version
|
/* BBS version
|
||||||
|
|
|
@ -208,4 +208,6 @@ SECTIONS {
|
||||||
*/
|
*/
|
||||||
_text16_memsz_pgh = ( ( _text16_memsz + 15 ) / 16 );
|
_text16_memsz_pgh = ( ( _text16_memsz + 15 ) / 16 );
|
||||||
_data16_memsz_pgh = ( ( _data16_memsz + 15 ) / 16 );
|
_data16_memsz_pgh = ( ( _data16_memsz + 15 ) / 16 );
|
||||||
|
_textdata_memsz_pgh = ( ( _textdata_memsz + 15 ) / 16 );
|
||||||
|
_textdata_memsz_kb = ( ( _textdata_memsz + 1023 ) / 1024 );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue