Commit eeef26cd428b584a8211cc42185585c840b778f4
1 parent
cc9442b9
fixed BLTZAL and BLTZALL insns - fixed regressions from jmp opts
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1667 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
21 additions
and
10 deletions
target-mips/translate.c
| @@ -28,7 +28,7 @@ | @@ -28,7 +28,7 @@ | ||
| 28 | #include "exec-all.h" | 28 | #include "exec-all.h" |
| 29 | #include "disas.h" | 29 | #include "disas.h" |
| 30 | 30 | ||
| 31 | -#define MIPS_DEBUG_DISAS | 31 | +//#define MIPS_DEBUG_DISAS |
| 32 | //#define MIPS_SINGLE_STEP | 32 | //#define MIPS_SINGLE_STEP |
| 33 | 33 | ||
| 34 | #ifdef USE_DIRECT_JUMP | 34 | #ifdef USE_DIRECT_JUMP |
| @@ -1033,13 +1033,20 @@ static void gen_compute_branch (DisasContext *ctx, uint16_t opc, | @@ -1033,13 +1033,20 @@ static void gen_compute_branch (DisasContext *ctx, uint16_t opc, | ||
| 1033 | case OPC_BNE: /* rx != rx */ | 1033 | case OPC_BNE: /* rx != rx */ |
| 1034 | case OPC_BGTZ: /* 0 > 0 */ | 1034 | case OPC_BGTZ: /* 0 > 0 */ |
| 1035 | case OPC_BLTZ: /* 0 < 0 */ | 1035 | case OPC_BLTZ: /* 0 < 0 */ |
| 1036 | - case OPC_BLTZAL: /* 0 < 0 */ | ||
| 1037 | /* Treated as NOP */ | 1036 | /* Treated as NOP */ |
| 1038 | MIPS_DEBUG("bnever (NOP)"); | 1037 | MIPS_DEBUG("bnever (NOP)"); |
| 1039 | return; | 1038 | return; |
| 1039 | + case OPC_BLTZAL: /* 0 < 0 */ | ||
| 1040 | + gen_op_set_T0(ctx->pc + 8); | ||
| 1041 | + gen_op_store_T0_gpr(31); | ||
| 1042 | + return; | ||
| 1043 | + case OPC_BLTZALL: /* 0 < 0 likely */ | ||
| 1044 | + gen_op_set_T0(ctx->pc + 8); | ||
| 1045 | + gen_op_store_T0_gpr(31); | ||
| 1046 | + gen_goto_tb(ctx, 0, ctx->pc + 4); | ||
| 1047 | + return; | ||
| 1040 | case OPC_BNEL: /* rx != rx likely */ | 1048 | case OPC_BNEL: /* rx != rx likely */ |
| 1041 | case OPC_BGTZL: /* 0 > 0 likely */ | 1049 | case OPC_BGTZL: /* 0 > 0 likely */ |
| 1042 | - case OPC_BLTZALL: /* 0 < 0 likely */ | ||
| 1043 | case OPC_BLTZL: /* 0 < 0 likely */ | 1050 | case OPC_BLTZL: /* 0 < 0 likely */ |
| 1044 | /* Skip the instruction in the delay slot */ | 1051 | /* Skip the instruction in the delay slot */ |
| 1045 | MIPS_DEBUG("bnever and skip"); | 1052 | MIPS_DEBUG("bnever and skip"); |
| @@ -1282,11 +1289,12 @@ static void gen_arith64 (DisasContext *ctx, uint16_t opc) | @@ -1282,11 +1289,12 @@ static void gen_arith64 (DisasContext *ctx, uint16_t opc) | ||
| 1282 | 1289 | ||
| 1283 | static void gen_blikely(DisasContext *ctx) | 1290 | static void gen_blikely(DisasContext *ctx) |
| 1284 | { | 1291 | { |
| 1285 | - int l1; | ||
| 1286 | - l1 = gen_new_label(); | ||
| 1287 | - gen_op_jnz_T2(l1); | ||
| 1288 | - gen_op_save_state(ctx->hflags & ~(MIPS_HFLAG_BMASK | MIPS_HFLAG_DS)); | ||
| 1289 | - gen_goto_tb(ctx, 1, ctx->pc + 4); | 1292 | + int l1; |
| 1293 | + l1 = gen_new_label(); | ||
| 1294 | + gen_op_jnz_T2(l1); | ||
| 1295 | + gen_op_save_state(ctx->hflags & ~(MIPS_HFLAG_BMASK | MIPS_HFLAG_DS)); | ||
| 1296 | + gen_goto_tb(ctx, 1, ctx->pc + 4); | ||
| 1297 | + gen_set_label(l1); | ||
| 1290 | } | 1298 | } |
| 1291 | 1299 | ||
| 1292 | static void decode_opc (DisasContext *ctx) | 1300 | static void decode_opc (DisasContext *ctx) |
| @@ -1524,9 +1532,9 @@ static void decode_opc (DisasContext *ctx) | @@ -1524,9 +1532,9 @@ static void decode_opc (DisasContext *ctx) | ||
| 1524 | int l1; | 1532 | int l1; |
| 1525 | l1 = gen_new_label(); | 1533 | l1 = gen_new_label(); |
| 1526 | gen_op_jnz_T2(l1); | 1534 | gen_op_jnz_T2(l1); |
| 1527 | - gen_goto_tb(ctx, 0, ctx->btarget); | ||
| 1528 | - gen_set_label(l1); | ||
| 1529 | gen_goto_tb(ctx, 1, ctx->pc + 4); | 1535 | gen_goto_tb(ctx, 1, ctx->pc + 4); |
| 1536 | + gen_set_label(l1); | ||
| 1537 | + gen_goto_tb(ctx, 0, ctx->btarget); | ||
| 1530 | } | 1538 | } |
| 1531 | break; | 1539 | break; |
| 1532 | case MIPS_HFLAG_BR: | 1540 | case MIPS_HFLAG_BR: |
| @@ -1722,5 +1730,8 @@ CPUMIPSState *cpu_mips_init (void) | @@ -1722,5 +1730,8 @@ CPUMIPSState *cpu_mips_init (void) | ||
| 1722 | env->CP0_Debug = (1 << CP0DB_CNT) | (0x1 << CP0DB_VER); | 1730 | env->CP0_Debug = (1 << CP0DB_CNT) | (0x1 << CP0DB_VER); |
| 1723 | env->CP0_PRid = MIPS_CPU; | 1731 | env->CP0_PRid = MIPS_CPU; |
| 1724 | env->exception_index = EXCP_NONE; | 1732 | env->exception_index = EXCP_NONE; |
| 1733 | +#if defined(CONFIG_USER_ONLY) | ||
| 1734 | + env->hflags |= MIPS_HFLAG_UM; | ||
| 1735 | +#endif | ||
| 1725 | return env; | 1736 | return env; |
| 1726 | } | 1737 | } |