On 2011-09-17 21:27, Blue Swirl wrote:
> Add a monitor command 'info mtree' to show the memory hierarchy
> much like /proc/iomem in Linux.
> 
> Signed-off-by: Blue Swirl <blauwir...@gmail.com>
> ---
> v1->v2: use /proc/iomem format.
> ---
>  memory.c  |   27 +++++++++++++++++++++++++++
>  memory.h  |    2 ++
>  monitor.c |    7 +++++++
>  3 files changed, 36 insertions(+), 0 deletions(-)
> 
> diff --git a/memory.c b/memory.c
> index 101b67c..275f5cf 100644
> --- a/memory.c
> +++ b/memory.c
> @@ -17,6 +17,7 @@
>  #include "bitops.h"
>  #include "kvm.h"
>  #include <assert.h>
> +#include "monitor.h"
> 
>  unsigned memory_region_transaction_depth = 0;
> 
> @@ -1253,3 +1254,29 @@ void set_system_io_map(MemoryRegion *mr)
>      address_space_io.root = mr;
>      memory_region_update_topology();
>  }
> +
> +static void mtree_print_mr(Monitor *mon, MemoryRegion *mr, unsigned int 
> level)
> +{
> +    MemoryRegion *submr;
> +    unsigned int i;
> +
> +    for (i = 0; i < level; i++) {
> +        monitor_printf(mon, "  ");
> +    }
> +    monitor_printf(mon, TARGET_FMT_plx "-" TARGET_FMT_plx " : %s\n",
> +                   mr->addr, mr->addr + (target_phys_addr_t)mr->size - 1,
> +                   mr->name);

I would prefer absolute addresses here. And the priority field needs to
be dumped as well.

Jan

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to