Revision 96b4cf38 tcg/i386/tcg-target.c
b/tcg/i386/tcg-target.c | ||
---|---|---|
156 | 156 |
return 0; |
157 | 157 |
} |
158 | 158 |
|
159 |
#define P_EXT 0x100 /* 0x0f opcode prefix */ |
|
159 |
#define P_EXT 0x100 /* 0x0f opcode prefix */ |
|
160 |
#define P_DATA16 0x200 /* 0x66 opcode prefix */ |
|
160 | 161 |
|
161 | 162 |
#define OPC_ARITH_EvIz (0x81) |
162 | 163 |
#define OPC_ARITH_EvIb (0x83) |
... | ... | |
262 | 263 |
|
263 | 264 |
static inline void tcg_out_opc(TCGContext *s, int opc) |
264 | 265 |
{ |
265 |
if (opc & P_EXT) |
|
266 |
if (opc & P_DATA16) { |
|
267 |
tcg_out8(s, 0x66); |
|
268 |
} |
|
269 |
if (opc & P_EXT) { |
|
266 | 270 |
tcg_out8(s, 0x0f); |
271 |
} |
|
267 | 272 |
tcg_out8(s, opc); |
268 | 273 |
} |
269 | 274 |
|
... | ... | |
396 | 401 |
|
397 | 402 |
static void tcg_out_shifti(TCGContext *s, int subopc, int reg, int count) |
398 | 403 |
{ |
404 |
/* Propagate an opcode prefix, such as P_DATA16. */ |
|
405 |
int ext = subopc & ~0x7; |
|
406 |
subopc &= 0x7; |
|
407 |
|
|
399 | 408 |
if (count == 1) { |
400 |
tcg_out_modrm(s, OPC_SHIFT_1, subopc, reg); |
|
409 |
tcg_out_modrm(s, OPC_SHIFT_1 | ext, subopc, reg);
|
|
401 | 410 |
} else { |
402 |
tcg_out_modrm(s, OPC_SHIFT_Ib, subopc, reg); |
|
411 |
tcg_out_modrm(s, OPC_SHIFT_Ib | ext, subopc, reg);
|
|
403 | 412 |
tcg_out8(s, count); |
404 | 413 |
} |
405 | 414 |
} |
... | ... | |
411 | 420 |
|
412 | 421 |
static inline void tcg_out_rolw_8(TCGContext *s, int reg) |
413 | 422 |
{ |
414 |
tcg_out8(s, 0x66); |
|
415 |
tcg_out_shifti(s, SHIFT_ROL, reg, 8); |
|
423 |
tcg_out_shifti(s, SHIFT_ROL | P_DATA16, reg, 8); |
|
416 | 424 |
} |
417 | 425 |
|
418 | 426 |
static inline void tcg_out_ext8u(TCGContext *s, int dest, int src) |
... | ... | |
1053 | 1061 |
data_reg = r1; |
1054 | 1062 |
} |
1055 | 1063 |
/* movw */ |
1056 |
tcg_out8(s, 0x66);
|
|
1057 |
tcg_out_modrm_offset(s, OPC_MOVL_EvGv, data_reg, r0, GUEST_BASE);
|
|
1064 |
tcg_out_modrm_offset(s, OPC_MOVL_EvGv | P_DATA16,
|
|
1065 |
data_reg, r0, GUEST_BASE);
|
|
1058 | 1066 |
break; |
1059 | 1067 |
case 2: |
1060 | 1068 |
if (bswap) { |
... | ... | |
1159 | 1167 |
break; |
1160 | 1168 |
case INDEX_op_st16_i32: |
1161 | 1169 |
/* movw */ |
1162 |
tcg_out8(s, 0x66);
|
|
1163 |
tcg_out_modrm_offset(s, OPC_MOVL_EvGv, args[0], args[1], args[2]);
|
|
1170 |
tcg_out_modrm_offset(s, OPC_MOVL_EvGv | P_DATA16,
|
|
1171 |
args[0], args[1], args[2]);
|
|
1164 | 1172 |
break; |
1165 | 1173 |
case INDEX_op_st_i32: |
1166 | 1174 |
tcg_out_st(s, TCG_TYPE_I32, args[0], args[1], args[2]); |
Also available in: Unified diff