From: Alexander Graf <agraf@suse.de>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, Aurelien Jarno <aurelien@aurel32.net>
Subject: [Qemu-devel] [PULL 4/4] tcg/s390: fix branch target change during code retranslation
Date: Tue, 7 Jul 2015 17:52:41 +0200 [thread overview]
Message-ID: <1436284361-5745-5-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1436284361-5745-1-git-send-email-agraf@suse.de>
From: Aurelien Jarno <aurelien@aurel32.net>
Make sure to not modify the branch target. This ensure that the
branch target is not corrupted during partial retranslation.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Tested-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
tcg/s390/tcg-target.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/tcg/s390/tcg-target.c b/tcg/s390/tcg-target.c
index 669fafe..921991e 100644
--- a/tcg/s390/tcg-target.c
+++ b/tcg/s390/tcg-target.c
@@ -1643,8 +1643,10 @@ static void tcg_out_qemu_ld(TCGContext* s, TCGReg data_reg, TCGReg addr_reg,
base_reg = tcg_out_tlb_read(s, addr_reg, opc, mem_index, 1);
- label_ptr = s->code_ptr + 1;
- tcg_out_insn(s, RI, BRC, S390_CC_NE, 0);
+ /* We need to keep the offset unchanged for retranslation. */
+ tcg_out16(s, RI_BRC | (S390_CC_NE << 4));
+ label_ptr = s->code_ptr;
+ s->code_ptr += 1;
tcg_out_qemu_ld_direct(s, opc, data_reg, base_reg, TCG_REG_R2, 0);
@@ -1669,8 +1671,10 @@ static void tcg_out_qemu_st(TCGContext* s, TCGReg data_reg, TCGReg addr_reg,
base_reg = tcg_out_tlb_read(s, addr_reg, opc, mem_index, 0);
- label_ptr = s->code_ptr + 1;
- tcg_out_insn(s, RI, BRC, S390_CC_NE, 0);
+ /* We need to keep the offset unchanged for retranslation. */
+ tcg_out16(s, RI_BRC | (S390_CC_NE << 4));
+ label_ptr = s->code_ptr;
+ s->code_ptr += 1;
tcg_out_qemu_st_direct(s, opc, data_reg, base_reg, TCG_REG_R2, 0);
--
1.7.12.4
next prev parent reply other threads:[~2015-07-07 15:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-07 15:52 [Qemu-devel] [PULL 0/4] s390 patch queue 2015-07-07 Alexander Graf
2015-07-07 15:52 ` [Qemu-devel] [PULL 1/4] target-s390x: fix MOVE LONG instruction Alexander Graf
2015-07-07 15:52 ` [Qemu-devel] [PULL 2/4] target-s390x: fix EXECUTE instruction executing TRT Alexander Graf
2015-07-07 15:52 ` [Qemu-devel] [PULL 3/4] target-s390x: fix CONVERT TO BINARY (CVD, CVDY) Alexander Graf
2015-07-07 15:52 ` Alexander Graf [this message]
2015-07-08 10:40 ` [Qemu-devel] [PULL 0/4] s390 patch queue 2015-07-07 Peter Maydell
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=1436284361-5745-5-git-send-email-agraf@suse.de \
--to=agraf@suse.de \
--cc=aurelien@aurel32.net \
--cc=peter.maydell@linaro.org \
--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).