david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[lkrnprefix] Allow relocation when no initrd is present

Commit 2629b7e ("[pcbios] Inhibit all calls to INT 15,e820 and INT
15,e801 during POST") introduced a regression into .lkrn images when
used with no corresponding initrd.

Specifically, the semantics of the "maximum address for relocation"
value passed to install_prealloc() in %ebp changed so that zero became
a special value meaning "inhibit use of INT 15,e820 and INT 15,e801".
The %ebp value meaing "no upper limit on relocation" was changed from
zero to 0xffffffff, and all prefixes providing fixed values for %ebp
were updated to match the new semantics.

The .lkrn prefix provides the initrd base address as the maximum
address for relocation.  When no initrd is present, this address will
be zero, and so will unintentionally trigger the "inhibit INT 15,e820
and INT 15,e801" behaviour.

Fix by explicitly setting %ebp to 0xffffffff if no initrd is present
before calling install_prealloc().

Reported-by: Ján ONDREJ (SAL) <ondrejj@salstar.sk>
Tested-by: Ján ONDREJ (SAL) <ondrejj@salstar.sk>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown 2013-03-15 15:22:57 +00:00
parent e63f6c9241
commit 747e9eb6f3
1 changed files with 10 additions and 3 deletions

View File

@ -231,9 +231,12 @@ run_ipxe:
movzwl %sp, %edx
no_cmd_line:
/* Retrieve initrd pointer and size */
movl %ds:ramdisk_image, %ebp
movl %ds:ramdisk_size, %ecx
/* Calculate maximum relocation address */
movl ramdisk_image, %ebp
testl %ebp, %ebp
jnz 1f
orl $0xffffffff, %ebp /* Allow arbitrary relocation if no initrd */
1:
/* Install iPXE */
call alloc_basemem
@ -251,6 +254,10 @@ no_cmd_line:
lret
.section ".text16", "awx", @progbits
1:
/* Retrieve initrd pointer and size */
movl ramdisk_image, %ebp
movl ramdisk_size, %ecx
/* Set up %ds for access to .data16 */
movw %bx, %ds