[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [PATCH v2 5/5] target-ppc: Add CPU finalizer
From: |
David Gibson |
Subject: |
Re: [Qemu-ppc] [PATCH v2 5/5] target-ppc: Add CPU finalizer |
Date: |
Wed, 11 Apr 2012 11:06:24 +1000 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Fri, Apr 06, 2012 at 06:17:12PM +0200, Andreas Färber wrote:
> free() opcode tables. They are being malloc()'ed in create_new_table().
This doesn't seem right. Unless I've missed something in the call
path, create_new_table() is not called from the instance initializer.
So surely it should not be torn down in the instance finalizer.
> Resolves Jocelyn's TODO in former cpu_ppc_close().
>
> Signed-off-by: Andreas Färber <address@hidden>
> ---
> target-ppc/translate_init.c | 14 ++++++++++++++
> 1 files changed, 14 insertions(+), 0 deletions(-)
>
> diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
> index bb81bbc..5365229 100644
> --- a/target-ppc/translate_init.c
> +++ b/target-ppc/translate_init.c
> @@ -10261,6 +10261,19 @@ static void ppc_cpu_initfn(Object *obj)
> #endif /* !CONFIG_USER_ONLY */
> }
>
> +static void ppc_cpu_uninitfn(Object *obj)
> +{
> + PowerPCCPU *cpu = POWERPC_CPU(obj);
> + CPUPPCState *env = &cpu->env;
> + int i;
> +
> + for (i = 0; i < 0x40; i++) {
> + if (env->opcodes[i] != &invalid_handler) {
> + free(env->opcodes[i]);
> + }
> + }
> +}
> +
> static void ppc_cpu_class_init(ObjectClass *oc, void *data)
> {
> PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
> @@ -10275,6 +10288,7 @@ static const TypeInfo ppc_cpu_type_info = {
> .parent = TYPE_CPU,
> .instance_size = sizeof(PowerPCCPU),
> .instance_init = ppc_cpu_initfn,
> + .instance_finalize = ppc_cpu_uninitfn,
> .abstract = false,
> .class_size = sizeof(PowerPCCPUClass),
> .class_init = ppc_cpu_class_init,
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[Qemu-ppc] [PATCH v2 3/5] target-ppc: QOM'ify CPU init, Andreas Färber, 2012/04/06
[Qemu-ppc] [PATCH v2 5/5] target-ppc: Add CPU finalizer, Andreas Färber, 2012/04/06
- Re: [Qemu-ppc] [PATCH v2 5/5] target-ppc: Add CPU finalizer,
David Gibson <=
[Qemu-ppc] [PATCH v2 1/5] target-ppc: Drop cpu_ppc_close(), Andreas Färber, 2012/04/06
[Qemu-ppc] [PATCH v2 4/5] target-ppc: QOM'ify CPU reset, Andreas Färber, 2012/04/06
[Qemu-ppc] [PATCH v2 2/5] target-ppc: QOM'ify CPU, Andreas Färber, 2012/04/06