]> git.proxmox.com Git - qemu.git/commitdiff
tcg arm/mips/ia64: add a comment about retranslation and caches
authorAurelien Jarno <aurelien@aurel32.net>
Mon, 10 Jan 2011 17:30:05 +0000 (18:30 +0100)
committerAurelien Jarno <aurelien@aurel32.net>
Tue, 11 Jan 2011 23:06:07 +0000 (00:06 +0100)
Add a comment about cache coherency and retranslation, so that people
developping new targets based on existing ones are warned of the issue.

Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
tcg/arm/tcg-target.c
tcg/ia64/tcg-target.c
tcg/mips/tcg-target.c

index 1eb5605f8c86525c3b086ee80c3498f8180dc11c..918e2f73cb811e566b13dd3ac65e2147f1d371b7 100644 (file)
@@ -352,6 +352,9 @@ static inline void tcg_out_b(TCGContext *s, int cond, int32_t offset)
 
 static inline void tcg_out_b_noaddr(TCGContext *s, int cond)
 {
+    /* We pay attention here to not modify the branch target by skipping
+       the corresponding bytes. This ensure that caches and memory are
+       kept coherent during retranslation. */
 #ifdef HOST_WORDS_BIGENDIAN
     tcg_out8(s, (cond << 4) | 0x0a);
     s->code_ptr += 3;
index e2e44f7d7642c900d7913f8141f83cd70698052f..8dac7f72fd855369760d0ed85eade2c9f79d898b 100644 (file)
@@ -871,6 +871,9 @@ static void tcg_out_br(TCGContext *s, int label_index)
 {
     TCGLabel *l = &s->labels[label_index];
 
+    /* We pay attention here to not modify the branch target by reading
+       the existing value and using it again. This ensure that caches and
+       memory are kept coherent during retranslation. */
     tcg_out_bundle(s, mmB,
                    tcg_opc_m48(TCG_REG_P0, OPC_NOP_M48, 0),
                    tcg_opc_m48(TCG_REG_P0, OPC_NOP_M48, 0),
index 4e92a50e6f537e8e6324b0d96bcd18e7339e8dac..e04b0dc32f373d021cc6fe58132de66c0dbcb235 100644 (file)
@@ -351,7 +351,9 @@ static inline void tcg_out_opc_imm(TCGContext *s, int opc, int rt, int rs, int i
  */
 static inline void tcg_out_opc_br(TCGContext *s, int opc, int rt, int rs)
 {
-    /* We need to keep the offset unchanged for retranslation */
+    /* We pay attention here to not modify the branch target by reading
+       the existing value and using it again. This ensure that caches and
+       memory are kept coherent during retranslation. */
     uint16_t offset = (uint16_t)(*(uint32_t *) s->code_ptr);
 
     tcg_out_opc_imm(s, opc, rt, rs, offset);