Browse Source

[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.
tags/v0.9.7
Michael Brown 16 years ago
parent
commit
f16668dd60
1 changed files with 9 additions and 7 deletions
  1. 9
    7
      src/arch/i386/prefix/romprefix.S

+ 9
- 7
src/arch/i386/prefix/romprefix.S View File

345
 	shll	$9, %ecx
345
 	shll	$9, %ecx
346
 	addr32 rep movsb	/* PMM presence implies flat real mode */
346
 	addr32 rep movsb	/* PMM presence implies flat real mode */
347
 	movl	%edi, decompress_to
347
 	movl	%edi, decompress_to
348
-	/* Shrink ROM and update checksum */
348
+	/* Shrink ROM */
349
+	movb	$_prefix_memsz_sect, romheader_size
350
+pmm_fail:
351
+	/* Restore upper register halves */
352
+	popal
353
+no_pmm:
354
+
355
+	/* Update checksum */
349
 	xorw	%bx, %bx
356
 	xorw	%bx, %bx
350
 	xorw	%si, %si
357
 	xorw	%si, %si
351
-	movw	$_prefix_memsz_sect, %cx
352
-	movb	%cl, romheader_size
358
+	movzbw	romheader_size, %cx
353
 	shlw	$9, %cx
359
 	shlw	$9, %cx
354
 1:	lodsb
360
 1:	lodsb
355
 	addb	%al, %bl
361
 	addb	%al, %bl
356
 	loop	1b
362
 	loop	1b
357
 	subb	%bl, checksum
363
 	subb	%bl, checksum
358
-pmm_fail:
359
-	/* Restore upper register halves */
360
-	popal
361
-no_pmm:
362
 
364
 
363
 	/* Copy self to option ROM space.  Required for PCI3.0, which
365
 	/* Copy self to option ROM space.  Required for PCI3.0, which
364
 	 * loads us to a temporary location in low memory.  Will be a
366
 	 * loads us to a temporary location in low memory.  Will be a

Loading…
Cancel
Save