On 31/05/2023 18:43, Philippe Mathieu-Daudé wrote:

On 31/5/23 14:53, Mark Cave-Ayland wrote:
Also change the instantiation of the CPU to use object_initialize_child()
followed by a separate realisation.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayl...@ilande.co.uk>
---
  hw/m68k/q800.c         | 13 ++++++++-----
  include/hw/m68k/q800.h |  2 ++
  2 files changed, 10 insertions(+), 5 deletions(-)


@@ -407,8 +407,10 @@ static void q800_machine_init(MachineState *machine)
      }
      /* init CPUs */
-    cpu = M68K_CPU(cpu_create(machine->cpu_type));
-    qemu_register_reset(main_cpu_reset, cpu);
+    object_initialize_child(OBJECT(machine), "cpu", &m->cpu,
+                            M68K_CPU_TYPE_NAME("m68040"));

Shouldn't we keep using machine->cpu_type?

If the m68040 is the single CPU usable, we should set
MachineClass::valid_cpu_types[] in q800_machine_class_init().

+    object_property_set_bool(OBJECT(&m->cpu), "realized", true, &error_fatal);
+    qemu_register_reset(main_cpu_reset, &m->cpu);

Yes I can do that: I don't think it makes any difference to the q800 machine here because the MacOS toolbox ROM doesn't appear to boot with anything other than a 68040 CPU, but it could be useful to make this explicit.


ATB,

Mark.


Reply via email to