memory: Align MemoryRegionSections fields

MemoryRegionSection includes an Int128 'size' field;
on some platforms the compiler causes an alignment of this to
a 128bit boundary, leaving 8 bytes of dead space.
This deadspace can be filled with junk.

Move the size field to the top avoiding unnecessary alignment.

Backports commit c0aca9352d51c102c55fe29ce5c1bf8e74a5183e from qemu
This commit is contained in:
Dr. David Alan Gilbert 2019-11-18 16:33:19 -05:00 committed by Lioncash
parent 8264cb84fe
commit 3807ec09de
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
2 changed files with 2 additions and 2 deletions

View file

@ -262,10 +262,10 @@ FlatView *address_space_to_flatview(AddressSpace *as);
* @nonvolatile: this section is non-volatile * @nonvolatile: this section is non-volatile
*/ */
struct MemoryRegionSection { struct MemoryRegionSection {
Int128 size;
MemoryRegion *mr; MemoryRegion *mr;
FlatView *fv; FlatView *fv;
hwaddr offset_within_region; hwaddr offset_within_region;
Int128 size;
hwaddr offset_within_address_space; hwaddr offset_within_address_space;
bool readonly; bool readonly;
bool nonvolatile; bool nonvolatile;

View file

@ -1818,7 +1818,7 @@ bool memory_region_is_mapped(MemoryRegion *mr)
static MemoryRegionSection memory_region_find_rcu(MemoryRegion *mr, static MemoryRegionSection memory_region_find_rcu(MemoryRegion *mr,
hwaddr addr, uint64_t size) hwaddr addr, uint64_t size)
{ {
MemoryRegionSection ret = { NULL }; MemoryRegionSection ret = {};
MemoryRegion *root; MemoryRegion *root;
AddressSpace *as; AddressSpace *as;
AddrRange range; AddrRange range;