Revision 6858614e
b/tcg/i386/tcg-target.c | ||
---|---|---|
178 | 178 |
#define OPC_MOVSWL (0xbf | P_EXT) |
179 | 179 |
#define OPC_MOVZBL (0xb6 | P_EXT) |
180 | 180 |
#define OPC_MOVZWL (0xb7 | P_EXT) |
181 |
#define OPC_POP_r32 (0x58) |
|
182 |
#define OPC_PUSH_r32 (0x50) |
|
183 |
#define OPC_PUSH_Iv (0x68) |
|
184 |
#define OPC_PUSH_Ib (0x6a) |
|
181 | 185 |
#define OPC_SHIFT_1 (0xd1) |
182 | 186 |
#define OPC_SHIFT_Ib (0xc1) |
183 | 187 |
#define OPC_SHIFT_cl (0xd3) |
... | ... | |
306 | 310 |
} |
307 | 311 |
} |
308 | 312 |
|
313 |
static inline void tcg_out_pushi(TCGContext *s, tcg_target_long val) |
|
314 |
{ |
|
315 |
if (val == (int8_t)val) { |
|
316 |
tcg_out_opc(s, OPC_PUSH_Ib); |
|
317 |
tcg_out8(s, val); |
|
318 |
} else { |
|
319 |
tcg_out_opc(s, OPC_PUSH_Iv); |
|
320 |
tcg_out32(s, val); |
|
321 |
} |
|
322 |
} |
|
323 |
|
|
324 |
static inline void tcg_out_push(TCGContext *s, int reg) |
|
325 |
{ |
|
326 |
tcg_out_opc(s, OPC_PUSH_r32 + reg); |
|
327 |
} |
|
328 |
|
|
329 |
static inline void tcg_out_pop(TCGContext *s, int reg) |
|
330 |
{ |
|
331 |
tcg_out_opc(s, OPC_POP_r32 + reg); |
|
332 |
} |
|
333 |
|
|
309 | 334 |
static inline void tcg_out_ld(TCGContext *s, TCGType type, int ret, |
310 | 335 |
int arg1, tcg_target_long arg2) |
311 | 336 |
{ |
... | ... | |
891 | 916 |
if (opc == 3) { |
892 | 917 |
tcg_out_mov(s, TCG_REG_EDX, data_reg); |
893 | 918 |
tcg_out_mov(s, TCG_REG_ECX, data_reg2); |
894 |
tcg_out8(s, 0x6a); /* push Ib */ |
|
895 |
tcg_out8(s, mem_index); |
|
919 |
tcg_out_pushi(s, mem_index); |
|
896 | 920 |
tcg_out8(s, 0xe8); |
897 | 921 |
tcg_out32(s, (tcg_target_long)qemu_st_helpers[s_bits] - |
898 | 922 |
(tcg_target_long)s->code_ptr - 4); |
... | ... | |
917 | 941 |
#else |
918 | 942 |
if (opc == 3) { |
919 | 943 |
tcg_out_mov(s, TCG_REG_EDX, addr_reg2); |
920 |
tcg_out8(s, 0x6a); /* push Ib */ |
|
921 |
tcg_out8(s, mem_index); |
|
922 |
tcg_out_opc(s, 0x50 + data_reg2); /* push */ |
|
923 |
tcg_out_opc(s, 0x50 + data_reg); /* push */ |
|
944 |
tcg_out_pushi(s, mem_index); |
|
945 |
tcg_out_push(s, data_reg2); |
|
946 |
tcg_out_push(s, data_reg); |
|
924 | 947 |
tcg_out8(s, 0xe8); |
925 | 948 |
tcg_out32(s, (tcg_target_long)qemu_st_helpers[s_bits] - |
926 | 949 |
(tcg_target_long)s->code_ptr - 4); |
... | ... | |
938 | 961 |
tcg_out_mov(s, TCG_REG_ECX, data_reg); |
939 | 962 |
break; |
940 | 963 |
} |
941 |
tcg_out8(s, 0x6a); /* push Ib */ |
|
942 |
tcg_out8(s, mem_index); |
|
964 |
tcg_out_pushi(s, mem_index); |
|
943 | 965 |
tcg_out8(s, 0xe8); |
944 | 966 |
tcg_out32(s, (tcg_target_long)qemu_st_helpers[s_bits] - |
945 | 967 |
(tcg_target_long)s->code_ptr - 4); |
... | ... | |
1352 | 1374 |
TCG_REG_EDI, |
1353 | 1375 |
}; |
1354 | 1376 |
|
1355 |
static inline void tcg_out_push(TCGContext *s, int reg) |
|
1356 |
{ |
|
1357 |
tcg_out_opc(s, 0x50 + reg); |
|
1358 |
} |
|
1359 |
|
|
1360 |
static inline void tcg_out_pop(TCGContext *s, int reg) |
|
1361 |
{ |
|
1362 |
tcg_out_opc(s, 0x58 + reg); |
|
1363 |
} |
|
1364 |
|
|
1365 | 1377 |
/* Generate global QEMU prologue and epilogue code */ |
1366 | 1378 |
void tcg_target_qemu_prologue(TCGContext *s) |
1367 | 1379 |
{ |
Also available in: Unified diff