memory: Provide an equality function for MemoryRegionSections

Provide a comparison function that checks all the fields are the same.

Backports commit 42b6571357a083f721a27daa6dfdc69e4bd516bd from qemu
This commit is contained in:
Dr. David Alan Gilbert 2019-11-18 16:34:08 -05:00 committed by Lioncash
parent 3807ec09de
commit 0b8add4e6f
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -271,6 +271,18 @@ struct MemoryRegionSection {
bool nonvolatile;
};
static inline bool MemoryRegionSection_eq(MemoryRegionSection *a,
MemoryRegionSection *b)
{
return a->mr == b->mr &&
a->fv == b->fv &&
a->offset_within_region == b->offset_within_region &&
a->offset_within_address_space == b->offset_within_address_space &&
int128_eq(a->size, b->size) &&
a->readonly == b->readonly &&
a->nonvolatile == b->nonvolatile;
}
static inline MemoryRegionSection MemoryRegionSection_make(MemoryRegion *mr, FlatView *fv,
hwaddr offset_within_region, Int128 size, hwaddr offset_within_address_space, bool readonly)
{