Pārlūkot izejas kodu

[pci] Use flat real mode to call INT 1a,b101

Some HP BIOSes (observed with an HP ProLiant m710p Server Cartridge)
have a bug in the implementation of INT 1a,b101: they blithely assume
that real-mode code is able to read from anywhere in the 32-bit memory
space.

This problem affects the call to INT 1a,b101 made from within
pcibios_num_bus() (which uses REAL_CODE() and hence executes in
genuine real mode) but does not affect the call made from within
romprefix.S (since with a PMM BIOS, that call executes in flat real
mode anyway).

Work around the problem by explicitly calling flatten_real_mode()
before invoking INT 1a,b101.  This is a rarely-used code path, and so
the extra overhead of emulating instructions in some VM configurations
(see commit 6d4deee ("[librm] Use genuine real mode to accelerate
operation in virtual machines") for more details) is negligible.

Reported-by: Wissam Shoukair <wissams@mellanox.com>
Debugged-by: Wissam Shoukair <wissams@mellanox.com>
Debugged-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 9 gadus atpakaļ
vecāks
revīzija
e46154fbb4
1 mainītis faili ar 5 papildinājumiem un 1 dzēšanām
  1. 5
    1
      src/arch/i386/interface/pcbios/pcibios.c

+ 5
- 1
src/arch/i386/interface/pcbios/pcibios.c Parādīt failu

@@ -42,7 +42,11 @@ static int pcibios_num_bus ( void ) {
42 42
 	int discard_a, discard_D;
43 43
 	uint8_t max_bus;
44 44
 
45
-	__asm__ __volatile__ ( REAL_CODE ( "stc\n\t"
45
+	/* We issue this call using flat real mode, to work around a
46
+	 * bug in some HP BIOSes.
47
+	 */
48
+	__asm__ __volatile__ ( REAL_CODE ( "call flatten_real_mode\n\t"
49
+					   "stc\n\t"
46 50
 					   "int $0x1a\n\t"
47 51
 					   "jnc 1f\n\t"
48 52
 					   "xorw %%cx, %%cx\n\t"

Notiek ielāde…
Atcelt
Saglabāt