From: Alexander Graf <agraf@suse.de>
To: qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org
Subject: [Qemu-devel] [PATCH 1/2] PPC: Fix TCG chunks that don't free their temps
Date: Sun, 19 Jan 2014 17:32:15 +0100 [thread overview]
Message-ID: <1390149136-1041-2-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1390149136-1041-1-git-send-email-agraf@suse.de>
We want to make sure that every instruction cleans up after itself and
clears every temporary it allocated.
While checking whether this is already the case, I came across a few
cases where it isn't. This patch fixes every translation I found that
doesn't free their allocated temporaries.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
target-ppc/translate.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index 31f32df..02cd18e 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -1177,6 +1177,7 @@ static inline void gen_op_arith_subf(DisasContext *ctx, TCGv ret, TCGv arg1,
}
tcg_gen_xor_tl(t1, arg2, inv1); /* add without carry */
tcg_gen_add_tl(t0, t0, inv1);
+ tcg_temp_free(inv1);
tcg_gen_xor_tl(cpu_ca, t0, t1); /* bits changes w/ carry */
tcg_temp_free(t1);
tcg_gen_shri_tl(cpu_ca, cpu_ca, 32); /* extract bit 32 */
@@ -3714,6 +3715,9 @@ static inline void gen_bcond(DisasContext *ctx, int type)
gen_update_nip(ctx, ctx->nip);
tcg_gen_exit_tb(0);
}
+ if (type == BCOND_LR || type == BCOND_CTR) {
+ tcg_temp_free(target);
+ }
}
static void gen_bc(DisasContext *ctx)
@@ -4156,6 +4160,7 @@ static void gen_mtmsr(DisasContext *ctx)
tcg_gen_mov_tl(msr, cpu_gpr[rS(ctx->opcode)]);
#endif
gen_helper_store_msr(cpu_env, msr);
+ tcg_temp_free(msr);
/* Must stop the translation as machine state (may have) changed */
/* Note that mtmsr is not always defined as context-synchronizing */
gen_stop_exception(ctx);
@@ -6290,6 +6295,7 @@ static void gen_tlbsx_booke206(DisasContext *ctx)
tcg_gen_add_tl(t0, t0, cpu_gpr[rB(ctx->opcode)]);
gen_helper_booke206_tlbsx(cpu_env, t0);
+ tcg_temp_free(t0);
#endif
}
@@ -6323,6 +6329,7 @@ static void gen_tlbivax_booke206(DisasContext *ctx)
gen_addr_reg_index(ctx, t0);
gen_helper_booke206_tlbivax(cpu_env, t0);
+ tcg_temp_free(t0);
#endif
}
--
1.8.1.4
next prev parent reply other threads:[~2014-01-19 16:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-19 16:32 [Qemu-devel] [PATCH 0/2] PPC: Check for temporary leakage Alexander Graf
2014-01-19 16:32 ` Alexander Graf [this message]
2014-01-19 16:32 ` [Qemu-devel] [PATCH 2/2] PPC: Fail on leaking temporaries Alexander Graf
2014-01-19 16:51 ` Peter Maydell
2014-01-19 20:15 ` Alexander Graf
2014-01-19 20:52 ` Peter Maydell
2014-01-19 20:55 ` Alexander Graf
2014-01-19 21:04 ` Peter Maydell
2014-01-19 21:17 ` Alexander Graf
-- strict thread matches above, loose matches on Subject: below --
2014-05-15 16:28 [Qemu-devel] [PATCH 0/2] PPC: Avoid temporary leaks Alexander Graf
2014-05-15 16:28 ` [Qemu-devel] [PATCH 1/2] PPC: Fix TCG chunks that don't free their temps Alexander Graf
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=1390149136-1041-2-git-send-email-agraf@suse.de \
--to=agraf@suse.de \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.