diff options
author | SeokYeon Hwang <syeon.hwang@samsung.com> | 2013-12-11 10:38:35 +0900 |
---|---|---|
committer | SeokYeon Hwang <syeon.hwang@samsung.com> | 2013-12-11 14:12:09 +0900 |
commit | 1a81500c243dfe21a1c348d24b116b6315c66c83 (patch) | |
tree | 8164064245de0479a0b5ae5b026719e81420de49 /qom | |
parent | 34668d898e6581ddc47865e6de2d30b55ef47031 (diff) | |
parent | 0e7b9f06a6cc032be6ca2ac55a27592abd374179 (diff) | |
download | qemu-1a81500c243dfe21a1c348d24b116b6315c66c83.tar.gz qemu-1a81500c243dfe21a1c348d24b116b6315c66c83.tar.bz2 qemu-1a81500c243dfe21a1c348d24b116b6315c66c83.zip |
Merge branch 'upstream-1.7' into tizen_qemu_1.7
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
Conflicts:
VERSION
block/cow.c
block/raw-win32.c
block/stream.c
block/vmdk.c
blockdev.c
exec.c
hw/i386/pc_piix.c
hw/scsi/scsi-bus.c
include/qom/cpu.h
include/sysemu/kvm.h
qemu-img.c
tcg/tcg.c
tcg/tcg.h
vl.c
Change-Id: Ib8de93ad2c05150934e17e63d7f8e90ffdfccc62
Diffstat (limited to 'qom')
-rw-r--r-- | qom/cpu.c | 31 | ||||
-rw-r--r-- | qom/object.c | 88 |
2 files changed, 92 insertions, 27 deletions
@@ -25,30 +25,18 @@ #include "qemu/log.h" #include "sysemu/sysemu.h" -typedef struct CPUExistsArgs { - int64_t id; - bool found; -} CPUExistsArgs; - -static void cpu_exist_cb(CPUState *cpu, void *data) -{ - CPUClass *klass = CPU_GET_CLASS(cpu); - CPUExistsArgs *arg = data; - - if (klass->get_arch_id(cpu) == arg->id) { - arg->found = true; - } -} - bool cpu_exists(int64_t id) { - CPUExistsArgs data = { - .id = id, - .found = false, - }; + CPUState *cpu; + + CPU_FOREACH(cpu) { + CPUClass *cc = CPU_GET_CLASS(cpu); - qemu_for_each_cpu(cpu_exist_cb, &data); - return data.found; + if (cc->get_arch_id(cpu) == id) { + return true; + } + } + return false; } bool cpu_paging_enabled(const CPUState *cpu) @@ -174,6 +162,7 @@ void cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf, CPUClass *cc = CPU_GET_CLASS(cpu); if (cc->dump_state) { + cpu_synchronize_state(cpu); cc->dump_state(cpu, f, cpu_fprintf, flags); } } diff --git a/qom/object.c b/qom/object.c index 884a3e8875..309cb0a28a 100644 --- a/qom/object.c +++ b/qom/object.c @@ -51,6 +51,7 @@ struct TypeImpl void *class_data; void (*instance_init)(Object *obj); + void (*instance_post_init)(Object *obj); void (*instance_finalize)(Object *obj); bool abstract; @@ -111,6 +112,7 @@ static TypeImpl *type_register_internal(const TypeInfo *info) ti->class_data = info->class_data; ti->instance_init = info->instance_init; + ti->instance_post_init = info->instance_post_init; ti->instance_finalize = info->instance_finalize; ti->abstract = info->abstract; @@ -298,7 +300,18 @@ static void object_init_with_type(Object *obj, TypeImpl *ti) } } -void object_initialize_with_type(void *data, TypeImpl *type) +static void object_post_init_with_type(Object *obj, TypeImpl *ti) +{ + if (ti->instance_post_init) { + ti->instance_post_init(obj); + } + + if (type_has_parent(ti)) { + object_post_init_with_type(obj, type_get_parent(ti)); + } +} + +void object_initialize_with_type(void *data, size_t size, TypeImpl *type) { Object *obj = data; @@ -307,19 +320,21 @@ void object_initialize_with_type(void *data, TypeImpl *type) g_assert(type->instance_size >= sizeof(Object)); g_assert(type->abstract == false); + g_assert(size >= type->instance_size); memset(obj, 0, type->instance_size); obj->class = type->class; object_ref(obj); QTAILQ_INIT(&obj->properties); object_init_with_type(obj, type); + object_post_init_with_type(obj, type); } -void object_initialize(void *data, const char *typename) +void object_initialize(void *data, size_t size, const char *typename) { TypeImpl *type = type_get_by_name(typename); - object_initialize_with_type(data, type); + object_initialize_with_type(data, size, type); } static inline bool object_property_is_child(ObjectProperty *prop) @@ -410,7 +425,7 @@ Object *object_new_with_type(Type type) type_initialize(type); obj = g_malloc(type->instance_size); - object_initialize_with_type(obj, type); + object_initialize_with_type(obj, type->instance_size, type); obj->free = g_free; return obj; @@ -828,8 +843,9 @@ char *object_property_get_str(Object *obj, const char *name, void object_property_set_link(Object *obj, Object *value, const char *name, Error **errp) { - object_property_set_str(obj, object_get_canonical_path(value), - name, errp); + gchar *path = object_get_canonical_path(value); + object_property_set_str(obj, path, name, errp); + g_free(path); } Object *object_property_get_link(Object *obj, const char *name, @@ -1334,6 +1350,66 @@ static char *qdev_get_type(Object *obj, Error **errp) return g_strdup(object_get_typename(obj)); } +static void property_get_uint8_ptr(Object *obj, Visitor *v, + void *opaque, const char *name, + Error **errp) +{ + uint8_t value = *(uint8_t *)opaque; + visit_type_uint8(v, &value, name, errp); +} + +static void property_get_uint16_ptr(Object *obj, Visitor *v, + void *opaque, const char *name, + Error **errp) +{ + uint16_t value = *(uint16_t *)opaque; + visit_type_uint16(v, &value, name, errp); +} + +static void property_get_uint32_ptr(Object *obj, Visitor *v, + void *opaque, const char *name, + Error **errp) +{ + uint32_t value = *(uint32_t *)opaque; + visit_type_uint32(v, &value, name, errp); +} + +static void property_get_uint64_ptr(Object *obj, Visitor *v, + void *opaque, const char *name, + Error **errp) +{ + uint64_t value = *(uint64_t *)opaque; + visit_type_uint64(v, &value, name, errp); +} + +void object_property_add_uint8_ptr(Object *obj, const char *name, + const uint8_t *v, Error **errp) +{ + object_property_add(obj, name, "uint8", property_get_uint8_ptr, + NULL, NULL, (void *)v, errp); +} + +void object_property_add_uint16_ptr(Object *obj, const char *name, + const uint16_t *v, Error **errp) +{ + object_property_add(obj, name, "uint16", property_get_uint16_ptr, + NULL, NULL, (void *)v, errp); +} + +void object_property_add_uint32_ptr(Object *obj, const char *name, + const uint32_t *v, Error **errp) +{ + object_property_add(obj, name, "uint32", property_get_uint32_ptr, + NULL, NULL, (void *)v, errp); +} + +void object_property_add_uint64_ptr(Object *obj, const char *name, + const uint64_t *v, Error **errp) +{ + object_property_add(obj, name, "uint64", property_get_uint64_ptr, + NULL, NULL, (void *)v, errp); +} + static void object_instance_init(Object *obj) { object_property_add_str(obj, "type", qdev_get_type, NULL, NULL); |