summaryrefslogtreecommitdiffstats
path: root/src/arch
diff options
context:
space:
mode:
authorMichael Brown2017-08-30 11:15:25 +0200
committerMichael Brown2017-08-30 11:15:25 +0200
commit75acb3c775544b6ecc4bfb1bba633717c8ec9394 (patch)
tree131846d6fe794146f6bcd6fe656e2682b166c93f /src/arch
parent[intel] Add various PCI device IDs (diff)
downloadipxe-75acb3c775544b6ecc4bfb1bba633717c8ec9394.tar.gz
ipxe-75acb3c775544b6ecc4bfb1bba633717c8ec9394.tar.xz
ipxe-75acb3c775544b6ecc4bfb1bba633717c8ec9394.zip
[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>
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/x86/prefix/mromprefix.S1
-rw-r--r--src/arch/x86/prefix/romprefix.S3
2 files changed, 4 insertions, 0 deletions
diff --git a/src/arch/x86/prefix/mromprefix.S b/src/arch/x86/prefix/mromprefix.S
index 568d1c00..73a869d9 100644
--- a/src/arch/x86/prefix/mromprefix.S
+++ b/src/arch/x86/prefix/mromprefix.S
@@ -492,6 +492,7 @@ mromheader:
.word 0
.size mromheader, . - mromheader
+ .align 4
mpciheader:
.ascii "PCIR" /* Signature */
.word pci_vendor_id /* Vendor identification */
diff --git a/src/arch/x86/prefix/romprefix.S b/src/arch/x86/prefix/romprefix.S
index f4ca2067..978b07b5 100644
--- a/src/arch/x86/prefix/romprefix.S
+++ b/src/arch/x86/prefix/romprefix.S
@@ -88,6 +88,7 @@ checksum:
.previous
.ifeqs BUSTYPE, "PCIR"
+ .align 4
pciheader:
.ascii "PCIR" /* Signature */
.word pci_vendor_id /* Vendor identification */
@@ -183,6 +184,7 @@ prodstr_pci_id:
.globl undiheader
.weak undiloader
+ .align 4
undiheader:
.ascii "UNDI" /* Signature */
.byte undiheader_len /* Length of structure */
@@ -197,6 +199,7 @@ undiheader:
.equ undiheader_len, . - undiheader
.size undiheader, . - undiheader
+ .align 4
ipxeheader:
.ascii "iPXE" /* Signature */
.byte ipxeheader_len /* Length of structure */