Commit c53f4a62e3a87b4200d7245ae273a4d187394779
1 parent
5a63bcb2
fix branch delay slot cornercases.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2615 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
6 additions
and
3 deletions
target-mips/helper.c
@@ -387,7 +387,6 @@ void do_interrupt (CPUState *env) | @@ -387,7 +387,6 @@ void do_interrupt (CPUState *env) | ||
387 | come back to the jump. */ | 387 | come back to the jump. */ |
388 | env->CP0_EPC = env->PC - 4; | 388 | env->CP0_EPC = env->PC - 4; |
389 | env->CP0_Cause |= (1 << CP0Ca_BD); | 389 | env->CP0_Cause |= (1 << CP0Ca_BD); |
390 | - env->hflags &= ~MIPS_HFLAG_BMASK; | ||
391 | } else { | 390 | } else { |
392 | env->CP0_EPC = env->PC; | 391 | env->CP0_EPC = env->PC; |
393 | env->CP0_Cause &= ~(1 << CP0Ca_BD); | 392 | env->CP0_Cause &= ~(1 << CP0Ca_BD); |
@@ -395,6 +394,7 @@ void do_interrupt (CPUState *env) | @@ -395,6 +394,7 @@ void do_interrupt (CPUState *env) | ||
395 | env->CP0_Status |= (1 << CP0St_EXL); | 394 | env->CP0_Status |= (1 << CP0St_EXL); |
396 | env->hflags &= ~MIPS_HFLAG_UM; | 395 | env->hflags &= ~MIPS_HFLAG_UM; |
397 | } | 396 | } |
397 | + env->hflags &= ~MIPS_HFLAG_BMASK; | ||
398 | if (env->CP0_Status & (1 << CP0St_BEV)) { | 398 | if (env->CP0_Status & (1 << CP0St_BEV)) { |
399 | env->PC = (int32_t)0xBFC00200; | 399 | env->PC = (int32_t)0xBFC00200; |
400 | } else { | 400 | } else { |
target-mips/translate.c
@@ -1640,6 +1640,10 @@ static void gen_compute_branch (DisasContext *ctx, uint32_t opc, | @@ -1640,6 +1640,10 @@ static void gen_compute_branch (DisasContext *ctx, uint32_t opc, | ||
1640 | likely: | 1640 | likely: |
1641 | ctx->hflags |= MIPS_HFLAG_BL; | 1641 | ctx->hflags |= MIPS_HFLAG_BL; |
1642 | break; | 1642 | break; |
1643 | + default: | ||
1644 | + MIPS_INVAL("conditional branch/jump"); | ||
1645 | + generate_exception(ctx, EXCP_RI); | ||
1646 | + return; | ||
1643 | } | 1647 | } |
1644 | gen_op_set_bcond(); | 1648 | gen_op_set_bcond(); |
1645 | } | 1649 | } |
@@ -1650,7 +1654,6 @@ static void gen_compute_branch (DisasContext *ctx, uint32_t opc, | @@ -1650,7 +1654,6 @@ static void gen_compute_branch (DisasContext *ctx, uint32_t opc, | ||
1650 | gen_op_set_T0(ctx->pc + 8); | 1654 | gen_op_set_T0(ctx->pc + 8); |
1651 | gen_op_store_T0_gpr(blink); | 1655 | gen_op_store_T0_gpr(blink); |
1652 | } | 1656 | } |
1653 | - return; | ||
1654 | } | 1657 | } |
1655 | 1658 | ||
1656 | /* special3 bitfield operations */ | 1659 | /* special3 bitfield operations */ |
@@ -5053,7 +5056,7 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | @@ -5053,7 +5056,7 @@ static void decode_opc (CPUState *env, DisasContext *ctx) | ||
5053 | break; | 5056 | break; |
5054 | } | 5057 | } |
5055 | if (ctx->hflags & MIPS_HFLAG_BMASK) { | 5058 | if (ctx->hflags & MIPS_HFLAG_BMASK) { |
5056 | - int hflags = ctx->hflags; | 5059 | + int hflags = ctx->hflags & MIPS_HFLAG_BMASK; |
5057 | /* Branches completion */ | 5060 | /* Branches completion */ |
5058 | ctx->hflags &= ~MIPS_HFLAG_BMASK; | 5061 | ctx->hflags &= ~MIPS_HFLAG_BMASK; |
5059 | ctx->bstate = BS_BRANCH; | 5062 | ctx->bstate = BS_BRANCH; |