From ce6b5e7e333301a0f4ca9b1926a0e7f6fa3b26db Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Sat, 8 May 2021 20:35:12 -0700 Subject: [PATCH] misc: Replace M5_ATTR_PACKED with GEM5_PACKED. Change-Id: Ie59071ca1fc81a76267a54ddd2d35dfc4477995d Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45234 Maintainer: Gabe Black Tested-by: kokoro Reviewed-by: Daniel Carvalho --- src/arch/arm/remote_gdb.hh | 4 ++-- src/arch/x86/bios/acpi.hh | 20 ++++++++++---------- src/arch/x86/linux/linux.hh | 2 +- src/arch/x86/remote_gdb.hh | 2 +- src/base/bmpwriter.hh | 10 ++++++---- src/base/inet.hh | 4 ++-- src/base/pngwriter.hh | 2 +- src/base/vnc/vncinput.hh | 14 +++++++------- src/base/vnc/vncserver.hh | 8 ++++---- src/cpu/kvm/x86_cpu.cc | 2 +- src/dev/virtio/base.hh | 2 +- src/dev/virtio/block.hh | 4 ++-- src/dev/virtio/console.hh | 2 +- src/dev/virtio/fs9p.hh | 4 ++-- src/kern/linux/helpers.cc | 2 +- 15 files changed, 42 insertions(+), 40 deletions(-) diff --git a/src/arch/arm/remote_gdb.hh b/src/arch/arm/remote_gdb.hh index ce9cd695eb..ea6cd05771 100644 --- a/src/arch/arm/remote_gdb.hh +++ b/src/arch/arm/remote_gdb.hh @@ -66,7 +66,7 @@ class RemoteGDB : public BaseRemoteGDB { using BaseGdbRegCache::BaseGdbRegCache; private: - struct M5_ATTR_PACKED + struct GEM5_PACKED { uint32_t gpr[16]; uint32_t cpsr; @@ -89,7 +89,7 @@ class RemoteGDB : public BaseRemoteGDB { using BaseGdbRegCache::BaseGdbRegCache; private: - struct M5_ATTR_PACKED + struct GEM5_PACKED { uint64_t x[31]; uint64_t spx; diff --git a/src/arch/x86/bios/acpi.hh b/src/arch/x86/bios/acpi.hh index 1c9f8e0c61..fa6fa1003a 100644 --- a/src/arch/x86/bios/acpi.hh +++ b/src/arch/x86/bios/acpi.hh @@ -95,7 +95,7 @@ class RSDP : public SimObject static const char signature[]; - struct M5_ATTR_PACKED MemR0 + struct GEM5_PACKED MemR0 { // src: https://wiki.osdev.org/RSDP char signature[8] = {}; @@ -107,7 +107,7 @@ class RSDP : public SimObject static_assert(std::is_trivially_copyable::value, "Type not suitable for memcpy."); - struct M5_ATTR_PACKED Mem : public MemR0 + struct GEM5_PACKED Mem : public MemR0 { // since version 2 uint32_t length = 0; @@ -132,7 +132,7 @@ class SysDescTable : public SimObject protected: PARAMS(X86ACPISysDescTable); - struct M5_ATTR_PACKED Mem + struct GEM5_PACKED Mem { // src: https://wiki.osdev.org/RSDT char signature[4] = {}; @@ -207,7 +207,7 @@ class Record : public SimObject protected: PARAMS(X86ACPIMadtRecord); - struct M5_ATTR_PACKED Mem + struct GEM5_PACKED Mem { uint8_t type = 0; uint8_t length = 0; @@ -236,7 +236,7 @@ class LAPIC : public Record protected: PARAMS(X86ACPIMadtLAPIC); - struct M5_ATTR_PACKED Mem : public Record::Mem + struct GEM5_PACKED Mem : public Record::Mem { uint8_t acpiProcessorId = 0; uint8_t apicId = 0; @@ -256,7 +256,7 @@ class IOAPIC : public Record protected: PARAMS(X86ACPIMadtIOAPIC); - struct M5_ATTR_PACKED Mem : public Record::Mem + struct GEM5_PACKED Mem : public Record::Mem { uint8_t ioApicId = 0; uint8_t _reserved = 0; @@ -277,7 +277,7 @@ class IntSourceOverride : public Record protected: PARAMS(X86ACPIMadtIntSourceOverride); - struct M5_ATTR_PACKED Mem : public Record::Mem + struct GEM5_PACKED Mem : public Record::Mem { uint8_t busSource = 0; uint8_t irqSource = 0; @@ -298,7 +298,7 @@ class NMI : public Record protected: PARAMS(X86ACPIMadtNMI); - struct M5_ATTR_PACKED Mem : public Record::Mem + struct GEM5_PACKED Mem : public Record::Mem { uint8_t acpiProcessorId = 0; uint16_t flags = 0; @@ -318,7 +318,7 @@ class LAPICOverride : public Record protected: PARAMS(X86ACPIMadtLAPICOverride); - struct M5_ATTR_PACKED Mem : public Record::Mem + struct GEM5_PACKED Mem : public Record::Mem { uint16_t _reserved = 0; uint64_t localAPICAddress = 0; @@ -337,7 +337,7 @@ class MADT : public SysDescTable protected: PARAMS(X86ACPIMadt); - struct M5_ATTR_PACKED Mem : public SysDescTable::Mem + struct GEM5_PACKED Mem : public SysDescTable::Mem { uint32_t localAPICAddress = 0; uint32_t flags = 0; diff --git a/src/arch/x86/linux/linux.hh b/src/arch/x86/linux/linux.hh index 5dd75eb681..c808a4b6f0 100644 --- a/src/arch/x86/linux/linux.hh +++ b/src/arch/x86/linux/linux.hh @@ -247,7 +247,7 @@ class X86Linux64 : public X86Linux class X86Linux32 : public X86Linux { public: - typedef struct M5_ATTR_PACKED + typedef struct GEM5_PACKED { uint64_t st_dev; uint8_t __pad0[4]; diff --git a/src/arch/x86/remote_gdb.hh b/src/arch/x86/remote_gdb.hh index 4ebaa04dae..92fdea3072 100644 --- a/src/arch/x86/remote_gdb.hh +++ b/src/arch/x86/remote_gdb.hh @@ -94,7 +94,7 @@ class RemoteGDB : public BaseRemoteGDB { using BaseGdbRegCache::BaseGdbRegCache; private: - struct M5_ATTR_PACKED + struct GEM5_PACKED { uint64_t rax; uint64_t rbx; diff --git a/src/base/bmpwriter.hh b/src/base/bmpwriter.hh index 3e9f16d9b3..4d75861782 100644 --- a/src/base/bmpwriter.hh +++ b/src/base/bmpwriter.hh @@ -75,7 +75,7 @@ class BmpWriter : public ImgWriter void write(std::ostream &bmp) const override; private: - struct M5_ATTR_PACKED FileHeader + struct GEM5_PACKED FileHeader { unsigned char magic_number[2]; uint32_t size; @@ -84,7 +84,9 @@ class BmpWriter : public ImgWriter uint32_t offset; }; - struct M5_ATTR_PACKED InfoHeaderV1 { /* Aka DIB header */ + struct GEM5_PACKED InfoHeaderV1 + { + /* Aka DIB header */ uint32_t Size; uint32_t Width; uint32_t Height; @@ -98,13 +100,13 @@ class BmpWriter : public ImgWriter uint32_t ClrImportant; }; - struct M5_ATTR_PACKED CompleteV1Header + struct GEM5_PACKED CompleteV1Header { FileHeader file; InfoHeaderV1 info; }; - struct M5_ATTR_PACKED BmpPixel32 + struct GEM5_PACKED BmpPixel32 { BmpPixel32 &operator=(const Pixel &rhs) { red = rhs.red; diff --git a/src/base/inet.hh b/src/base/inet.hh index a15b93d84e..b6f0eb1575 100644 --- a/src/base/inet.hh +++ b/src/base/inet.hh @@ -565,14 +565,14 @@ struct ip6_opt_routing_type2 }; #define HOME_ADDRESS_OPTION 0xC9 -struct M5_ATTR_PACKED ip6_opt_dstopts +struct GEM5_PACKED ip6_opt_dstopts { uint8_t type; uint8_t length; ip6_addr_t addr; }; -struct M5_ATTR_PACKED ip6_opt_hdr +struct GEM5_PACKED ip6_opt_hdr { uint8_t ext_nxt; uint8_t ext_len; diff --git a/src/base/pngwriter.hh b/src/base/pngwriter.hh index a7e178428f..7163482d5e 100644 --- a/src/base/pngwriter.hh +++ b/src/base/pngwriter.hh @@ -76,7 +76,7 @@ class PngWriter : public ImgWriter void write(std::ostream &png) const override; private: /** Png Pixel type: not containing padding */ - struct M5_ATTR_PACKED PngPixel24 + struct GEM5_PACKED PngPixel24 { PngPixel24 &operator=(const Pixel &rhs) { red = rhs.red; diff --git a/src/base/vnc/vncinput.hh b/src/base/vnc/vncinput.hh index 6c7f916ba4..57e62d19b1 100644 --- a/src/base/vnc/vncinput.hh +++ b/src/base/vnc/vncinput.hh @@ -97,7 +97,7 @@ class VncInput : public SimObject ClientCutText = 6 }; - struct M5_ATTR_PACKED PixelFormat + struct GEM5_PACKED PixelFormat { uint8_t bpp; uint8_t depth; @@ -112,21 +112,21 @@ class VncInput : public SimObject uint8_t padding[3]; }; - struct M5_ATTR_PACKED PixelFormatMessage + struct GEM5_PACKED PixelFormatMessage { uint8_t type; uint8_t padding[3]; PixelFormat px; }; - struct M5_ATTR_PACKED PixelEncodingsMessage + struct GEM5_PACKED PixelEncodingsMessage { uint8_t type; uint8_t padding; uint16_t num_encodings; }; - struct M5_ATTR_PACKED FrameBufferUpdateReq + struct GEM5_PACKED FrameBufferUpdateReq { uint8_t type; uint8_t incremental; @@ -136,7 +136,7 @@ class VncInput : public SimObject uint16_t height; }; - struct M5_ATTR_PACKED KeyEventMessage + struct GEM5_PACKED KeyEventMessage { uint8_t type; uint8_t down_flag; @@ -144,7 +144,7 @@ class VncInput : public SimObject uint32_t key; }; - struct M5_ATTR_PACKED PointerEventMessage + struct GEM5_PACKED PointerEventMessage { uint8_t type; uint8_t button_mask; @@ -152,7 +152,7 @@ class VncInput : public SimObject uint16_t y; }; - struct M5_ATTR_PACKED ClientCutTextMessage + struct GEM5_PACKED ClientCutTextMessage { uint8_t type; uint8_t padding[3]; diff --git a/src/base/vnc/vncserver.hh b/src/base/vnc/vncserver.hh index 08acc43ce0..a8c2a89665 100644 --- a/src/base/vnc/vncserver.hh +++ b/src/base/vnc/vncserver.hh @@ -110,7 +110,7 @@ class VncServer : public VncInput NormalPhase }; - struct M5_ATTR_PACKED ServerInitMsg + struct GEM5_PACKED ServerInitMsg { uint16_t fbWidth; uint16_t fbHeight; @@ -119,14 +119,14 @@ class VncServer : public VncInput char name[2]; // just to put M5 in here }; - struct M5_ATTR_PACKED FrameBufferUpdate + struct GEM5_PACKED FrameBufferUpdate { uint8_t type; uint8_t padding; uint16_t num_rects; }; - struct M5_ATTR_PACKED FrameBufferRect + struct GEM5_PACKED FrameBufferRect { uint16_t x; uint16_t y; @@ -135,7 +135,7 @@ class VncServer : public VncInput int32_t encoding; }; - struct M5_ATTR_PACKED ServerCutText + struct GEM5_PACKED ServerCutText { uint8_t type; uint8_t padding[3]; diff --git a/src/cpu/kvm/x86_cpu.cc b/src/cpu/kvm/x86_cpu.cc index 1f08708425..da210df7e9 100644 --- a/src/cpu/kvm/x86_cpu.cc +++ b/src/cpu/kvm/x86_cpu.cc @@ -67,7 +67,7 @@ using namespace X86ISA; // data) is used to indicate that a segment has been accessed. #define SEG_TYPE_BIT_ACCESSED 1 -struct M5_ATTR_PACKED FXSave +struct GEM5_PACKED FXSave { uint16_t fcw; uint16_t fsw; diff --git a/src/dev/virtio/base.hh b/src/dev/virtio/base.hh index 416d3a472c..2022e28bff 100644 --- a/src/dev/virtio/base.hh +++ b/src/dev/virtio/base.hh @@ -466,7 +466,7 @@ class VirtQueue : public Serializable typedef uint16_t Flags; typedef uint16_t Index; - struct M5_ATTR_PACKED Header + struct GEM5_PACKED Header { Flags flags; Index index; diff --git a/src/dev/virtio/block.hh b/src/dev/virtio/block.hh index 8aa89aecdb..e937992f6c 100644 --- a/src/dev/virtio/block.hh +++ b/src/dev/virtio/block.hh @@ -81,7 +81,7 @@ class VirtIOBlock : public VirtIODeviceBase * @note This needs to be changed if the supported feature set * changes! */ - struct M5_ATTR_PACKED Config + struct GEM5_PACKED Config { uint64_t capacity; }; @@ -123,7 +123,7 @@ class VirtIOBlock : public VirtIODeviceBase /** @} */ /** VirtIO block device request as sent by guest */ - struct M5_ATTR_PACKED BlkRequest + struct GEM5_PACKED BlkRequest { RequestType type; uint32_t reserved; diff --git a/src/dev/virtio/console.hh b/src/dev/virtio/console.hh index dbca836447..3d2c7a2d5c 100644 --- a/src/dev/virtio/console.hh +++ b/src/dev/virtio/console.hh @@ -77,7 +77,7 @@ class VirtIOConsole : public VirtIODeviceBase * @note This needs to be changed if the multiport feature is * announced! */ - struct M5_ATTR_PACKED Config + struct GEM5_PACKED Config { uint16_t cols; uint16_t rows; diff --git a/src/dev/virtio/fs9p.hh b/src/dev/virtio/fs9p.hh index 92ce5d97f4..d32cd32c99 100644 --- a/src/dev/virtio/fs9p.hh +++ b/src/dev/virtio/fs9p.hh @@ -50,7 +50,7 @@ struct VirtIO9PBaseParams; typedef uint8_t P9MsgType; typedef uint16_t P9Tag; -struct M5_ATTR_PACKED P9MsgHeader +struct GEM5_PACKED P9MsgHeader { /** Length including header */ uint32_t len; @@ -121,7 +121,7 @@ class VirtIO9PBase : public VirtIODeviceBase * @note The fields in this structure depend on the features * exposed to the guest. */ - struct M5_ATTR_PACKED Config + struct GEM5_PACKED Config { uint16_t len; char tag[]; diff --git a/src/kern/linux/helpers.cc b/src/kern/linux/helpers.cc index 740c6a0b8a..a81f638d53 100644 --- a/src/kern/linux/helpers.cc +++ b/src/kern/linux/helpers.cc @@ -43,7 +43,7 @@ #include "sim/byteswap.hh" #include "sim/system.hh" -struct M5_ATTR_PACKED DmesgEntry +struct GEM5_PACKED DmesgEntry { uint64_t ts_nsec; uint16_t len;