unicorn/qemu/hw/core/machine.c

62 lines
1.3 KiB
C
Raw Normal View History

2015-08-21 07:04:50 +00:00
/*
* QEMU Machine
*
* Copyright (C) 2014 Red Hat Inc
*
* Authors:
* Marcel Apfelbaum <marcel.a@redhat.com>
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/
#include "qemu/osdep.h"
2015-08-21 07:04:50 +00:00
#include "hw/boards.h"
#include "qapi/error.h"
#include "qemu/cutils.h"
2015-08-21 07:04:50 +00:00
static void machine_class_base_init(struct uc_struct *uc, ObjectClass *oc, void *data)
{
if (!object_class_is_abstract(oc)) {
MachineClass *mc = MACHINE_CLASS(uc, oc);
const char *cname = object_class_get_name(oc);
assert(g_str_has_suffix(cname, TYPE_MACHINE_SUFFIX));
mc->name = g_strndup(cname,
strlen(cname) - strlen(TYPE_MACHINE_SUFFIX));
}
}
2015-08-21 07:04:50 +00:00
static void machine_initfn(struct uc_struct *uc, Object *obj, void *opaque)
{
}
static void machine_finalize(struct uc_struct *uc, Object *obj, void *opaque)
{
}
static const TypeInfo machine_info = {
TYPE_MACHINE,
TYPE_OBJECT,
2017-01-22 13:27:17 +00:00
sizeof(MachineClass),
sizeof(MachineState),
NULL,
machine_initfn,
NULL,
machine_finalize,
2017-01-22 13:27:17 +00:00
NULL,
NULL,
machine_class_base_init,
NULL,
true,
2015-08-21 07:04:50 +00:00
};
void machine_register_types(struct uc_struct *uc)
{
type_register_static(uc, &machine_info);
}