Commit 7399c5a9beff882e4faa8b08ccedfa4be6491039

Authored by bellard
1 parent 10f0e412

fixed eflags optimisations with string operation (aka linux 2.6.2rc1 fix) - removed warnings


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@585 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 17 additions and 3 deletions
target-i386/translate.c
... ... @@ -697,7 +697,15 @@ static GenOpFunc *gen_op_dec_ECX[2] = {
697 697 gen_op_decl_ECX,
698 698 };
699 699  
700   -static GenOpFunc1 *gen_op_string_jnz_sub[2][3] = {
  700 +#ifdef USE_DIRECT_JUMP
  701 +typedef GenOpFunc GenOpFuncTB2;
  702 +#define gen_op_string_jnz_sub(nz, ot, tb) gen_op_string_jnz_sub2[nz][ot]()
  703 +#else
  704 +typedef GenOpFunc1 GenOpFuncTB2;
  705 +#define gen_op_string_jnz_sub(nz, ot, tb) gen_op_string_jnz_sub2[nz][ot](tb)
  706 +#endif
  707 +
  708 +static GenOpFuncTB2 *gen_op_string_jnz_sub2[2][3] = {
701 709 {
702 710 gen_op_string_jnz_subb,
703 711 gen_op_string_jnz_subw,
... ... @@ -921,7 +929,7 @@ static inline void gen_repz_ ## op(DisasContext *s, int ot, \
921 929 if (!s->jmp_opt) \
922 930 gen_op_string_jnz_sub_im[nz][ot](next_eip); \
923 931 else \
924   - gen_op_string_jnz_sub[nz][ot]((long)s->tb); \
  932 + gen_op_string_jnz_sub(nz, ot, (long)s->tb); \
925 933 if (!s->jmp_opt) \
926 934 gen_op_jz_ecx_im[s->aflag](next_eip); \
927 935 gen_jmp(s, cur_eip); \
... ... @@ -2807,7 +2815,7 @@ static uint8_t *disas_insn(DisasContext *s, uint8_t *pc_start)
2807 2815 mod = (modrm >> 6) & 3;
2808 2816 rm = modrm & 7;
2809 2817 op = ((b & 7) << 3) | ((modrm >> 3) & 7);
2810   -
  2818 +
2811 2819 if (mod != 3) {
2812 2820 /* memory op */
2813 2821 gen_lea_modrm(s, modrm, &reg_addr, &offset_addr);
... ... @@ -4228,6 +4236,12 @@ static uint16_t opc_read_flags[NB_OPS] = {
4228 4236 [INDEX_op_cmc] = CC_C,
4229 4237 [INDEX_op_salc] = CC_C,
4230 4238  
  4239 + /* needed for correct flag optimisation before string ops */
  4240 + [INDEX_op_jz_ecxw] = CC_OSZAPC,
  4241 + [INDEX_op_jz_ecxl] = CC_OSZAPC,
  4242 + [INDEX_op_jz_ecxw_im] = CC_OSZAPC,
  4243 + [INDEX_op_jz_ecxl_im] = CC_OSZAPC,
  4244 +
4231 4245 #define DEF_READF(SUFFIX)\
4232 4246 [INDEX_op_adcb ## SUFFIX ## _T0_T1_cc] = CC_C,\
4233 4247 [INDEX_op_adcw ## SUFFIX ## _T0_T1_cc] = CC_C,\
... ...