Переглянути джерело

[romprefix] Do not clobber stack segment when returning to BIOS

Commit c429bf0 ("[romprefix] Store boot bus:dev.fn address as autoboot
device location") introduced a regression by using register %cx to
temporarily hold the PCI bus:dev.fn address, despite the fact that %cx
was already being used to hold the stored BIOS stack segment.
Consequently, when returning to the BIOS after a failed or cancelled
boot attempt, iPXE would end up calling INT 18 with the stack segment
set equal to the PCI bus:dev.fn address.  Writing to essentially
random areas of memory tends to upset even the more robust BIOSes.

Fix by using register %ax to temporarily hold the PCI bus:dev.fn
address.

Reported-by: Anton D. Kachalov <mouse@yandex-team.ru>
Tested-by: Anton D. Kachalov <mouse@yandex-team.ru>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 10 роки тому
джерело
коміт
1137fa3268
1 змінених файлів з 2 додано та 2 видалено
  1. 2
    2
      src/arch/i386/prefix/romprefix.S

+ 2
- 2
src/arch/i386/prefix/romprefix.S Переглянути файл

@@ -740,13 +740,13 @@ exec:	/* Set %ds = %cs */
740 740
 	.section ".text16", "awx", @progbits
741 741
 1:
742 742
 	/* Retrieve PCI bus:dev.fn */
743
-	movw	init_pci_busdevfn, %cx
743
+	movw	init_pci_busdevfn, %ax
744 744
 
745 745
 	/* Set up %ds for access to .data16 */
746 746
 	movw	%bx, %ds
747 747
 
748 748
 	/* Store PCI bus:dev.fn */
749
-	movw	%cx, autoboot_busdevfn
749
+	movw	%ax, autoboot_busdevfn
750 750
 
751 751
 	/* Call main() */
752 752
 	pushl	$main

Завантаження…
Відмінити
Зберегти