Skip to content

Commit

Permalink
[prefix] Use area at top of INT 15,88 memory map for temporary decomp…
Browse files Browse the repository at this point in the history
…ression

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>
  • Loading branch information
mcb30 committed Apr 25, 2010
1 parent bae3964 commit f0ae1d5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 17 deletions.
32 changes: 19 additions & 13 deletions src/arch/i386/prefix/libprefix.S
Expand Up @@ -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

Expand Down Expand Up @@ -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 */
Expand All @@ -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
****************************************************************************
Expand Down Expand Up @@ -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.
Expand Down
10 changes: 6 additions & 4 deletions src/arch/i386/prefix/romprefix.S
Expand Up @@ -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:
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/arch/i386/scripts/i386.lds
Expand Up @@ -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 );
}

0 comments on commit f0ae1d5

Please sign in to comment.