Skip to contentSkip to conversation

tcg: fixes for MIPS and S390 hosts

PATCH In review Aurelien Jarno 2 participants 5 messages Jul 30, 2015 – Jul 31, 2015

lore
Share & tools
lore
#0 lore raw

cover tcg: fixes for MIPS and S390 hosts

These are small fixes for MIPS and S390 hosts, found by testing various guests on these hosts.

Aurelien Jarno (3):
tcg/mips: fix TLB loading for BE host with 32-bit guests tcg/mips: Mask TCGMemOp appropriately for indexing tcg/s390x: Mask TCGMemOp appropriately for indexing

 tcg/mips/tcg-target.c | 8 +++++---
 tcg/s390/tcg-target.c | 4 ++--
 2 files changed, 7 insertions(+), 5 deletions(-)
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/3 tcg/mips: fix TLB loading for BE host with 32-bit guests

For 32-bit guest, we load a 32-bit address from the TLB, so there is no need to compensate for the low or high part. This fixes 32-bit guests on big-endian hosts.

Cc Richard Henderson <[email protected]>
---
 tcg/mips/tcg-target.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tcg/mips/tcg-target.c +3 -1
index 6680299..8dce19c 100644
@@ -963,9 +963,11 @@ static void tcg_out_tlb_load(TCGContext *s, TCGReg base, TCGReg addrl,
     }
 
     /* Load the tlb comparator.  */
-    tcg_out_opc_imm(s, OPC_LW, TCG_TMP0, TCG_REG_A0, cmp_off + LO_OFF);
     if (TARGET_LONG_BITS == 64) {
+        tcg_out_opc_imm(s, OPC_LW, TCG_TMP0, TCG_REG_A0, cmp_off + LO_OFF);
         tcg_out_opc_imm(s, OPC_LW, base, TCG_REG_A0, cmp_off + HI_OFF);
+    } else {
+        tcg_out_opc_imm(s, OPC_LW, TCG_TMP0, TCG_REG_A0, cmp_off);
     }
 
     /* Mask the page bits, keeping the alignment bits to compare against.
Signature · 1 line
2.1.4
#2 lore raw

PATCH 2/3 tcg/mips: Mask TCGMemOp appropriately for indexing

In reply to Aurelien Jarno

Commit 2b7ec66f fixed TCGMemOp masking following the MO_AMASK addition, but two cases were forgotten in the TCG MIPS backend.

Cc Richard Henderson <[email protected]>
---
 tcg/mips/tcg-target.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tcg/mips/tcg-target.c +2 -2
index 8dce19c..064db46 100644
@@ -1105,7 +1105,7 @@ static void tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *l)
 static void tcg_out_qemu_ld_direct(TCGContext *s, TCGReg datalo, TCGReg datahi,
                                    TCGReg base, TCGMemOp opc)
 {
-    switch (opc) {
+    switch (opc & (MO_SSIZE | MO_BSWAP)) {
     case MO_UB:
         tcg_out_opc_imm(s, OPC_LBU, datalo, base, 0);
         break;
@@ -1195,7 +1195,7 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, bool is_64)
 static void tcg_out_qemu_st_direct(TCGContext *s, TCGReg datalo, TCGReg datahi,
                                    TCGReg base, TCGMemOp opc)
 {
-    switch (opc) {
+    switch (opc & (MO_SIZE | MO_BSWAP)) {
     case MO_8:
         tcg_out_opc_imm(s, OPC_SB, datalo, base, 0);
         break;
Signature · 1 line
2.1.4
#3 lore raw

PATCH 3/3 tcg/s390x: Mask TCGMemOp appropriately for indexing

In reply to Aurelien Jarno

Commit 2b7ec66f fixed TCGMemOp masking following the MO_AMASK addition, but two cases were forgotten in the TCG S390 backend.

Cc Richard Henderson <[email protected]>
---
 tcg/s390/tcg-target.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tcg/s390/tcg-target.c +2 -2
index 921991e..aa718ec 100644
@@ -1390,7 +1390,7 @@ static void tcg_out_call(TCGContext *s, tcg_insn_unit *dest)
 static void tcg_out_qemu_ld_direct(TCGContext *s, TCGMemOp opc, TCGReg data,
                                    TCGReg base, TCGReg index, int disp)
 {
-    switch (opc) {
+    switch (opc & (MO_SSIZE | MO_BSWAP)) {
     case MO_UB:
         tcg_out_insn(s, RXY, LLGC, data, base, index, disp);
         break;
@@ -1449,7 +1449,7 @@ static void tcg_out_qemu_ld_direct(TCGContext *s, TCGMemOp opc, TCGReg data,
 static void tcg_out_qemu_st_direct(TCGContext *s, TCGMemOp opc, TCGReg data,
                                    TCGReg base, TCGReg index, int disp)
 {
-    switch (opc) {
+    switch (opc & (MO_SIZE | MO_BSWAP)) {
     case MO_UB:
         if (disp >= 0 && disp < 0x1000) {
             tcg_out_insn(s, RX, STC, data, base, index, disp);
Signature · 1 line
2.1.4
Reviewed-by on the v1 series
#4 lore raw
In reply to Aurelien Jarno
Quoted 12 lines · Aurelien Jarno

These are small fixes for MIPS and S390 hosts, found by testing various guests on these hosts.

Aurelien Jarno (3):
tcg/mips: fix TLB loading for BE host with 32-bit guests tcg/mips: Mask TCGMemOp appropriately for indexing tcg/s390x: Mask TCGMemOp appropriately for indexing

  tcg/mips/tcg-target.c | 8 +++++---
  tcg/s390/tcg-target.c | 4 ++--
  2 files changed, 7 insertions(+), 5 deletions(-)

r~