Initial commit with version 1.2.0-24
[packages/centos6/qemu.git] / 0044-target-mips-Fix-MIPS_DEBUG.patch
1 From 5dd8e9207a39d8fe41eaa110edfdba5e37064562 Mon Sep 17 00:00:00 2001
2 From: Richard Henderson <rth@twiddle.net>
3 Date: Tue, 18 Sep 2012 21:55:33 -0700
4 Subject: [PATCH] target-mips: Fix MIPS_DEBUG.
5
6 The macro uses the DisasContext.  Pass it around as needed.
7
8 Signed-off-by: Richard Henderson <rth@twiddle.net>
9 Acked-by: Aurelien Jarno <aurelien@aurel32.net>
10 Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 ---
13  target-mips/translate.c | 74 +++++++++++++++++++++++++------------------------
14  1 file changed, 38 insertions(+), 36 deletions(-)
15
16 diff --git a/target-mips/translate.c b/target-mips/translate.c
17 index c31f91c..4937f6b 100644
18 --- a/target-mips/translate.c
19 +++ b/target-mips/translate.c
20 @@ -1431,7 +1431,8 @@ static void gen_arith_imm (CPUMIPSState *env, DisasContext *ctx, uint32_t opc,
21  }
22  
23  /* Logic with immediate operand */
24 -static void gen_logic_imm (CPUMIPSState *env, uint32_t opc, int rt, int rs, int16_t imm)
25 +static void gen_logic_imm(CPUMIPSState *env, DisasContext *ctx, uint32_t opc,
26 +                          int rt, int rs, int16_t imm)
27  {
28      target_ulong uimm;
29      const char *opn = "imm logic";
30 @@ -1474,7 +1475,8 @@ static void gen_logic_imm (CPUMIPSState *env, uint32_t opc, int rt, int rs, int1
31  }
32  
33  /* Set on less than with immediate operand */
34 -static void gen_slt_imm (CPUMIPSState *env, uint32_t opc, int rt, int rs, int16_t imm)
35 +static void gen_slt_imm(CPUMIPSState *env, DisasContext *ctx, uint32_t opc,
36 +                        int rt, int rs, int16_t imm)
37  {
38      target_ulong uimm = (target_long)imm; /* Sign extend to 32/64 bits */
39      const char *opn = "imm arith";
40 @@ -1775,7 +1777,8 @@ static void gen_arith (CPUMIPSState *env, DisasContext *ctx, uint32_t opc,
41  }
42  
43  /* Conditional move */
44 -static void gen_cond_move (CPUMIPSState *env, uint32_t opc, int rd, int rs, int rt)
45 +static void gen_cond_move(CPUMIPSState *env, DisasContext *ctx, uint32_t opc,
46 +                          int rd, int rs, int rt)
47  {
48      const char *opn = "cond move";
49      int l1;
50 @@ -1813,7 +1816,8 @@ static void gen_cond_move (CPUMIPSState *env, uint32_t opc, int rd, int rs, int
51  }
52  
53  /* Logic */
54 -static void gen_logic (CPUMIPSState *env, uint32_t opc, int rd, int rs, int rt)
55 +static void gen_logic(CPUMIPSState *env, DisasContext *ctx, uint32_t opc,
56 +                      int rd, int rs, int rt)
57  {
58      const char *opn = "logic";
59  
60 @@ -1874,7 +1878,8 @@ static void gen_logic (CPUMIPSState *env, uint32_t opc, int rd, int rs, int rt)
61  }
62  
63  /* Set on lower than */
64 -static void gen_slt (CPUMIPSState *env, uint32_t opc, int rd, int rs, int rt)
65 +static void gen_slt(CPUMIPSState *env, DisasContext *ctx, uint32_t opc,
66 +                    int rd, int rs, int rt)
67  {
68      const char *opn = "slt";
69      TCGv t0, t1;
70 @@ -8778,10 +8783,10 @@ static int decode_extended_mips16_opc (CPUMIPSState *env, DisasContext *ctx,
71          gen_arith_imm(env, ctx, OPC_ADDIU, rx, rx, imm);
72          break;
73      case M16_OPC_SLTI:
74 -        gen_slt_imm(env, OPC_SLTI, 24, rx, imm);
75 +        gen_slt_imm(env, ctx, OPC_SLTI, 24, rx, imm);
76          break;
77      case M16_OPC_SLTIU:
78 -        gen_slt_imm(env, OPC_SLTIU, 24, rx, imm);
79 +        gen_slt_imm(env, ctx, OPC_SLTIU, 24, rx, imm);
80          break;
81      case M16_OPC_I8:
82          switch (funct) {
83 @@ -8992,15 +8997,13 @@ static int decode_mips16_opc (CPUMIPSState *env, DisasContext *ctx,
84      case M16_OPC_SLTI:
85          {
86              int16_t imm = (uint8_t) ctx->opcode;
87 -
88 -            gen_slt_imm(env, OPC_SLTI, 24, rx, imm);
89 +            gen_slt_imm(env, ctx, OPC_SLTI, 24, rx, imm);
90          }
91          break;
92      case M16_OPC_SLTIU:
93          {
94              int16_t imm = (uint8_t) ctx->opcode;
95 -
96 -            gen_slt_imm(env, OPC_SLTIU, 24, rx, imm);
97 +            gen_slt_imm(env, ctx, OPC_SLTIU, 24, rx, imm);
98          }
99          break;
100      case M16_OPC_I8:
101 @@ -9075,8 +9078,7 @@ static int decode_mips16_opc (CPUMIPSState *env, DisasContext *ctx,
102      case M16_OPC_CMPI:
103          {
104              int16_t imm = (uint8_t) ctx->opcode;
105 -
106 -            gen_logic_imm(env, OPC_XORI, 24, rx, imm);
107 +            gen_logic_imm(env, ctx, OPC_XORI, 24, rx, imm);
108          }
109          break;
110  #if defined(TARGET_MIPS64)
111 @@ -9188,10 +9190,10 @@ static int decode_mips16_opc (CPUMIPSState *env, DisasContext *ctx,
112              }
113              break;
114          case RR_SLT:
115 -            gen_slt(env, OPC_SLT, 24, rx, ry);
116 +            gen_slt(env, ctx, OPC_SLT, 24, rx, ry);
117              break;
118          case RR_SLTU:
119 -            gen_slt(env, OPC_SLTU, 24, rx, ry);
120 +            gen_slt(env, ctx, OPC_SLTU, 24, rx, ry);
121              break;
122          case RR_BREAK:
123              generate_exception(ctx, EXCP_BREAK);
124 @@ -9212,22 +9214,22 @@ static int decode_mips16_opc (CPUMIPSState *env, DisasContext *ctx,
125              break;
126  #endif
127          case RR_CMP:
128 -            gen_logic(env, OPC_XOR, 24, rx, ry);
129 +            gen_logic(env, ctx, OPC_XOR, 24, rx, ry);
130              break;
131          case RR_NEG:
132              gen_arith(env, ctx, OPC_SUBU, rx, 0, ry);
133              break;
134          case RR_AND:
135 -            gen_logic(env, OPC_AND, rx, rx, ry);
136 +            gen_logic(env, ctx, OPC_AND, rx, rx, ry);
137              break;
138          case RR_OR:
139 -            gen_logic(env, OPC_OR, rx, rx, ry);
140 +            gen_logic(env, ctx, OPC_OR, rx, rx, ry);
141              break;
142          case RR_XOR:
143 -            gen_logic(env, OPC_XOR, rx, rx, ry);
144 +            gen_logic(env, ctx, OPC_XOR, rx, rx, ry);
145              break;
146          case RR_NOT:
147 -            gen_logic(env, OPC_NOR, rx, ry, 0);
148 +            gen_logic(env, ctx, OPC_NOR, rx, ry, 0);
149              break;
150          case RR_MFHI:
151              gen_HILO(ctx, OPC_MFHI, rx);
152 @@ -9849,7 +9851,7 @@ static void gen_andi16 (CPUMIPSState *env, DisasContext *ctx)
153      int rs = mmreg(uMIPS_RS(ctx->opcode));
154      int encoded = ZIMM(ctx->opcode, 0, 4);
155  
156 -    gen_logic_imm(env, OPC_ANDI, rd, rs, decoded_imm[encoded]);
157 +    gen_logic_imm(env, ctx, OPC_ANDI, rd, rs, decoded_imm[encoded]);
158  }
159  
160  static void gen_ldst_multiple (DisasContext *ctx, uint32_t opc, int reglist,
161 @@ -9911,25 +9913,25 @@ static void gen_pool16c_insn (CPUMIPSState *env, DisasContext *ctx, int *is_bran
162      case NOT16 + 1:
163      case NOT16 + 2:
164      case NOT16 + 3:
165 -        gen_logic(env, OPC_NOR, rd, rs, 0);
166 +        gen_logic(env, ctx, OPC_NOR, rd, rs, 0);
167          break;
168      case XOR16 + 0:
169      case XOR16 + 1:
170      case XOR16 + 2:
171      case XOR16 + 3:
172 -        gen_logic(env, OPC_XOR, rd, rd, rs);
173 +        gen_logic(env, ctx, OPC_XOR, rd, rd, rs);
174          break;
175      case AND16 + 0:
176      case AND16 + 1:
177      case AND16 + 2:
178      case AND16 + 3:
179 -        gen_logic(env, OPC_AND, rd, rd, rs);
180 +        gen_logic(env, ctx, OPC_AND, rd, rd, rs);
181          break;
182      case OR16 + 0:
183      case OR16 + 1:
184      case OR16 + 2:
185      case OR16 + 3:
186 -        gen_logic(env, OPC_OR, rd, rd, rs);
187 +        gen_logic(env, ctx, OPC_OR, rd, rd, rs);
188          break;
189      case LWM16 + 0:
190      case LWM16 + 1:
191 @@ -10743,7 +10745,7 @@ static void decode_micromips32_opc (CPUMIPSState *env, DisasContext *ctx,
192              case XOR32:
193                  mips32_op = OPC_XOR;
194              do_logic:
195 -                gen_logic(env, mips32_op, rd, rs, rt);
196 +                gen_logic(env, ctx, mips32_op, rd, rs, rt);
197                  break;
198                  /* Set less than */
199              case SLT:
200 @@ -10752,7 +10754,7 @@ static void decode_micromips32_opc (CPUMIPSState *env, DisasContext *ctx,
201              case SLTU:
202                  mips32_op = OPC_SLTU;
203              do_slt:
204 -                gen_slt(env, mips32_op, rd, rs, rt);
205 +                gen_slt(env, ctx, mips32_op, rd, rs, rt);
206                  break;
207              default:
208                  goto pool32a_invalid;
209 @@ -10768,7 +10770,7 @@ static void decode_micromips32_opc (CPUMIPSState *env, DisasContext *ctx,
210              case MOVZ:
211                  mips32_op = OPC_MOVZ;
212              do_cmov:
213 -                gen_cond_move(env, mips32_op, rd, rs, rt);
214 +                gen_cond_move(env, ctx, mips32_op, rd, rs, rt);
215                  break;
216              case LWXS:
217                  gen_ldxs(ctx, rs, rt, rd);
218 @@ -11181,7 +11183,7 @@ static void decode_micromips32_opc (CPUMIPSState *env, DisasContext *ctx,
219                 target. */
220              break;
221          case LUI:
222 -            gen_logic_imm(env, OPC_LUI, rs, -1, imm);
223 +            gen_logic_imm(env, ctx, OPC_LUI, rs, -1, imm);
224              break;
225          case SYNCI:
226              break;
227 @@ -11300,7 +11302,7 @@ static void decode_micromips32_opc (CPUMIPSState *env, DisasContext *ctx,
228      case ANDI32:
229          mips32_op = OPC_ANDI;
230      do_logici:
231 -        gen_logic_imm(env, mips32_op, rt, rs, imm);
232 +        gen_logic_imm(env, ctx, mips32_op, rt, rs, imm);
233          break;
234  
235          /* Set less than immediate */
236 @@ -11310,7 +11312,7 @@ static void decode_micromips32_opc (CPUMIPSState *env, DisasContext *ctx,
237      case SLTIU32:
238          mips32_op = OPC_SLTIU;
239      do_slti:
240 -        gen_slt_imm(env, mips32_op, rt, rs, imm);
241 +        gen_slt_imm(env, ctx, mips32_op, rt, rs, imm);
242          break;
243      case JALX32:
244          offset = (int32_t)(ctx->opcode & 0x3FFFFFF) << 2;
245 @@ -11787,7 +11789,7 @@ static void decode_opc (CPUMIPSState *env, DisasContext *ctx, int *is_branch)
246          case OPC_MOVZ:
247              check_insn(env, ctx, ISA_MIPS4 | ISA_MIPS32 |
248                                   INSN_LOONGSON2E | INSN_LOONGSON2F);
249 -            gen_cond_move(env, op1, rd, rs, rt);
250 +            gen_cond_move(env, ctx, op1, rd, rs, rt);
251              break;
252          case OPC_ADD ... OPC_SUBU:
253              gen_arith(env, ctx, op1, rd, rs, rt);
254 @@ -11814,13 +11816,13 @@ static void decode_opc (CPUMIPSState *env, DisasContext *ctx, int *is_branch)
255              break;
256          case OPC_SLT:          /* Set on less than */
257          case OPC_SLTU:
258 -            gen_slt(env, op1, rd, rs, rt);
259 +            gen_slt(env, ctx, op1, rd, rs, rt);
260              break;
261          case OPC_AND:          /* Logic*/
262          case OPC_OR:
263          case OPC_NOR:
264          case OPC_XOR:
265 -            gen_logic(env, op1, rd, rs, rt);
266 +            gen_logic(env, ctx, op1, rd, rs, rt);
267              break;
268          case OPC_MULT ... OPC_DIVU:
269              if (sa) {
270 @@ -12221,13 +12223,13 @@ static void decode_opc (CPUMIPSState *env, DisasContext *ctx, int *is_branch)
271           break;
272      case OPC_SLTI: /* Set on less than with immediate opcode */
273      case OPC_SLTIU:
274 -         gen_slt_imm(env, op, rt, rs, imm);
275 +         gen_slt_imm(env, ctx, op, rt, rs, imm);
276           break;
277      case OPC_ANDI: /* Arithmetic with immediate opcode */
278      case OPC_LUI:
279      case OPC_ORI:
280      case OPC_XORI:
281 -         gen_logic_imm(env, op, rt, rs, imm);
282 +         gen_logic_imm(env, ctx, op, rt, rs, imm);
283           break;
284      case OPC_J ... OPC_JAL: /* Jump */
285           offset = (int32_t)(ctx->opcode & 0x3FFFFFF) << 2;
286 -- 
287 1.7.12.1
288