summaryrefslogtreecommitdiffstats
path: root/src/arch/i386/prefix/romprefix.S
diff options
context:
space:
mode:
authorMichael Brown2008-10-17 19:12:24 +0200
committerMichael Brown2008-10-17 19:12:24 +0200
commit5600955bdd20d95d6509617457cfa9d0d7b464b7 (patch)
tree55a1e9bfb38b526698a102a83286784a6c681792 /src/arch/i386/prefix/romprefix.S
parent[build] Use ".bss.*" names for uninitialised-data sections (diff)
downloadipxe-5600955bdd20d95d6509617457cfa9d0d7b464b7.tar.gz
ipxe-5600955bdd20d95d6509617457cfa9d0d7b464b7.tar.xz
ipxe-5600955bdd20d95d6509617457cfa9d0d7b464b7.zip
[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.
Diffstat (limited to 'src/arch/i386/prefix/romprefix.S')
-rw-r--r--src/arch/i386/prefix/romprefix.S9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/arch/i386/prefix/romprefix.S b/src/arch/i386/prefix/romprefix.S
index ca32a441..3351494b 100644
--- a/src/arch/i386/prefix/romprefix.S
+++ b/src/arch/i386/prefix/romprefix.S
@@ -205,7 +205,16 @@ init:
movb %bl, %al
call print_hex_byte
cmpb $3, %bh
+ jb 1f
+ /* PCI >=3.0: leave %gs as-is if sane */
+ movw %gs, %ax
+ cmpw $0xc000, %ax
jae 2f
+ /* PCI 3.0 with insane %gs value: print error and ignore %gs */
+ movb $'!', %al
+ call print_character
+ movw %gs, %ax
+ call print_hex_word
1: /* PCI <3.0: set %gs (runtime segment) = %cs (init-time segment) */
pushw %cs
popw %gs