summaryrefslogtreecommitdiffstats
path: root/target/sparc
diff options
context:
space:
mode:
authorThomas Huth2017-01-13 13:12:35 +0100
committerDr. David Alan Gilbert2017-02-21 19:29:01 +0100
commit854e67fea6a6f181163a5467fc9ba04de8d181bb (patch)
tree95528d10774a6b5021083310dee65c7bbe376274 /target/sparc
parentmonitor: add poll-* properties into query-iothreads result (diff)
downloadqemu-854e67fea6a6f181163a5467fc9ba04de8d181bb.tar.gz
qemu-854e67fea6a6f181163a5467fc9ba04de8d181bb.tar.xz
qemu-854e67fea6a6f181163a5467fc9ba04de8d181bb.zip
monitor: Fix crashes when using HMP commands without CPU
When running certain HMP commands ("info registers", "info cpustats", "info tlb", "nmi", "memsave" or dumping virtual memory) with the "none" machine, QEMU crashes with a segmentation fault. This happens because the "none" machine does not have any CPUs by default, but these HMP commands did not check for a valid CPU pointer yet. Add such checks now, so we get an error message about the missing CPU instead. Signed-off-by: Thomas Huth <thuth@redhat.com> Message-Id: <1484309555-1935-1-git-send-email-thuth@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Acked-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'target/sparc')
-rw-r--r--target/sparc/monitor.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/target/sparc/monitor.c b/target/sparc/monitor.c
index 7cc1b0f87f..f3ca524ae9 100644
--- a/target/sparc/monitor.c
+++ b/target/sparc/monitor.c
@@ -32,6 +32,10 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
{
CPUArchState *env1 = mon_get_cpu_env();
+ if (!env1) {
+ monitor_printf(mon, "No CPU available\n");
+ return;
+ }
dump_mmu((FILE*)mon, (fprintf_function)monitor_printf, env1);
}