Patrick Rudolph has uploaded this change for review.

View Change

src/mainboard/emulation/qemu-i440fx: Fix struct packing

On x86_64 the struct isn't packed, causing the fw_cfg parser to return
invlid memory entries (possible others as well) through fw_cfg.
Fix that by packing all structs.

Change-Id: Id1bab99f06be99674efe219dda443fb7d44be560
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
---
M src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h
1 file changed, 5 insertions(+), 5 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/72/59872/1
diff --git a/src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h b/src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h
index e972f54..817d1a5 100644
--- a/src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h
+++ b/src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h
@@ -69,18 +69,18 @@
uint16_t select; /* write this to 0x510 to read it */
uint16_t reserved;
char name[FW_CFG_MAX_FILE_PATH];
-} FWCfgFile;
+} __packed FWCfgFile;

typedef struct FWCfgFiles {
uint32_t count;
FWCfgFile f[];
-} FWCfgFiles;
+} __packed FWCfgFiles;

typedef struct FwCfgE820Entry {
uint64_t address;
uint64_t length;
uint32_t type;
-} FwCfgE820Entry __attribute((__aligned__(4)));
+} __packed FwCfgE820Entry __attribute((__aligned__(4)));


#define SMBIOS_FIELD_ENTRY 0
@@ -91,7 +91,7 @@
uint8_t headertype;
uint8_t tabletype;
uint16_t fieldoffset;
-} FwCfgSmbios;
+} __packed FwCfgSmbios;

/* FW_CFG_ID bits */
#define FW_CFG_VERSION 0x01
@@ -113,6 +113,6 @@
uint32_t control;
uint32_t length;
uint64_t address;
-} FwCfgDmaAccess;
+} __packed FwCfgDmaAccess;

#endif /* FW_CFG_IF_H */

To view, visit change 59872. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Id1bab99f06be99674efe219dda443fb7d44be560
Gerrit-Change-Number: 59872
Gerrit-PatchSet: 1
Gerrit-Owner: Patrick Rudolph <patrick.rudolph@9elements.com>
Gerrit-MessageType: newchange