|
From: | Philippe Mathieu-Daudé |
Subject: | Re: [PATCH 10/15] memory: Replace current_machine by qdev_get_machine() |
Date: | Sun, 12 Jan 2020 14:45:08 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 |
On 1/12/20 10:48 AM, Alistair Francis wrote:
On Thu, Jan 9, 2020 at 11:29 PM Philippe Mathieu-Daudé <address@hidden> wrote:As we want to remove the global current_machine, replace 'current_machine' by MACHINE(qdev_get_machine()). Signed-off-by: Philippe Mathieu-Daudé <address@hidden> --- memory.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/memory.c b/memory.c index d7b9bb6951..57e38b1f50 100644 --- a/memory.c +++ b/memory.c @@ -3004,6 +3004,7 @@ static void mtree_print_flatview(gpointer key, gpointer value, int n = view->nr; int i; AddressSpace *as; + MachineState *ms; qemu_printf("FlatView #%d\n", fvi->counter); ++fvi->counter; @@ -3026,6 +3027,7 @@ static void mtree_print_flatview(gpointer key, gpointer value, return; } + ms = MACHINE(qdev_get_machine());Why not set this at the top?
Calling qdev_get_machine() is not free as it does some introspection checks. Since we can return earlier if there are no rendered FlatView, I placed the machinestate initialization just before it we need to access it.
Alistairwhile (n--) { mr = range->mr; if (range->offset_in_region) { @@ -3057,7 +3059,7 @@ static void mtree_print_flatview(gpointer key, gpointer value, if (fvi->ac) { for (i = 0; i < fv_address_spaces->len; ++i) { as = g_array_index(fv_address_spaces, AddressSpace*, i); - if (fvi->ac->has_memory(current_machine, as, + if (fvi->ac->has_memory(ms, as, int128_get64(range->addr.start), MR_SIZE(range->addr.size) + 1)) { qemu_printf(" %s", fvi->ac->name); -- 2.21.1
[Prev in Thread] | Current Thread | [Next in Thread] |