diff options
| author | Michael Brown | 2012-07-10 17:10:49 +0200 |
|---|---|---|
| committer | Michael Brown | 2012-07-10 17:10:49 +0200 |
| commit | 9e5152e095d8115d951af8cbb1cb6c1148609c68 (patch) | |
| tree | 7cdbb21b128b440b2b7e3bf53e4563423a827b19 /src | |
| parent | [intel] Explicitly enable descriptor queues (diff) | |
| download | ipxe-9e5152e095d8115d951af8cbb1cb6c1148609c68.tar.gz ipxe-9e5152e095d8115d951af8cbb1cb6c1148609c68.tar.xz ipxe-9e5152e095d8115d951af8cbb1cb6c1148609c68.zip | |
[pxeprefix] Place temporary stack after iPXE binary
Some BIOSes (observed on a Supermicro system with an AMI BIOS) seem to
use the area immediately below 0x7c00 to store data related to the
boot process. This data is currently liable to be overwritten by the
temporary stack used while decompressing and installing iPXE.
Try to avoid any such problems by placing the temporary stack
immediately after the loaded iPXE binary. Any memory used by the
stack could then potentially have been overwritten anyway by a larger
binary.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src')
| -rw-r--r-- | src/arch/i386/prefix/pxeprefix.S | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/arch/i386/prefix/pxeprefix.S b/src/arch/i386/prefix/pxeprefix.S index f59e347ad..9ccc4a2b5 100644 --- a/src/arch/i386/prefix/pxeprefix.S +++ b/src/arch/i386/prefix/pxeprefix.S @@ -19,6 +19,8 @@ FILE_LICENCE ( GPL2_OR_LATER ) #define EB_MAGIC_1 ( 'E' + ( 't' << 8 ) + ( 'h' << 16 ) + ( 'e' << 24 ) ) #define EB_MAGIC_2 ( 'r' + ( 'b' << 8 ) + ( 'o' << 16 ) + ( 'o' << 24 ) ) +#define PREFIX_STACK_SIZE 2048 + /***************************************************************************** * Entry point: set operating context, print welcome message ***************************************************************************** @@ -46,10 +48,11 @@ _pxe_start: movw %ax, %ds movw $0x40, %ax /* BIOS data segment access */ movw %ax, %fs - /* Set up stack just below 0x7c00 */ - xorw %ax, %ax + /* Set up temporary stack immediately after the iPXE image */ + movw %cs, %ax + addw image_size_pgh, %ax movw %ax, %ss - movl $0x7c00, %esp + movl $PREFIX_STACK_SIZE, %esp /* Clear direction flag, for the sake of sanity */ cld /* Print welcome message */ @@ -60,6 +63,18 @@ _pxe_start: 10: .asciz "PXE->EB:" .previous + /* Image size (for stack placement calculation) */ + .section ".prefix.data", "aw", @progbits +image_size_pgh: + .word 0 + .previous + .section ".zinfo.fixup", "a", @progbits /* Compressor fixups */ + .ascii "ADDW" + .long image_size_pgh + .long 16 + .long 0 + .previous + /***************************************************************************** * Find us a usable !PXE or PXENV+ entry point ***************************************************************************** |
