summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brown2009-02-15 12:42:15 +0100
committerMichael Brown2009-02-15 12:44:21 +0100
commitf16668dd600c266ee573badc295745cbb0c0f879 (patch)
tree29671e6e4fc432bc852f3676fb57e2a4b9c35068
parent[build] Treat warnings as errors in assembly files (diff)
downloadipxe-f16668dd600c266ee573badc295745cbb0c0f879.tar.gz
ipxe-f16668dd600c266ee573badc295745cbb0c0f879.tar.xz
ipxe-f16668dd600c266ee573badc295745cbb0c0f879.zip
[romprefix] Update ROM checksum even if PMM allocation fails
There are code paths other than PMM allocation that can result in our changing the ROM checksum. For example, we attempt to update our product string to incorporate the PCI bus:dev.fn number. In a system that does not support PMM, we could therefore end up with an incorrect checksum. Fix by attempting to update the checksum unconditionally.
-rw-r--r--src/arch/i386/prefix/romprefix.S16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/arch/i386/prefix/romprefix.S b/src/arch/i386/prefix/romprefix.S
index d248916d..2664e340 100644
--- a/src/arch/i386/prefix/romprefix.S
+++ b/src/arch/i386/prefix/romprefix.S
@@ -345,20 +345,22 @@ got_pmm: /* PMM allocation succeeded */
shll $9, %ecx
addr32 rep movsb /* PMM presence implies flat real mode */
movl %edi, decompress_to
- /* Shrink ROM and update checksum */
+ /* Shrink ROM */
+ movb $_prefix_memsz_sect, romheader_size
+pmm_fail:
+ /* Restore upper register halves */
+ popal
+no_pmm:
+
+ /* Update checksum */
xorw %bx, %bx
xorw %si, %si
- movw $_prefix_memsz_sect, %cx
- movb %cl, romheader_size
+ movzbw romheader_size, %cx
shlw $9, %cx
1: lodsb
addb %al, %bl
loop 1b
subb %bl, checksum
-pmm_fail:
- /* Restore upper register halves */
- popal
-no_pmm:
/* Copy self to option ROM space. Required for PCI3.0, which
* loads us to a temporary location in low memory. Will be a