mirror of
https://github.com/ipxe/ipxe
synced 2025-12-12 23:15:10 +03:00
[romprefix] Avoid unaligned accesses within ROM headers
Ensure that all headers (PCI, UNDI, PnP, iPXE) are aligned to at least four bytes, so that all accesses to header fields will be correctly aligned even when reading directly from the expansion ROM BAR. Reported-by: Peter von Konigsmark <peter@exablaze.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -492,6 +492,7 @@ mromheader:
|
|||||||
.word 0
|
.word 0
|
||||||
.size mromheader, . - mromheader
|
.size mromheader, . - mromheader
|
||||||
|
|
||||||
|
.align 4
|
||||||
mpciheader:
|
mpciheader:
|
||||||
.ascii "PCIR" /* Signature */
|
.ascii "PCIR" /* Signature */
|
||||||
.word pci_vendor_id /* Vendor identification */
|
.word pci_vendor_id /* Vendor identification */
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ checksum:
|
|||||||
.previous
|
.previous
|
||||||
|
|
||||||
.ifeqs BUSTYPE, "PCIR"
|
.ifeqs BUSTYPE, "PCIR"
|
||||||
|
.align 4
|
||||||
pciheader:
|
pciheader:
|
||||||
.ascii "PCIR" /* Signature */
|
.ascii "PCIR" /* Signature */
|
||||||
.word pci_vendor_id /* Vendor identification */
|
.word pci_vendor_id /* Vendor identification */
|
||||||
@@ -183,6 +184,7 @@ prodstr_pci_id:
|
|||||||
|
|
||||||
.globl undiheader
|
.globl undiheader
|
||||||
.weak undiloader
|
.weak undiloader
|
||||||
|
.align 4
|
||||||
undiheader:
|
undiheader:
|
||||||
.ascii "UNDI" /* Signature */
|
.ascii "UNDI" /* Signature */
|
||||||
.byte undiheader_len /* Length of structure */
|
.byte undiheader_len /* Length of structure */
|
||||||
@@ -197,6 +199,7 @@ undiheader:
|
|||||||
.equ undiheader_len, . - undiheader
|
.equ undiheader_len, . - undiheader
|
||||||
.size undiheader, . - undiheader
|
.size undiheader, . - undiheader
|
||||||
|
|
||||||
|
.align 4
|
||||||
ipxeheader:
|
ipxeheader:
|
||||||
.ascii "iPXE" /* Signature */
|
.ascii "iPXE" /* Signature */
|
||||||
.byte ipxeheader_len /* Length of structure */
|
.byte ipxeheader_len /* Length of structure */
|
||||||
|
|||||||
Reference in New Issue
Block a user