aboutsummaryrefslogtreecommitdiff
path: root/qom/cpu.c
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-05-28 13:52:01 +0200
committerAndreas Färber <afaerber@suse.de>2013-06-11 18:03:35 +0200
commita23bbfda75118eb738acce84afd64965934828f0 (patch)
tree657bf51b76711385cea7df8464d32bf7bd620f84 /qom/cpu.c
parent6d4d3ae77dbb756d454c2deb2ef844b0cc7bde7b (diff)
cpu: Turn cpu_get_memory_mapping() into a CPUState hook
Change error reporting from return value to Error argument. Reviewed-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> [AF: Fixed cpu_get_memory_mapping() documentation] Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'qom/cpu.c')
-rw-r--r--qom/cpu.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/qom/cpu.c b/qom/cpu.c
index 9f6da0fdd8..b25fbc9f5a 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -62,6 +62,21 @@ static bool cpu_common_get_paging_enabled(const CPUState *cpu)
return true;
}
+void cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList *list,
+ Error **errp)
+{
+ CPUClass *cc = CPU_GET_CLASS(cpu);
+
+ return cc->get_memory_mapping(cpu, list, errp);
+}
+
+static void cpu_common_get_memory_mapping(CPUState *cpu,
+ MemoryMappingList *list,
+ Error **errp)
+{
+ error_setg(errp, "Obtaining memory mappings is unsupported on this CPU.");
+}
+
/* CPU hot-plug notifiers */
static NotifierList cpu_added_notifiers =
NOTIFIER_LIST_INITIALIZER(cpu_add_notifiers);
@@ -189,6 +204,7 @@ static void cpu_class_init(ObjectClass *klass, void *data)
k->reset = cpu_common_reset;
k->get_arch_id = cpu_common_get_arch_id;
k->get_paging_enabled = cpu_common_get_paging_enabled;
+ k->get_memory_mapping = cpu_common_get_memory_mapping;
k->write_elf32_qemunote = cpu_common_write_elf32_qemunote;
k->write_elf32_note = cpu_common_write_elf32_note;
k->write_elf64_qemunote = cpu_common_write_elf64_qemunote;