mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-22 17:42:10 -06:00
memory: Split mtree_info() as mtree_info_flatview() + mtree_info_as()
While mtree_info() handles both ASes and flatviews cases, the two cases share basically no code. Split mtree_info() as mtree_info_flatview() + mtree_info_as() to simplify. Suggested-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: David Hildenbrand <david@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210904231101.1071929-2-philmd@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
This commit is contained in:
parent
1a59bdba4b
commit
670c0780e7
1 changed files with 48 additions and 39 deletions
|
@ -3284,19 +3284,15 @@ static gboolean mtree_info_flatview_free(gpointer key, gpointer value,
|
|||
return true;
|
||||
}
|
||||
|
||||
void mtree_info(bool flatview, bool dispatch_tree, bool owner, bool disabled)
|
||||
static void mtree_info_flatview(bool dispatch_tree, bool owner)
|
||||
{
|
||||
MemoryRegionListHead ml_head;
|
||||
MemoryRegionList *ml, *ml2;
|
||||
AddressSpace *as;
|
||||
|
||||
if (flatview) {
|
||||
FlatView *view;
|
||||
struct FlatViewInfo fvi = {
|
||||
.counter = 0,
|
||||
.dispatch_tree = dispatch_tree,
|
||||
.owner = owner,
|
||||
};
|
||||
AddressSpace *as;
|
||||
FlatView *view;
|
||||
GArray *fv_address_spaces;
|
||||
GHashTable *views = g_hash_table_new(g_direct_hash, g_direct_equal);
|
||||
AccelClass *ac = ACCEL_GET_CLASS(current_accel());
|
||||
|
@ -3324,9 +3320,13 @@ void mtree_info(bool flatview, bool dispatch_tree, bool owner, bool disabled)
|
|||
/* Free */
|
||||
g_hash_table_foreach_remove(views, mtree_info_flatview_free, 0);
|
||||
g_hash_table_unref(views);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
static void mtree_info_as(bool dispatch_tree, bool owner, bool disabled)
|
||||
{
|
||||
MemoryRegionListHead ml_head;
|
||||
MemoryRegionList *ml, *ml2;
|
||||
AddressSpace *as;
|
||||
|
||||
QTAILQ_INIT(&ml_head);
|
||||
|
||||
|
@ -3348,6 +3348,15 @@ void mtree_info(bool flatview, bool dispatch_tree, bool owner, bool disabled)
|
|||
}
|
||||
}
|
||||
|
||||
void mtree_info(bool flatview, bool dispatch_tree, bool owner, bool disabled)
|
||||
{
|
||||
if (flatview) {
|
||||
mtree_info_flatview(dispatch_tree, owner);
|
||||
} else {
|
||||
mtree_info_as(dispatch_tree, owner, disabled);
|
||||
}
|
||||
}
|
||||
|
||||
void memory_region_init_ram(MemoryRegion *mr,
|
||||
Object *owner,
|
||||
const char *name,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue