2
0
mirror of https://github.com/xcat2/xNBA.git synced 2024-11-25 19:08:35 +00:00

[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>
This commit is contained in:
Michael Brown 2010-04-24 22:22:54 +01:00
parent bae3964e6f
commit f0ae1d58e8
3 changed files with 27 additions and 17 deletions

View File

@ -21,16 +21,6 @@ FILE_LICENCE ( GPL2_OR_LATER )
.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 */
#define COMPRESS 1
@ -451,8 +441,8 @@ install:
call alloc_basemem
/* Image source = %cs:0000 */
xorl %esi, %esi
/* Image destination = HIGHMEM_LOADPOINT */
movl $HIGHMEM_LOADPOINT, %edi
/* Image destination = default */
xorl %edi, %edi
/* Install text and data segments */
call install_prealloc
/* Restore registers and return */
@ -470,7 +460,7 @@ install:
* %ax : .text16 segment address
* %bx : .data16 segment address
* %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:
* none
****************************************************************************
@ -550,6 +540,22 @@ a20_death_message:
movw %ax, (init_libkir_vector+2)
lcall *init_libkir_vector
#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,
* prior to reading the E820 memory map and relocating
* properly.

View File

@ -483,9 +483,10 @@ init_message_done:
.asciz "\n\n"
.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
image_source:
@ -507,11 +508,12 @@ shrunk_rom_size:
/* 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
decompress_to:
.long HIGHMEM_LOADPOINT
.long 0
.size decompress_to, . - decompress_to
/* BBS version

View File

@ -208,4 +208,6 @@ SECTIONS {
*/
_text16_memsz_pgh = ( ( _text16_memsz + 15 ) / 16 );
_data16_memsz_pgh = ( ( _data16_memsz + 15 ) / 16 );
_textdata_memsz_pgh = ( ( _textdata_memsz + 15 ) / 16 );
_textdata_memsz_kb = ( ( _textdata_memsz + 1023 ) / 1024 );
}