summaryrefslogtreecommitdiffstats
path: root/src/arch/i386/prefix/libprefix.S
diff options
context:
space:
mode:
authorMichael Brown2010-04-25 02:37:25 +0200
committerMichael Brown2010-04-25 02:50:46 +0200
commit5a5d8dd10a72d0a6e9c09e55e909e500eff55426 (patch)
tree6a16746498282541082580e9820dcf57c5fac32e /src/arch/i386/prefix/libprefix.S
parent[romprefix] Split PMM allocations for image source and decompression area (diff)
downloadipxe-5a5d8dd10a72d0a6e9c09e55e909e500eff55426.tar.gz
ipxe-5a5d8dd10a72d0a6e9c09e55e909e500eff55426.tar.xz
ipxe-5a5d8dd10a72d0a6e9c09e55e909e500eff55426.zip
[romprefix] Inhibit the use of relocation during POST
It is common for system memory maps to be grotesquely unreliable during POST. Many sanity checks have been added to the memory map reading code, but these do not catch all problems. Skip relocation entirely if called during POST. This should avoid the problems typically encountered, at the cost of slightly disrupting the memory map of an operating system booted via iPXE when iPXE was entered during POST. Since this is a very rare special case (used, for example, when reflashing an experimental ROM that would otherwise prevent the system from completing POST), this is an acceptable cost. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch/i386/prefix/libprefix.S')
-rw-r--r--src/arch/i386/prefix/libprefix.S15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/arch/i386/prefix/libprefix.S b/src/arch/i386/prefix/libprefix.S
index f5f66919..eeed0ada 100644
--- a/src/arch/i386/prefix/libprefix.S
+++ b/src/arch/i386/prefix/libprefix.S
@@ -443,6 +443,8 @@ install:
xorl %esi, %esi
/* Image destination = default */
xorl %edi, %edi
+ /* Allow relocation */
+ clc
/* Install text and data segments */
call install_prealloc
/* Restore registers and return */
@@ -461,6 +463,7 @@ install:
* %bx : .data16 segment address
* %esi : Image source physical address (or zero for %cs:0000)
* %edi : Decompression temporary area physical address (or zero for default)
+ * CF set : Avoid relocating to top of memory
* Corrupts:
* none
****************************************************************************
@@ -473,9 +476,8 @@ install_prealloc:
pushal
pushw %ds
pushw %es
-
- /* Sanity: clear the direction flag asap */
- cld
+ cld /* Sanity: clear the direction flag asap */
+ pushfw
/* Copy decompression temporary area physical address to %ebp */
movl %edi, %ebp
@@ -570,6 +572,11 @@ a20_death_message:
movl %ebp, %edi
lcall *init_librm_vector
+ /* Skip relocation if CF was set on entry */
+ popfw
+ pushfw
+ jc skip_relocate
+
/* Call relocate() to determine target address for relocation.
* relocate() will return with %esi, %edi and %ecx set up
* ready for the copy to the new location.
@@ -588,9 +595,11 @@ a20_death_message:
/* Initialise librm at new location */
lcall *init_librm_vector
+skip_relocate:
#endif
/* Restore registers */
+ popfw
popw %es
popw %ds
popal