peterdelevoryas / rpms / qemu

Forked from rpms/qemu 2 years ago
Clone

Blame 0044-target-mips-Fix-MIPS_DEBUG.patch

5544c1
From 5dd8e9207a39d8fe41eaa110edfdba5e37064562 Mon Sep 17 00:00:00 2001
5544c1
From: Richard Henderson <rth@twiddle.net>
5544c1
Date: Tue, 18 Sep 2012 21:55:33 -0700
5544c1
Subject: [PATCH] target-mips: Fix MIPS_DEBUG.
5544c1
5544c1
The macro uses the DisasContext.  Pass it around as needed.
5544c1
5544c1
Signed-off-by: Richard Henderson <rth@twiddle.net>
5544c1
Acked-by: Aurelien Jarno <aurelien@aurel32.net>
5544c1
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
5544c1
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5544c1
---
5544c1
 target-mips/translate.c | 74 +++++++++++++++++++++++++------------------------
5544c1
 1 file changed, 38 insertions(+), 36 deletions(-)
5544c1
5544c1
diff --git a/target-mips/translate.c b/target-mips/translate.c
5544c1
index c31f91c..4937f6b 100644
5544c1
--- a/target-mips/translate.c
5544c1
+++ b/target-mips/translate.c
5544c1
@@ -1431,7 +1431,8 @@ static void gen_arith_imm (CPUMIPSState *env, DisasContext *ctx, uint32_t opc,
5544c1
 }
5544c1
 
5544c1
 /* Logic with immediate operand */
