• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revision522a0d4e3c0d397ffb45ec400d8cbd426dad9d17 (tree)
Time2015-10-29 02:57:16
AuthorRichard Henderson <rth@twid...>
CommiterRichard Henderson

Log Message

target-*: Advance pc after recognizing a breakpoint

Some targets already had this within their logic, but make sure
it's present for all targets.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>

Change Summary

Incremental Difference

--- a/target-alpha/translate.c
+++ b/target-alpha/translate.c
@@ -2917,6 +2917,11 @@ void gen_intermediate_code(CPUAlphaState *env, struct TranslationBlock *tb)
29172917
29182918 if (unlikely(cpu_breakpoint_test(cs, ctx.pc, BP_ANY))) {
29192919 gen_excp(&ctx, EXCP_DEBUG, 0);
2920+ /* The address covered by the breakpoint must be included in
2921+ [tb->pc, tb->pc + tb->size) in order to for it to be
2922+ properly cleared -- thus we increment the PC here so that
2923+ the logic setting tb->size below does the right thing. */
2924+ ctx.pc += 4;
29202925 break;
29212926 }
29222927 if (num_insns == max_insns && (tb->cflags & CF_LAST_IO)) {
--- a/target-arm/translate-a64.c
+++ b/target-arm/translate-a64.c
@@ -11096,8 +11096,11 @@ void gen_intermediate_code_a64(ARMCPU *cpu, TranslationBlock *tb)
1109611096 dc->is_jmp = DISAS_UPDATE;
1109711097 } else {
1109811098 gen_exception_internal_insn(dc, 0, EXCP_DEBUG);
11099- /* Advance PC so that clearing the breakpoint will
11100- invalidate this TB. */
11099+ /* The address covered by the breakpoint must be
11100+ included in [tb->pc, tb->pc + tb->size) in order
11101+ to for it to be properly cleared -- thus we
11102+ increment the PC here so that the logic setting
11103+ tb->size below does the right thing. */
1110111104 dc->pc += 4;
1110211105 goto done_generating;
1110311106 }
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -11378,8 +11378,11 @@ void gen_intermediate_code(CPUARMState *env, TranslationBlock *tb)
1137811378 dc->is_jmp = DISAS_UPDATE;
1137911379 } else {
1138011380 gen_exception_internal_insn(dc, 0, EXCP_DEBUG);
11381- /* Advance PC so that clearing the breakpoint will
11382- invalidate this TB. */
11381+ /* The address covered by the breakpoint must be
11382+ included in [tb->pc, tb->pc + tb->size) in order
11383+ to for it to be properly cleared -- thus we
11384+ increment the PC here so that the logic setting
11385+ tb->size below does the right thing. */
1138311386 /* TODO: Advance PC by correct instruction length to
1138411387 * avoid disassembler error messages */
1138511388 dc->pc += 2;
--- a/target-cris/translate.c
+++ b/target-cris/translate.c
@@ -3166,6 +3166,11 @@ void gen_intermediate_code(CPUCRISState *env, struct TranslationBlock *tb)
31663166 tcg_gen_movi_tl(env_pc, dc->pc);
31673167 t_gen_raise_exception(EXCP_DEBUG);
31683168 dc->is_jmp = DISAS_UPDATE;
3169+ /* The address covered by the breakpoint must be included in
3170+ [tb->pc, tb->pc + tb->size) in order to for it to be
3171+ properly cleared -- thus we increment the PC here so that
3172+ the logic setting tb->size below does the right thing. */
3173+ dc->pc += 2;
31693174 break;
31703175 }
31713176
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -7962,6 +7962,11 @@ void gen_intermediate_code(CPUX86State *env, TranslationBlock *tb)
79627962 tb->flags & HF_RF_MASK
79637963 ? BP_GDB : BP_ANY))) {
79647964 gen_debug(dc, pc_ptr - dc->cs_base);
7965+ /* The address covered by the breakpoint must be included in
7966+ [tb->pc, tb->pc + tb->size) in order to for it to be
7967+ properly cleared -- thus we increment the PC here so that
7968+ the logic setting tb->size below does the right thing. */
7969+ pc_ptr += 1;
79657970 goto done_generating;
79667971 }
79677972 if (num_insns == max_insns && (tb->cflags & CF_LAST_IO)) {
--- a/target-lm32/translate.c
+++ b/target-lm32/translate.c
@@ -1078,6 +1078,11 @@ void gen_intermediate_code(CPULM32State *env, struct TranslationBlock *tb)
10781078 tcg_gen_movi_tl(cpu_pc, dc->pc);
10791079 t_gen_raise_exception(dc, EXCP_DEBUG);
10801080 dc->is_jmp = DISAS_UPDATE;
1081+ /* The address covered by the breakpoint must be included in
1082+ [tb->pc, tb->pc + tb->size) in order to for it to be
1083+ properly cleared -- thus we increment the PC here so that
1084+ the logic setting tb->size below does the right thing. */
1085+ dc->pc += 4;
10811086 break;
10821087 }
10831088
--- a/target-m68k/translate.c
+++ b/target-m68k/translate.c
@@ -3004,6 +3004,11 @@ void gen_intermediate_code(CPUM68KState *env, TranslationBlock *tb)
30043004 if (unlikely(cpu_breakpoint_test(cs, dc->pc, BP_ANY))) {
30053005 gen_exception(dc, dc->pc, EXCP_DEBUG);
30063006 dc->is_jmp = DISAS_JUMP;
3007+ /* The address covered by the breakpoint must be included in
3008+ [tb->pc, tb->pc + tb->size) in order to for it to be
3009+ properly cleared -- thus we increment the PC here so that
3010+ the logic setting tb->size below does the right thing. */
3011+ dc->pc += 2;
30073012 break;
30083013 }
30093014
--- a/target-microblaze/translate.c
+++ b/target-microblaze/translate.c
@@ -1693,6 +1693,11 @@ void gen_intermediate_code(CPUMBState *env, struct TranslationBlock *tb)
16931693 if (unlikely(cpu_breakpoint_test(cs, dc->pc, BP_ANY))) {
16941694 t_gen_raise_exception(dc, EXCP_DEBUG);
16951695 dc->is_jmp = DISAS_UPDATE;
1696+ /* The address covered by the breakpoint must be included in
1697+ [tb->pc, tb->pc + tb->size) in order to for it to be
1698+ properly cleared -- thus we increment the PC here so that
1699+ the logic setting tb->size below does the right thing. */
1700+ dc->pc += 4;
16961701 break;
16971702 }
16981703
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -19594,8 +19594,10 @@ void gen_intermediate_code(CPUMIPSState *env, struct TranslationBlock *tb)
1959419594 save_cpu_state(&ctx, 1);
1959519595 ctx.bstate = BS_BRANCH;
1959619596 gen_helper_raise_exception_debug(cpu_env);
19597- /* Include the breakpoint location or the tb won't
19598- * be flushed when it must be. */
19597+ /* The address covered by the breakpoint must be included in
19598+ [tb->pc, tb->pc + tb->size) in order to for it to be
19599+ properly cleared -- thus we increment the PC here so that
19600+ the logic setting tb->size below does the right thing. */
1959919601 ctx.pc += 4;
1960019602 goto done_generating;
1960119603 }
--- a/target-moxie/translate.c
+++ b/target-moxie/translate.c
@@ -848,6 +848,11 @@ void gen_intermediate_code(CPUMoxieState *env, struct TranslationBlock *tb)
848848 tcg_gen_movi_i32(cpu_pc, ctx.pc);
849849 gen_helper_debug(cpu_env);
850850 ctx.bstate = BS_EXCP;
851+ /* The address covered by the breakpoint must be included in
852+ [tb->pc, tb->pc + tb->size) in order to for it to be
853+ properly cleared -- thus we increment the PC here so that
854+ the logic setting tb->size below does the right thing. */
855+ ctx.pc += 2;
851856 goto done_generating;
852857 }
853858
--- a/target-openrisc/translate.c
+++ b/target-openrisc/translate.c
@@ -1665,6 +1665,11 @@ void gen_intermediate_code(CPUOpenRISCState *env, struct TranslationBlock *tb)
16651665 tcg_gen_movi_tl(cpu_pc, dc->pc);
16661666 gen_exception(dc, EXCP_DEBUG);
16671667 dc->is_jmp = DISAS_UPDATE;
1668+ /* The address covered by the breakpoint must be included in
1669+ [tb->pc, tb->pc + tb->size) in order to for it to be
1670+ properly cleared -- thus we increment the PC here so that
1671+ the logic setting tb->size below does the right thing. */
1672+ dc->pc += 4;
16681673 break;
16691674 }
16701675
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -11488,6 +11488,11 @@ void gen_intermediate_code(CPUPPCState *env, struct TranslationBlock *tb)
1148811488
1148911489 if (unlikely(cpu_breakpoint_test(cs, ctx.nip, BP_ANY))) {
1149011490 gen_debug_exception(ctxp);
11491+ /* The address covered by the breakpoint must be included in
11492+ [tb->pc, tb->pc + tb->size) in order to for it to be
11493+ properly cleared -- thus we increment the PC here so that
11494+ the logic setting tb->size below does the right thing. */
11495+ ctx.nip += 4;
1149111496 break;
1149211497 }
1149311498
--- a/target-s390x/translate.c
+++ b/target-s390x/translate.c
@@ -5360,6 +5360,11 @@ void gen_intermediate_code(CPUS390XState *env, struct TranslationBlock *tb)
53605360 if (unlikely(cpu_breakpoint_test(cs, dc.pc, BP_ANY))) {
53615361 status = EXIT_PC_STALE;
53625362 do_debug = true;
5363+ /* The address covered by the breakpoint must be included in
5364+ [tb->pc, tb->pc + tb->size) in order to for it to be
5365+ properly cleared -- thus we increment the PC here so that
5366+ the logic setting tb->size below does the right thing. */
5367+ dc.pc += 2;
53635368 break;
53645369 }
53655370
--- a/target-sh4/translate.c
+++ b/target-sh4/translate.c
@@ -1855,6 +1855,11 @@ void gen_intermediate_code(CPUSH4State * env, struct TranslationBlock *tb)
18551855 tcg_gen_movi_i32(cpu_pc, ctx.pc);
18561856 gen_helper_debug(cpu_env);
18571857 ctx.bstate = BS_BRANCH;
1858+ /* The address covered by the breakpoint must be included in
1859+ [tb->pc, tb->pc + tb->size) in order to for it to be
1860+ properly cleared -- thus we increment the PC here so that
1861+ the logic setting tb->size below does the right thing. */
1862+ ctx.pc += 2;
18581863 break;
18591864 }
18601865
--- a/target-sparc/translate.c
+++ b/target-sparc/translate.c
@@ -5247,6 +5247,7 @@ void gen_intermediate_code(CPUSPARCState * env, TranslationBlock * tb)
52475247 tcg_gen_insn_start(dc->pc, dc->npc);
52485248 }
52495249 num_insns++;
5250+ last_pc = dc->pc;
52505251
52515252 if (unlikely(cpu_breakpoint_test(cs, dc->pc, BP_ANY))) {
52525253 if (dc->pc != pc_start) {
@@ -5262,7 +5263,6 @@ void gen_intermediate_code(CPUSPARCState * env, TranslationBlock * tb)
52625263 gen_io_start();
52635264 }
52645265
5265- last_pc = dc->pc;
52665266 insn = cpu_ldl_code(env, dc->pc);
52675267
52685268 disas_sparc_insn(dc, insn);
--- a/target-unicore32/translate.c
+++ b/target-unicore32/translate.c
@@ -1917,9 +1917,11 @@ void gen_intermediate_code(CPUUniCore32State *env, TranslationBlock *tb)
19171917 gen_set_pc_im(dc->pc);
19181918 gen_exception(EXCP_DEBUG);
19191919 dc->is_jmp = DISAS_JUMP;
1920- /* Advance PC so that clearing the breakpoint will
1921- invalidate this TB. */
1922- dc->pc += 2; /* FIXME */
1920+ /* The address covered by the breakpoint must be included in
1921+ [tb->pc, tb->pc + tb->size) in order to for it to be
1922+ properly cleared -- thus we increment the PC here so that
1923+ the logic setting tb->size below does the right thing. */
1924+ dc->pc += 4;
19231925 goto done_generating;
19241926 }
19251927
--- a/target-xtensa/translate.c
+++ b/target-xtensa/translate.c
@@ -3088,6 +3088,11 @@ void gen_intermediate_code(CPUXtensaState *env, TranslationBlock *tb)
30883088 tcg_gen_movi_i32(cpu_pc, dc.pc);
30893089 gen_exception(&dc, EXCP_DEBUG);
30903090 dc.is_jmp = DISAS_UPDATE;
3091+ /* The address covered by the breakpoint must be included in
3092+ [tb->pc, tb->pc + tb->size) in order to for it to be
3093+ properly cleared -- thus we increment the PC here so that
3094+ the logic setting tb->size below does the right thing. */
3095+ dc.pc += 2;
30913096 break;
30923097 }
30933098