+2010-12-15 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-memopt.c (OPTION_MAP_INFO): Define.
+ (memory_options): Handle --map-info.
+ (memory_option_handler): Handle OPTION_MAP_INFO.
+
2010-11-22 Mike Frysinger <vapier@gentoo.org>
* sim-profile.c (PROFILE_PC_FREQ, PROFILE_PC_NR_BUCKETS,
OPTION_MEMORY_ALIAS,
OPTION_MEMORY_CLEAR,
OPTION_MEMORY_FILL,
- OPTION_MEMORY_MAPFILE
+ OPTION_MEMORY_MAPFILE,
+ OPTION_MAP_INFO
};
static DECLARE_OPTION_HANDLER (memory_option_handler);
{ {"info-memory", no_argument, NULL, OPTION_MEMORY_INFO },
'\0', NULL, NULL,
memory_option_handler },
+ { {"map-info", no_argument, NULL, OPTION_MAP_INFO },
+ '\0', NULL, "List mapped regions",
+ memory_option_handler },
{ {NULL, no_argument, NULL, 0}, '\0', NULL, NULL, NULL }
};
break;
}
+ case OPTION_MAP_INFO:
+ {
+ sim_core *memory = STATE_CORE (sd);
+ unsigned nr_map;
+
+ for (nr_map = 0; nr_map < nr_maps; ++nr_map)
+ {
+ sim_core_map *map = &memory->common.map[nr_map];
+ sim_core_mapping *mapping = map->first;
+
+ if (!mapping)
+ continue;
+
+ sim_io_printf (sd, "%s maps:\n", map_to_str (nr_map));
+ do
+ {
+ unsigned modulo;
+
+ sim_io_printf (sd, " map ");
+ if (mapping->space != 0)
+ sim_io_printf (sd, "0x%x:", mapping->space);
+ sim_io_printf (sd, "0x%08lx", (long) mapping->base);
+ if (mapping->level != 0)
+ sim_io_printf (sd, "@0x%x", mapping->level);
+ sim_io_printf (sd, ",0x%lx", (long) mapping->nr_bytes);
+ modulo = mapping->mask + 1;
+ if (modulo != 0)
+ sim_io_printf (sd, "%%0x%x", modulo);
+ sim_io_printf (sd, "\n");
+
+ mapping = mapping->next;
+ }
+ while (mapping);
+ }
+
+ return SIM_RC_OK;
+ break;
+ }
+
default:
sim_io_eprintf (sd, "Unknown memory option %d\n", opt);
return SIM_RC_FAIL;