Kaynağa Gözat

[romprefix] Sanity-check the runtime segment address for PCI 3

Some PCI 3 BIOSes seem to provide a garbage value in %bx, which should
contain the runtime segment address.  Perform a basic sanity check: we
reject the segment if it is below the start of option ROM space.  If
the sanity check fails, we assume that the BIOS was not expecting us
to be a PCI 3 ROM, and we just leave our image in situ.
tags/v0.9.6
Michael Brown 15 yıl önce
ebeveyn
işleme
5600955bdd
1 değiştirilmiş dosya ile 9 ekleme ve 0 silme
  1. 9
    0
      src/arch/i386/prefix/romprefix.S

+ 9
- 0
src/arch/i386/prefix/romprefix.S Dosyayı Görüntüle

@@ -205,7 +205,16 @@ init:
205 205
 	movb	%bl, %al
206 206
 	call	print_hex_byte
207 207
 	cmpb	$3, %bh
208
+	jb	1f
209
+	/* PCI >=3.0: leave %gs as-is if sane */
210
+	movw	%gs, %ax
211
+	cmpw	$0xc000, %ax
208 212
 	jae	2f
213
+	/* PCI 3.0 with insane %gs value: print error and ignore %gs */
214
+	movb	$'!', %al
215
+	call	print_character
216
+	movw	%gs, %ax
217
+	call	print_hex_word
209 218
 1:	/* PCI <3.0: set %gs (runtime segment) = %cs (init-time segment) */
210 219
 	pushw	%cs
211 220
 	popw	%gs

Loading…
İptal
Kaydet