5544c1
-static void gen_logic_imm (CPUMIPSState *env, uint32_t opc, int rt, int rs, int16_t imm)
5544c1
+static void gen_logic_imm(CPUMIPSState *env, DisasContext *ctx, uint32_t opc,
5544c1
+                          int rt, int rs, int16_t imm)
5544c1
 {
5544c1
     target_ulong uimm;
5544c1
     const char *opn = "imm logic";
5544c1
@@ -1474,7 +1475,8 @@ static void gen_logic_imm (CPUMIPSState *env, uint32_t opc, int rt, int rs, int1
5544c1
 }
5544c1
 
5544c1
 /* Set on less than with immediate operand */
5544c1
-static void gen_slt_imm (CPUMIPSState *env, uint32_t opc, int rt, int rs, int16_t imm)
5544c1
+static void gen_slt_imm(CPUMIPSState *env, DisasContext *ctx, uint32_t opc,
5544c1
+                        int rt, int rs, int16_t imm)
5544c1
 {
5544c1
     target_ulong uimm = (target_long)imm; /* Sign extend to 32/64 bits */
5544c1
     const char *opn = "imm arith";
5544c1
@@ -1775,7 +1777,8 @@ static void gen_arith (CPUMIPSState *env, DisasContext *ctx, uint32_t opc,
5544c1
 }
5544c1
 
5544c1
 /* Conditional move */
5544c1
-static void gen_cond_move (CPUMIPSState *env, uint32_t opc, int rd, int rs, int rt)
5544c1
+static void gen_cond_move(CPUMIPSState *env, DisasContext *ctx, uint32_t opc,
5544c1
+                          int rd, int rs, int rt)
5544c1
 {
5544c1
     const char *opn = "cond move";
5544c1
     int l1;
5544c1
@@ -1813,7 +1816,8 @@ static void gen_cond_move (CPUMIPSState *env, uint32_t opc, int rd, int rs, int
5544c1
 }
5544c1
 
5544c1
 /* Logic */
5544c1
-static void gen_logic (CPUMIPSState *env, uint32_t opc, int rd, int rs, int rt)
5544c1
+static void gen_logic(CPUMIPSState *env, DisasContext *ctx, uint32_t opc,
5544c1
+                      int rd, int rs, int rt)
5544c1
 {
5544c1
     const char *opn = "logic";
5544c1
 
5544c1
@@ -1874,7 +1878,8 @@ static void gen_logic (CPUMIPSState *env, uint32_t opc, int rd, int rs, int rt)
5544c1
 }
5544c1
 
5544c1
 /* Set on lower than */
5544c1
-static void gen_slt (CPUMIPSState *env, uint32_t opc, int rd, int rs, int rt)
5544c1
+static void gen_slt(CPUMIPSState *env, DisasContext *ctx, uint32_t opc,
5544c1
+                    int rd, int rs, int rt)
5544c1
 {
5544c1
     const char *opn = "slt";
5544c1
     TCGv t0, t1;
5544c1
@@ -8778,10 +8783,10 @@ static int decode_extended_mips16_opc (CPUMIPSState *env, DisasContext *ctx,
5544c1
         gen_arith_imm(env, ctx, OPC_ADDIU, rx, rx, imm);
5544c1
         break;
5544c1
     case M16_OPC_SLTI:
5544c1
-        gen_slt_imm(env, OPC_SLTI, 24, rx, imm);
5544c1
+        gen_slt_imm(env, ctx, OPC_SLTI, 24, rx, imm);
5544c1
         break;
5544c1
     case M16_OPC_SLTIU:
5544c1
-        gen_slt_imm(env, OPC_SLTIU, 24, rx, imm);
5544c1
+        gen_slt_imm(env, ctx, OPC_SLTIU, 24, rx, imm);
5544c1
         break;
5544c1
     case M16_OPC_I8:
5544c1
         switch (funct) {
5544c1
@@ -8992,15 +8997,13 @@ static int decode_mips16_opc (CPUMIPSState *env, DisasContext *ctx,
5544c1
     case M16_OPC_SLTI:
5544c1
         {
5544c1
             int16_t imm = (uint8_t) ctx->opcode;
5544c1
-
5544c1
-            gen_slt_imm(env, OPC_SLTI, 24, rx, imm);
5544c1
+            gen_slt_imm(env, ctx, OPC_SLTI, 24, rx, imm);
5544c1
         }
5544c1
         break;
5544c1
     case M16_OPC_SLTIU:
5544c1
         {
5544c1
             int16_t imm = (uint8_t) ctx->opcode;
5544c1
-
5544c1
-            gen_slt_imm(env, OPC_SLTIU, 24, rx, imm);
5544c1
+            gen_slt_imm(env, ctx, OPC_SLTIU, 24, rx, imm);
5544c1
         }
5544c1
         break;
5544c1
     case M16_OPC_I8:
5544c1
@@ -9075,8 +9078,7 @@ static int decode_mips16_opc (CPUMIPSState *env, DisasContext *ctx,
5544c1
     case M16_OPC_CMPI:
5544c1
         {
5544c1
             int16_t imm = (uint8_t) ctx->opcode;
5544c1
-
5544c1
-            gen_logic_imm(env, OPC_XORI, 24, rx, imm);
5544c1
+            gen_logic_imm(env, ctx, OPC_XORI, 24, rx, imm);
5544c1
         }
5544c1
         break;
5544c1
 #if defined(TARGET_MIPS64)
5544c1
@@ -9188,10 +9190,10 @@ static int decode_mips16_opc (CPUMIPSState *env, DisasContext *ctx,
5544c1
             }
5544c1
             break;
5544c1
         case RR_SLT:
5544c1
-            gen_slt(env, OPC_SLT, 24, rx, ry);
5544c1
+            gen_slt(env, ctx, OPC_SLT, 24, rx, ry);
5544c1
             break;
5544c1
         case RR_SLTU:
5544c1
-            gen_slt(env, OPC_SLTU, 24, rx, ry);
5544c1
+            gen_slt(env, ctx, OPC_SLTU, 24, rx, ry);
5544c1
             break;
5544c1
         case RR_BREAK:
5544c1
             generate_exception(ctx, EXCP_BREAK);
5544c1
@@ -9212,22 +9214,22 @@ static int decode_mips16_opc (CPUMIPSState *env, DisasContext *ctx,
5544c1
             break;
5544c1
 #endif
5544c1
         case RR_CMP:
5544c1
-            gen_logic(env, OPC_XOR, 24, rx, ry);
5544c1
+            gen_logic(env, ctx, OPC_XOR, 24, rx, ry);
5544c1
             break;
5544c1
         case RR_NEG:
5544c1
             gen_arith(env, ctx, OPC_SUBU, rx, 0, ry);
5544c1
             break;
5544c1
         case RR_AND:
5544c1
-            gen_logic(env, OPC_AND, rx, rx, ry);
5544c1
+            gen_logic(env, ctx, OPC_AND, rx, rx, ry);
5544c1
             break;
5544c1
         case RR_OR:
5544c1
-            gen_logic(env, OPC_OR, rx, rx, ry);
5544c1
+            gen_logic(env, ctx, OPC_OR, rx, rx, ry);
5544c1
             break;
5544c1
         case RR_XOR:
5544c1
-            gen_logic(env, OPC_XOR, rx, rx, ry);
5544c1
+            gen_logic(env, ctx, OPC_XOR, rx, rx, ry);
5544c1
             break;
5544c1
         case RR_NOT:
5544c1
-            gen_logic(env, OPC_NOR, rx, ry, 0);
5544c1
+            gen_logic(env, ctx, OPC_NOR, rx, ry, 0);
5544c1
             break;
5544c1
         case RR_MFHI:
5544c1
             gen_HILO(ctx, OPC_MFHI, rx);
5544c1
@@ -9849,7 +9851,7 @@ static void gen_andi16 (CPUMIPSState *env, DisasContext *ctx)
5544c1
     int rs = mmreg(uMIPS_RS(ctx->opcode));
5544c1
     int encoded = ZIMM(ctx->opcode, 0, 4);
5544c1
 
5544c1
-    gen_logic_imm(env, OPC_ANDI, rd, rs, decoded_imm[encoded]);
5544c1
+    gen_logic_imm(env, ctx, OPC_ANDI, rd, rs, decoded_imm[encoded]);
5544c1
 }
5544c1
 
5544c1
 static void gen_ldst_multiple (DisasContext *ctx, uint32_t opc, int reglist,
5544c1
@@ -9911,25 +9913,25 @@ static void gen_pool16c_insn (CPUMIPSState *env, DisasContext *ctx, int *is_bran
5544c1
     case NOT16 + 1:
5544c1
     case NOT16 + 2:
5544c1
     case NOT16 + 3:
5544c1
-        gen_logic(env, OPC_NOR, rd, rs, 0);
5544c1
+        gen_logic(env, ctx, OPC_NOR, rd, rs, 0);
5544c1
         break;
5544c1
     case XOR16 + 0:
5544c1
     case XOR16 + 1:
5544c1
     case XOR16 + 2:
5544c1
     case XOR16 + 3:
5544c1
-        gen_logic(env, OPC_XOR, rd, rd, rs);
5544c1
+        gen_logic(env, ctx, OPC_XOR, rd, rd, rs);
5544c1
         break;
5544c1
     case AND16 + 0:
5544c1
     case AND16 + 1:
5544c1
     case AND16 + 2:
5544c1
     case AND16 + 3:
5544c1
-        gen_logic(env, OPC_AND, rd, rd, rs);
5544c1
+        gen_logic(env, ctx, OPC_AND, rd, rd, rs);
5544c1
         break;
5544c1
     case OR16 + 0:
5544c1
     case OR16 + 1:
5544c1
     case OR16 + 2:
5544c1
     case OR16 + 3:
5544c1
-        gen_logic(env, OPC_OR, rd, rd, rs);
5544c1
+        gen_logic(env, ctx, OPC_OR, rd, rd, rs);
5544c1
         break;
5544c1
     case LWM16 + 0:
5544c1
     case LWM16 + 1:
5544c1
@@ -10743,7 +10745,7 @@ static void decode_micromips32_opc (CPUMIPSState *env, DisasContext *ctx,
5544c1
             case XOR32:
5544c1
                 mips32_op = OPC_XOR;
5544c1
             do_logic:
5544c1
-                gen_logic(env, mips32_op, rd, rs, rt);
5544c1
+                gen_logic(env, ctx, mips32_op, rd, rs, rt);
5544c1
                 break;
5544c1
                 /* Set less than */
5544c1
             case SLT:
5544c1
@@ -10752,7 +10754,7 @@ static void decode_micromips32_opc (CPUMIPSState *env, DisasContext *ctx,
5544c1
             case SLTU:
5544c1
                 mips32_op = OPC_SLTU;
5544c1
             do_slt:
5544c1
-                gen_slt(env, mips32_op, rd, rs, rt);
5544c1
+                gen_slt(env, ctx, mips32_op, rd, rs, rt);
5544c1
                 break;
5544c1
             default:
5544c1
                 goto pool32a_invalid;
5544c1
@@ -10768,7 +10770,7 @@ static void decode_micromips32_opc (CPUMIPSState *env, DisasContext *ctx,
5544c1
             case MOVZ:
5544c1
                 mips32_op = OPC_MOVZ;
5544c1
             do_cmov:
5544c1
-                gen_cond_move(env, mips32_op, rd, rs, rt);
5544c1
+                gen_cond_move(env, ctx, mips32_op, rd, rs, rt);
5544c1
                 break;
5544c1
             case LWXS:
5544c1
                 gen_ldxs(ctx, rs, rt, rd);
5544c1
@@ -11181,7 +11183,7 @@ static void decode_micromips32_opc (CPUMIPSState *env, DisasContext *ctx,
5544c1
                target. */
5544c1
             break;
5544c1
         case LUI:
5544c1
-            gen_logic_imm(env, OPC_LUI, rs, -1, imm);
5544c1
+            gen_logic_imm(env, ctx, OPC_LUI, rs, -1, imm);
5544c1
             break;
5544c1
         case SYNCI:
5544c1
             break;
5544c1
@@ -11300,7 +11302,7 @@ static void decode_micromips32_opc (CPUMIPSState *env, DisasContext *ctx,
5544c1
     case ANDI32:
5544c1
         mips32_op = OPC_ANDI;
5544c1
     do_logici:
5544c1
-        gen_logic_imm(env, mips32_op, rt, rs, imm);
5544c1
+        gen_logic_imm(env, ctx, mips32_op, rt, rs, imm);
5544c1
         break;
5544c1
 
5544c1
         /* Set less than immediate */
5544c1
@@ -11310,7 +11312,7 @@ static void decode_micromips32_opc (CPUMIPSState *env, DisasContext *ctx,
5544c1
     case SLTIU32:
5544c1
         mips32_op = OPC_SLTIU;
5544c1
     do_slti:
5544c1
-        gen_slt_imm(env, mips32_op, rt, rs, imm);
5544c1
+        gen_slt_imm(env, ctx, mips32_op, rt, rs, imm);
5544c1
         break;
5544c1
     case JALX32:
5544c1
         offset = (int32_t)(ctx->opcode & 0x3FFFFFF) << 2;
5544c1
@@ -11787,7 +11789,7 @@ static void decode_opc (CPUMIPSState *env, DisasContext *ctx, int *is_branch)
5544c1
         case OPC_MOVZ:
5544c1
             check_insn(env, ctx, ISA_MIPS4 | ISA_MIPS32 |
5544c1
                                  INSN_LOONGSON2E | INSN_LOONGSON2F);
5544c1
-            gen_cond_move(env, op1, rd, rs, rt);
5544c1
+            gen_cond_move(env, ctx, op1, rd, rs, rt);
5544c1
             break;
5544c1
         case OPC_ADD ... OPC_SUBU:
5544c1
             gen_arith(env, ctx, op1, rd, rs, rt);
5544c1
@@ -11814,13 +11816,13 @@ static void decode_opc (CPUMIPSState *env, DisasContext *ctx, int *is_branch)
5544c1
             break;
5544c1
         case OPC_SLT:          /* Set on less than */
5544c1
         case OPC_SLTU:
5544c1
-            gen_slt(env, op1, rd, rs, rt);
5544c1
+            gen_slt(env, ctx, op1, rd, rs, rt);
5544c1
             break;
5544c1
         case OPC_AND:          /* Logic*/
5544c1
         case OPC_OR:
5544c1
         case OPC_NOR:
5544c1
         case OPC_XOR:
5544c1
-            gen_logic(env, op1, rd, rs, rt);
5544c1
+            gen_logic(env, ctx, op1, rd, rs, rt);
5544c1
             break;
5544c1
         case OPC_MULT ... OPC_DIVU:
5544c1
             if (sa) {
5544c1
@@ -12221,13 +12223,13 @@ static void decode_opc (CPUMIPSState *env, DisasContext *ctx, int *is_branch)
5544c1
          break;
5544c1
     case OPC_SLTI: /* Set on less than with immediate opcode */
5544c1
     case OPC_SLTIU:
5544c1
-         gen_slt_imm(env, op, rt, rs, imm);
5544c1
+         gen_slt_imm(env, ctx, op, rt, rs, imm);
5544c1
          break;
5544c1
     case OPC_ANDI: /* Arithmetic with immediate opcode */
5544c1
     case OPC_LUI:
5544c1
     case OPC_ORI:
5544c1
     case OPC_XORI:
5544c1
-         gen_logic_imm(env, op, rt, rs, imm);
5544c1
+         gen_logic_imm(env, ctx, op, rt, rs, imm);
5544c1
          break;
5544c1
     case OPC_J ... OPC_JAL: /* Jump */
5544c1
          offset = (int32_t)(ctx->opcode & 0x3FFFFFF) << 2;
5544c1
-- 
5544c1
1.7.12.1
5544c1