Hi Andreas and Peter, On Mon, Jul 22, 2013 at 5:29 PM, Peter Maydell <peter.mayd...@linaro.org> wrote: > On 22 July 2013 09:56, Jia Liu <pro...@gmail.com> wrote: >> Fix cpu_model by name, make any and or1200 works both OK. >> >> Signed-off-by: Jia Liu <pro...@gmail.com> >> --- >> target-openrisc/cpu.c | 16 ++++++++++++---- >> 1 file changed, 12 insertions(+), 4 deletions(-) >> >> diff --git a/target-openrisc/cpu.c b/target-openrisc/cpu.c >> index e348df0..6637166 100644 >> --- a/target-openrisc/cpu.c >> +++ b/target-openrisc/cpu.c >> @@ -100,11 +100,19 @@ static ObjectClass *openrisc_cpu_class_by_name(const >> char *cpu_model) >> typename = g_strdup_printf("%s-" TYPE_OPENRISC_CPU, cpu_model); >> oc = object_class_by_name(typename); >> g_free(typename); >> - if (oc != NULL && (!object_class_dynamic_cast(oc, TYPE_OPENRISC_CPU) || >> - object_class_is_abstract(oc))) { >> - return NULL; >> + >> + if (oc != NULL && object_class_dynamic_cast(oc, TYPE_OPENRISC_CPU) != >> NULL >> + && !object_class_is_abstract(oc)) { >> + return oc; >> } >> - return oc; >> + >> + oc = object_class_by_name(cpu_model); >> + if (oc != NULL && object_class_dynamic_cast(oc, TYPE_OPENRISC_CPU) != >> NULL >> + && !object_class_is_abstract(oc)) { >> + return oc; >> + } >> + >> + return NULL; >> } > > This looks a bit odd. The commit message suggests it's an > attempt to fix the bug that was fixed by commit 071b3364e -- > is it really needed? Andreas?
commit 071b3364e fix the typename only, but this one make "-cpu any" "-cpu or1200" "-cpu any-or32-cpu" "-cpu or1200-or32-cpu" working fine. > > thanks > -- PMM Regards, Jia