On 9/8/23 04:22, Philippe Mathieu-Daudé wrote:
+++ b/hw/core/cpu-common.c @@ -157,7 +157,8 @@ ObjectClass *cpu_class_by_name(const char *typename, const char *cpu_model) cc = CPU_CLASS(oc); assert(cc->cpu_resolving_type && cc->class_by_name); oc = cc->class_by_name(cpu_model); - if (oc == NULL || object_class_is_abstract(oc)) { + if (oc == NULL || object_class_is_abstract(oc) + || !object_class_dynamic_cast(oc, cc->cpu_resolving_type)) { return NULL; }
cc->cpu_resolving_type, as constructed in patch 3, is always @typename. In the only (!) caller in toplevel/cpu.c, this is CPU_RESOLVING_TYPE. Indentation: if (oc == NULL || object_class_is_abstract(oc) || !object_class_dynamic_cast(oc, typename) r~