소스 검색

[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 년 전
부모
커밋
f16668dd60
1개의 변경된 파일9개의 추가작업 그리고 7개의 파일을 삭제
  1. 9
    7
      src/arch/i386/prefix/romprefix.S

+ 9
- 7
src/arch/i386/prefix/romprefix.S 파일 보기

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

Loading…
취소
저장