summaryrefslogtreecommitdiffstats
path: root/tcg/s390/tcg-target.c
diff options
context:
space:
mode:
authorAurelien Jarno2015-06-16 07:11:41 +0200
committerAlexander Graf2015-07-07 17:51:47 +0200
commitcd3b29b745b0ff393b2d37317837bc726b8dacc8 (patch)
treeefec56fae791245ab0cbf51ca44a9c60616cdfcf /tcg/s390/tcg-target.c
parenttarget-s390x: fix CONVERT TO BINARY (CVD, CVDY) (diff)
downloadqemu-cd3b29b745b0ff393b2d37317837bc726b8dacc8.tar.gz
qemu-cd3b29b745b0ff393b2d37317837bc726b8dacc8.tar.xz
qemu-cd3b29b745b0ff393b2d37317837bc726b8dacc8.zip
tcg/s390: fix branch target change during code retranslation
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>
Diffstat (limited to 'tcg/s390/tcg-target.c')
-rw-r--r--tcg/s390/tcg-target.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/tcg/s390/tcg-target.c b/tcg/s390/tcg-target.c
index 669fafe24f..921991ebfa 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);