Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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.
  • Loading branch information
Michael Brown committed Oct 17, 2008
1 parent 7982e79 commit 5600955
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/arch/i386/prefix/romprefix.S
Expand Up @@ -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
Expand Down

0 comments on commit 5600955

Please sign in to comment.