@@ -10,4 +10,4 @@ common-obj-$(CONFIG_SOFTMMU) += sysbus.o
common-obj-$(CONFIG_SOFTMMU) += null-machine.o
common-obj-$(CONFIG_SOFTMMU) += loader.o
common-obj-$(CONFIG_SOFTMMU) += qdev-properties-system.o
-
+common-obj-$(CONFIG_SOFTMMU) += machine.o
new file mode 100644
@@ -0,0 +1,38 @@
+/*
+ * QEMU Machine
+ *
+ * Copyright (C) 2013 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 "hw/boards.h"
+
+static void qemu_machine_initfn(Object *obj)
+{
+}
+
+static void qemu_machine_class_init(ObjectClass *oc, void *data)
+{
+}
+
+static const TypeInfo qemu_machine_info = {
+ .name = TYPE_QEMU_MACHINE,
+ .parent = TYPE_OBJECT,
+ .abstract = true,
+ .class_size = sizeof(QemuMachineClass),
+ .class_init = qemu_machine_class_init,
+ .instance_size = sizeof(QemuMachineState),
+ .instance_init = qemu_machine_initfn,
+};
+
+static void register_types(void)
+{
+ type_register_static(&qemu_machine_info);
+}
+
+type_init(register_types);
@@ -5,6 +5,7 @@
#include "sysemu/blockdev.h"
#include "hw/qdev.h"
+#include "qom/object.h"
typedef struct QEMUMachine QEMUMachine;
@@ -53,4 +54,39 @@ QEMUMachine *find_default_machine(void);
extern QEMUMachine *current_machine;
+#define TYPE_QEMU_MACHINE "machine"
+#define QEMU_MACHINE(obj) \
+ OBJECT_CHECK(QemuMachineState, (obj), TYPE_QEMU_MACHINE)
+#define QEMU_MACHINE_GET_CLASS(obj) \
+ OBJECT_GET_CLASS(QemuMachineClass, (obj), TYPE_QEMU_MACHINE)
+#define QEMU_MACHINE_CLASS(klass) \
+ OBJECT_CLASS_CHECK(QemuMachineClass, (klass), TYPE_QEMU_MACHINE)
+
+typedef struct QemuMachineState QemuMachineState;
+typedef struct QemuMachineClass QemuMachineClass;
+
+/**
+ * @QemuMachineClass
+ *
+ * @parent_class: opaque parent class container
+ */
+struct QemuMachineClass {
+ ObjectClass parent_class;
+
+ QEMUMachine *qemu_machine;
+};
+
+/**
+ * @QemuMachineState
+ *
+ * @parent: opaque parent object container
+ */
+struct QemuMachineState {
+ /* private */
+ Object parent;
+ /* public */
+
+ QEMUMachineInitArgs *init_args;
+};
+
#endif
The main functionality change is to convert QEMUMachine into QemuMachineClass and QEMUMachineInitArgs into QemuMachineState, instance of QemuMachineClass. As a first step, in order to make possible an incremental developement, both QEMUMachine and QEMUMachineInitArgs are being embeded into the new types. Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com> --- hw/core/Makefile.objs | 2 +- hw/core/machine.c | 38 ++++++++++++++++++++++++++++++++++++++ include/hw/boards.h | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 hw/core/machine.c