diff mbox

[RFC,v3,20/21] target-arm: Prepare halted property for CPU

Message ID 1328237992-14953-21-git-send-email-afaerber@suse.de
State New
Headers show

Commit Message

Andreas Färber Feb. 3, 2012, 2:59 a.m. UTC
Read-only and ARM-specific for now.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Anthony Liguori <anthony@codemonkey.ws>
---
 target-arm/cpu.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/target-arm/cpu.c b/target-arm/cpu.c
index 74f4e9b..4dfec15 100644
--- a/target-arm/cpu.c
+++ b/target-arm/cpu.c
@@ -20,6 +20,7 @@ 
 
 #include "cpu-core.h"
 #include "qemu-common.h"
+#include "qapi/qapi-visit-core.h"
 #if !defined(CONFIG_USER_ONLY)
 #include "hw/loader.h"
 #endif
@@ -538,6 +539,14 @@  static const ARMCPUInfo arm_cpus[] = {
     },
 };
 
+static void arm_cpu_get_halted(Object *obj, Visitor *v, void *opaque,
+                               const char *name, Error **errp)
+{
+    ARMCPU *cpu = ARM_CPU(obj);
+    bool halted = cpu->env.halted != 0;
+    visit_type_bool(v, &halted, name, errp);
+}
+
 static void arm_cpu_initfn(Object *obj)
 {
     ARMCPU *cpu = ARM_CPU(obj);
@@ -552,6 +561,9 @@  static void arm_cpu_initfn(Object *obj)
     cpu->env.cp15.c0_cpuid = cpu_class->cp15.c0_cpuid;
 
     cpu_do_reset(CPU(cpu));
+
+    object_property_add(obj, "halted", "boolean",
+                        arm_cpu_get_halted, NULL, NULL, NULL, NULL);
 }
 
 static void arm_cpu_class_init(ObjectClass *klass, void *data)