qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Blue Swirl <blauwirbel@gmail.com>
To: Aurelien Jarno <aurelien@aurel32.net>,
	qemu-devel <qemu-devel@nongnu.org>
Subject: [Qemu-devel] [PATCH, RFC] mips: fix cpu_reset memory leak
Date: Sun, 8 Nov 2009 12:50:21 +0200	[thread overview]
Message-ID: <f43fc5580911080250t1f126ee6y63e5c07c78a30465@mail.gmail.com> (raw)

Both mmu_init() and mvp_init() allocate structures, so call cpu_mips_register
only when creating a CPU.

In addition, maybe some of the some of the field initialization stuff
in  cpu_mips_register, mmu_init, mvp_init, fpu_init etc. should be
moved to cpu_reset instead, in case the fields should be reset to
original values during CPU reset. Maximally only the env->mvp etc.
structure allocation would be left to cpu_mips_register. This is the
minimal version, but it may be incorrect. Comments?

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 target-mips/translate.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/target-mips/translate.c b/target-mips/translate.c
index 58f483f..738efb7 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -8601,6 +8601,7 @@ CPUMIPSState *cpu_mips_init (const char *cpu_model)

     cpu_exec_init(env);
     env->cpu_model_str = cpu_model;
+    cpu_mips_register(env, def);
     mips_tcg_init();
     cpu_reset(env);
     qemu_init_vcpu(env);
@@ -8654,7 +8655,6 @@ void cpu_reset (CPUMIPSState *env)
     env->hflags = MIPS_HFLAG_CP0;
 #endif
     env->exception_index = EXCP_NONE;
-    cpu_mips_register(env, env->cpu_model);
 }

 void gen_pc_load(CPUState *env, TranslationBlock *tb,
-- 
1.6.2.4

             reply	other threads:[~2009-11-08 10:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-08 10:50 Blue Swirl [this message]
2009-11-10 15:30 ` [Qemu-devel] [PATCH, RFC] mips: fix cpu_reset memory leak Aurelien Jarno
2009-11-14  1:56   ` Aurelien Jarno

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f43fc5580911080250t1f126ee6y63e5c07c78a30465@mail.gmail.com \
    --to=blauwirbel@gmail.com \
    --cc=aurelien@aurel32.net \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).