target-openrisc hw/openrisc: Some OpenRISC fix.
v2 cover target-openrisc hw/openrisc: Some OpenRISC fix.
Fix OpenRISC CPU and sim broad, we should free typename and check cpu models by name in cpu.c, and we should use stderr output in openrisc_sim.c.
Jia Liu (4):
hw/openrisc: Indent typo
hw/openrisc: Use stderr output instead of qemu_log
target-openrisc: Free typename
target-openrisc: Fix cpu_model by name
hw/openrisc/openrisc_sim.c | 8 ++++---- target-openrisc/cpu.c | 17 +++++++++++++---- 2 files changed, 17 insertions(+), 8 deletions(-)
Signature · 1 line
1.7.12.4 (Apple Git-37)
PATCH v2 1/4 hw/openrisc: Indent typo
Indent typo.
--- hw/openrisc/openrisc_sim.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/openrisc/openrisc_sim.c +2 -2
@@ -83,7 +83,7 @@ static void cpu_openrisc_load_kernel(ram_addr_t ram_size,if (kernel_size <0 ) {qemu_log ("QEMU: couldn't load the kernel '%s'\n" , - kernel_filename); + kernel_filename);exit (1 ); } }
@@ -96,7 +96,7 @@ static void openrisc_sim_init(QEMUMachineInitArgs *args)ram_addr_t ram_size = args->ram_size;const char *cpu_model = args->cpu_model;const char *kernel_filename = args->kernel_filename; -OpenRISCCPU *cpu =NULL ; +OpenRISCCPU *cpu =NULL ;MemoryRegion *ram;int n;
Signature · 1 line
1.7.12.4 (Apple Git-37)
PATCH v2 2/4 hw/openrisc: Use stderr output instead of qemu_log
In reply to Jia LiuWe should use stderr output instead of qemu_log in order to output ErrMsg onto the screen.
--- hw/openrisc/openrisc_sim.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
hw/openrisc/openrisc_sim.c +3 -3
@@ -82,8 +82,8 @@ static void cpu_openrisc_load_kernel(ram_addr_t ram_size, }if (kernel_size <0 ) { -qemu_log ("QEMU: couldn't load the kernel '%s'\n" , - kernel_filename); +printf (stderr,"QEMU: couldn't load the kernel '%s'\n" , + kernel_filename);exit (1 ); } }
@@ -107,7 +107,7 @@ static void openrisc_sim_init(QEMUMachineInitArgs *args)for (n =0 ; n < smp_cpus; n++) { cpu =cpu_openrisc_init (cpu_model);if (cpu ==NULL ) { -qemu_log ("Unable to find CPU definition!\n" ); +fprintf (stderr,"Unable to find CPU definition!\n" );exit (1 ); }qemu_register_reset (main_cpu_reset, cpu);
Signature · 1 line
1.7.12.4 (Apple Git-37)
PATCH v2 3/4 target-openrisc: Free typename
In reply to Jia LiuWe should free typename here.
--- target-openrisc/cpu.c | 1 + 1 file changed, 1 insertion(+)
target-openrisc/cpu.c +1 -0
@@ -99,6 +99,7 @@ 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 ;
Signature · 1 line
1.7.12.4 (Apple Git-37)
Re: [Qemu-devel] [PATCH 3/4] target-openrisc: Free typename
Quoted 2 lines · Jia Liu
We should free typename here.
Sorry, I forgot add V2 in title.
Quoted 20 lines
Signed-off-by Jia Liu <[email protected]>--- target-openrisc/cpu.c | 1 + 1 file changed, 1 insertion(+)target-openrisc/cpu.c +1
-1@@ -99,6 +99,7 @@ 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 ; --1.7.12.4 (Apple Git-37)
Re: [Qemu-devel] [PATCH 3/4] target-openrisc: Free typename
In reply to Jia LiuAm 16.07.2013 04:00, schrieb Jia Liu:
Quoted 12 lines
We should free typename here.
Signed-off-by Jia Liu <[email protected]>--- target-openrisc/cpu.c | 1 + 1 file changed, 1 insertion(+)target-openrisc/cpu.c +0
-0
target-openrisc/cpu.c static ObjectClass *openrisc_cpu_class_by_name(const char *cpu_model) · line 105
Quoted 7 lines
target-openrisc/cpu.c +1
-0@@ -99,6 +99,7 @@ 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 ;
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] [PATCH 3/4] target-openrisc: Free typename
Hi Andreas,
Quoted 14 lines · Andreas Färber
Am 16.07.2013 04:00, schrieb Jia Liu:
Quoted 13 lines
We should free typename here.
Signed-off-by Jia Liu <[email protected]>--- target-openrisc/cpu.c | 1 + 1 file changed, 1 insertion(+)target-openrisc/cpu.c +0
-0@@ -99,6 +99,7 @@ static ObjectClass *openrisc_cpu_class_by_name(const char *cpu_model)
Quoted 8 lines
target-openrisc/cpu.c static ObjectClass *openrisc_cpu_class_by_name(const char *cpu_model) · line 105
Quoted 6 lines
target-openrisc/cpu.c +1
-0typename =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 ;Reviewed-by Andreas Färber <[email protected]>
Thank you, Andreas.
May you want to review the other three? :) I've tested them all.
Quoted 6 lines
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Regards,
Jia.
PATCH v2 4/4 target-openrisc: Fix cpu_model by name
In reply to Jia LiuFix cpu_model by name, make any and or1200 works both OK.
--- target-openrisc/cpu.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
target-openrisc/cpu.c +12 -4
@@ -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 ; }static void or1200_initfn (Object *obj)
Signature · 1 line
1.7.12.4 (Apple Git-37)
Re: [Qemu-devel] [PATCH 4/4] target-openrisc: Fix cpu_model by name
Quoted 2 lines · Jia Liu
Fix
cpu_modelby name, make any and or1200 works both OK.
Sorry, I forgot add V2 in title.
Quoted 36 lines
Signed-off-by Jia Liu <[email protected]>--- target-openrisc/cpu.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)target-openrisc/cpu.c +12
-5@@ -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 ; }static void or1200_initfn (Object *obj) --1.7.12.4 (Apple Git-37)