target-*: Advance pc after recognizing a breakpoint
PATCH 1/1 target-*: Advance pc after recognizing a breakpoint
Some targets already had this within their logic, but make sure it's present for all targets.
--- target-alpha/translate.c | 3 +++ target-cris/translate.c | 3 +++ target-i386/translate.c | 3 +++ target-lm32/translate.c | 3 +++ target-m68k/translate.c | 3 +++ target-microblaze/translate.c | 3 +++ target-moxie/translate.c | 3 +++ target-openrisc/translate.c | 3 +++ target-ppc/translate.c | 3 +++ target-s390x/translate.c | 3 +++ target-sh4/translate.c | 3 +++ target-sparc/translate.c | 2 +- target-unicore32/translate.c | 2 +- target-xtensa/translate.c | 3 +++ 14 files changed, 38 insertions(+), 2 deletions(-)
target-alpha/translate.c +3 -0
@@ -2917,6 +2917,9 @@ void gen_intermediate_code(CPUAlphaState *env, struct TranslationBlock *tb)if (unlikely (cpu_breakpoint_test (cs, ctx.pc,BP_ANY ))) {gen_excp (&ctx,EXCP_DEBUG ,0 ); +/* Advance PC so that clearing the breakpoint will +invalidate this TB. */ + ctx.pc +=4 ;break ; }if (num_insns == max_insns && (tb->cflags &CF_LAST_IO )) {
target-cris/translate.c +3 -0
@@ -3166,6 +3166,9 @@ void gen_intermediate_code(CPUCRISState *env, struct TranslationBlock *tb)tcg_gen_movi_tl (env_pc, dc->pc);t_gen_raise_exception (EXCP_DEBUG ); dc->is_jmp =DISAS_UPDATE ; +/* Advance PC so that clearing the breakpoint will +invalidate this TB. */ + dc->pc +=2 ;break ; }
target-i386/translate.c +3 -0
@@ -7942,6 +7942,9 @@ void gen_intermediate_code(CPUX86State *env, TranslationBlock *tb) tb->flags & HF_RF_MASK ? BP_GDB : BP_ANY))) {gen_debug (dc, pc_ptr - dc->cs_base); +/* Advance PC so that clearing the breakpoint will +invalidate this TB. */ + pc_ptr +=1 ; goto done_generating; }if (num_insns == max_insns && (tb->cflags &CF_LAST_IO )) {
target-lm32/translate.c +3 -0
@@ -1078,6 +1078,9 @@ void gen_intermediate_code(CPULM32State *env, struct TranslationBlock *tb)tcg_gen_movi_tl (cpu_pc, dc->pc);t_gen_raise_exception (dc,EXCP_DEBUG ); dc->is_jmp =DISAS_UPDATE ; +/* Advance PC so that clearing the breakpoint will +invalidate this TB. */ + dc->pc +=4 ;break ; }
target-m68k/translate.c +3 -0
@@ -3004,6 +3004,9 @@ void gen_intermediate_code(CPUM68KState *env, TranslationBlock *tb)if (unlikely (cpu_breakpoint_test (cs, dc->pc,BP_ANY ))) {gen_exception (dc, dc->pc,EXCP_DEBUG ); dc->is_jmp =DISAS_JUMP ; +/* Advance PC so that clearing the breakpoint will +invalidate this TB. */ + dc->pc +=2 ;break ; }
target-microblaze/translate.c +3 -0
@@ -1693,6 +1693,9 @@ void gen_intermediate_code(CPUMBState *env, struct TranslationBlock *tb)if (unlikely (cpu_breakpoint_test (cs, dc->pc,BP_ANY ))) {t_gen_raise_exception (dc,EXCP_DEBUG ); dc->is_jmp =DISAS_UPDATE ; +/* Advance PC so that clearing the breakpoint will +invalidate this TB. */ + dc->pc +=4 ;break ; }
target-moxie/translate.c +3 -0
@@ -848,6 +848,9 @@ void gen_intermediate_code(CPUMoxieState *env, struct TranslationBlock *tb)tcg_gen_movi_i32 (cpu_pc, ctx.pc);gen_helper_debug (cpu_env); ctx.bstate =BS_EXCP ; +/* Advance PC so that clearing the breakpoint will +invalidate this TB. */ + ctx.pc +=2 ; goto done_generating; }
target-openrisc/translate.c +3 -0
@@ -1665,6 +1665,9 @@ void gen_intermediate_code(CPUOpenRISCState *env, struct TranslationBlock *tb)tcg_gen_movi_tl (cpu_pc, dc->pc);gen_exception (dc,EXCP_DEBUG ); dc->is_jmp =DISAS_UPDATE ; +/* Advance PC so that clearing the breakpoint will +invalidate this TB. */ + dc->pc +=4 ;break ; }
target-ppc/translate.c +3 -0
@@ -11488,6 +11488,9 @@ void gen_intermediate_code(CPUPPCState *env, struct TranslationBlock *tb)if (unlikely (cpu_breakpoint_test (cs, ctx.nip,BP_ANY ))) {gen_debug_exception (ctxp); +/* Advance PC so that clearing the breakpoint will +invalidate this TB. */ + ctx.nip +=4 ;break ; }
target-s390x/translate.c +3 -0
@@ -5360,6 +5360,9 @@ void gen_intermediate_code(CPUS390XState *env, struct TranslationBlock *tb)if (unlikely (cpu_breakpoint_test (cs, dc.pc,BP_ANY ))) { status =EXIT_PC_STALE ; do_debug = true; +/* Advance PC so that clearing the breakpoint will +invalidate this TB. */ + dc.pc +=2 ;break ; }
target-sh4/translate.c +3 -0
@@ -1855,6 +1855,9 @@ void gen_intermediate_code(CPUSH4State * env, struct TranslationBlock *tb)tcg_gen_movi_i32 (cpu_pc, ctx.pc);gen_helper_debug (cpu_env); ctx.bstate =BS_BRANCH ; +/* Advance PC so that clearing the breakpoint will +invalidate this TB. */ + ctx.pc +=2 ;break ; }
target-sparc/translate.c +1 -1
@@ -5247,6 +5247,7 @@ void gen_intermediate_code(CPUSPARCState * env, TranslationBlock * tb)tcg_gen_insn_start (dc->pc, dc->npc); } num_insns++; + last_pc = dc->pc;if (unlikely (cpu_breakpoint_test (cs, dc->pc,BP_ANY ))) {if (dc->pc != pc_start) {
@@ -5262,7 +5263,6 @@ void gen_intermediate_code(CPUSPARCState * env, TranslationBlock * tb)gen_io_start (); } - last_pc = dc->pc; insn =cpu_ldl_code (env, dc->pc);disas_sparc_insn (dc, insn);
target-unicore32/translate.c +1 -1
@@ -1919,7 +1919,7 @@ void gen_intermediate_code(CPUUniCore32State *env, TranslationBlock *tb) dc->is_jmp =DISAS_JUMP ;/* Advance PC so that clearing the breakpoint will invalidate this TB. */ - dc->pc +=2 ;/* FIXME */ + dc->pc +=4 ; goto done_generating; }
target-xtensa/translate.c +3 -0
@@ -3055,6 +3055,9 @@ void gen_intermediate_code(CPUXtensaState *env, TranslationBlock *tb)tcg_gen_movi_i32 (cpu_pc, dc.pc);gen_exception (&dc,EXCP_DEBUG ); dc.is_jmp =DISAS_UPDATE ; +/* Advance PC so that clearing the breakpoint will +invalidate this TB. */ + dc.pc +=2 ;break ; }
Signature · 1 line
2.4.3
Quoted 4 lines · Richard Henderson
Some targets already had this within their logic, but make sure it's present for all targets.
Signed-off-by Richard Henderson <[email protected]>
Thanks,
Sergey
Quoted 218 lines
--- target-alpha/translate.c | 3 +++ target-cris/translate.c | 3 +++ target-i386/translate.c | 3 +++ target-lm32/translate.c | 3 +++ target-m68k/translate.c | 3 +++ target-microblaze/translate.c | 3 +++ target-moxie/translate.c | 3 +++ target-openrisc/translate.c | 3 +++ target-ppc/translate.c | 3 +++ target-s390x/translate.c | 3 +++ target-sh4/translate.c | 3 +++ target-sparc/translate.c | 2 +- target-unicore32/translate.c | 2 +- target-xtensa/translate.c | 3 +++ 14 files changed, 38 insertions(+), 2 deletions(-)target-alpha/translate.c +3
-0@@ -2917,6 +2917,9 @@ void gen_intermediate_code(CPUAlphaState *env, struct TranslationBlock *tb)if (unlikely (cpu_breakpoint_test (cs, ctx.pc,BP_ANY ))) {gen_excp (&ctx,EXCP_DEBUG ,0 ); +/* Advance PC so that clearing the breakpoint will +invalidate this TB. */ + ctx.pc +=4 ;break ; }if (num_insns == max_insns && (tb->cflags &CF_LAST_IO )) {target-cris/translate.c +3
-0@@ -3166,6 +3166,9 @@ void gen_intermediate_code(CPUCRISState *env, struct TranslationBlock *tb)tcg_gen_movi_tl (env_pc, dc->pc);t_gen_raise_exception (EXCP_DEBUG ); dc->is_jmp =DISAS_UPDATE ; +/* Advance PC so that clearing the breakpoint will +invalidate this TB. */ + dc->pc +=2 ;break ; }target-i386/translate.c +3
-0@@ -7942,6 +7942,9 @@ void gen_intermediate_code(CPUX86State *env, TranslationBlock *tb) tb->flags & HF_RF_MASK ? BP_GDB : BP_ANY))) {gen_debug (dc, pc_ptr - dc->cs_base); +/* Advance PC so that clearing the breakpoint will +invalidate this TB. */ + pc_ptr +=1 ; goto done_generating; }if (num_insns == max_insns && (tb->cflags &CF_LAST_IO )) {target-lm32/translate.c +3
-0@@ -1078,6 +1078,9 @@ void gen_intermediate_code(CPULM32State *env, struct TranslationBlock *tb)tcg_gen_movi_tl (cpu_pc, dc->pc);t_gen_raise_exception (dc,EXCP_DEBUG ); dc->is_jmp =DISAS_UPDATE ; +/* Advance PC so that clearing the breakpoint will +invalidate this TB. */ + dc->pc +=4 ;break ; }target-m68k/translate.c +3
-0@@ -3004,6 +3004,9 @@ void gen_intermediate_code(CPUM68KState *env, TranslationBlock *tb)if (unlikely (cpu_breakpoint_test (cs, dc->pc,BP_ANY ))) {gen_exception (dc, dc->pc,EXCP_DEBUG ); dc->is_jmp =DISAS_JUMP ; +/* Advance PC so that clearing the breakpoint will +invalidate this TB. */ + dc->pc +=2 ;break ; }target-microblaze/translate.c +3
-0@@ -1693,6 +1693,9 @@ void gen_intermediate_code(CPUMBState *env, struct TranslationBlock *tb)if (unlikely (cpu_breakpoint_test (cs, dc->pc,BP_ANY ))) {t_gen_raise_exception (dc,EXCP_DEBUG ); dc->is_jmp =DISAS_UPDATE ; +/* Advance PC so that clearing the breakpoint will +invalidate this TB. */ + dc->pc +=4 ;break ; }target-moxie/translate.c +3
-0@@ -848,6 +848,9 @@ void gen_intermediate_code(CPUMoxieState *env, struct TranslationBlock *tb)tcg_gen_movi_i32 (cpu_pc, ctx.pc);gen_helper_debug (cpu_env); ctx.bstate =BS_EXCP ; +/* Advance PC so that clearing the breakpoint will +invalidate this TB. */ + ctx.pc +=2 ; goto done_generating; }target-openrisc/translate.c +3
-0@@ -1665,6 +1665,9 @@ void gen_intermediate_code(CPUOpenRISCState *env, struct TranslationBlock *tb)tcg_gen_movi_tl (cpu_pc, dc->pc);gen_exception (dc,EXCP_DEBUG ); dc->is_jmp =DISAS_UPDATE ; +/* Advance PC so that clearing the breakpoint will +invalidate this TB. */ + dc->pc +=4 ;break ; }target-ppc/translate.c +3
-0@@ -11488,6 +11488,9 @@ void gen_intermediate_code(CPUPPCState *env, struct TranslationBlock *tb)if (unlikely (cpu_breakpoint_test (cs, ctx.nip,BP_ANY ))) {gen_debug_exception (ctxp); +/* Advance PC so that clearing the breakpoint will +invalidate this TB. */ + ctx.nip +=4 ;break ; }target-s390x/translate.c +3
-0@@ -5360,6 +5360,9 @@ void gen_intermediate_code(CPUS390XState *env, struct TranslationBlock *tb)if (unlikely (cpu_breakpoint_test (cs, dc.pc,BP_ANY ))) { status =EXIT_PC_STALE ; do_debug = true; +/* Advance PC so that clearing the breakpoint will +invalidate this TB. */ + dc.pc +=2 ;break ; }target-sh4/translate.c +3
-0@@ -1855,6 +1855,9 @@ void gen_intermediate_code(CPUSH4State * env, struct TranslationBlock *tb)tcg_gen_movi_i32 (cpu_pc, ctx.pc);gen_helper_debug (cpu_env); ctx.bstate =BS_BRANCH ; +/* Advance PC so that clearing the breakpoint will +invalidate this TB. */ + ctx.pc +=2 ;break ; }target-sparc/translate.c +1
-1@@ -5247,6 +5247,7 @@ void gen_intermediate_code(CPUSPARCState * env, TranslationBlock * tb)tcg_gen_insn_start (dc->pc, dc->npc); } num_insns++; + last_pc = dc->pc;if (unlikely (cpu_breakpoint_test (cs, dc->pc,BP_ANY ))) {if (dc->pc != pc_start) {@@ -5262,7 +5263,6 @@ void gen_intermediate_code(CPUSPARCState * env, TranslationBlock * tb)gen_io_start (); } - last_pc = dc->pc; insn =cpu_ldl_code (env, dc->pc);disas_sparc_insn (dc, insn);target-unicore32/translate.c +1
-1@@ -1919,7 +1919,7 @@ void gen_intermediate_code(CPUUniCore32State *env, TranslationBlock *tb) dc->is_jmp =DISAS_JUMP ;/* Advance PC so that clearing the breakpoint will invalidate this TB. */ - dc->pc +=2 ;/* FIXME */ + dc->pc +=4 ; goto done_generating; }target-xtensa/translate.c +3
-0@@ -3055,6 +3055,9 @@ void gen_intermediate_code(CPUXtensaState *env, TranslationBlock *tb)tcg_gen_movi_i32 (cpu_pc, dc.pc);gen_exception (&dc,EXCP_DEBUG ); dc.is_jmp =DISAS_UPDATE ; +/* Advance PC so that clearing the breakpoint will +invalidate this TB. */ + dc.pc +=2 ;break ; }
Quoted 26 lines · Richard Henderson
Some targets already had this within their logic, but make sure it's present for all targets.
Signed-off-by Richard Henderson <[email protected]>--- target-alpha/translate.c | 3 +++ target-cris/translate.c | 3 +++ target-i386/translate.c | 3 +++ target-lm32/translate.c | 3 +++ target-m68k/translate.c | 3 +++ target-microblaze/translate.c | 3 +++ target-moxie/translate.c | 3 +++ target-openrisc/translate.c | 3 +++ target-ppc/translate.c | 3 +++ target-s390x/translate.c | 3 +++ target-sh4/translate.c | 3 +++ target-sparc/translate.c | 2 +- target-unicore32/translate.c | 2 +- target-xtensa/translate.c | 3 +++ 14 files changed, 38 insertions(+), 2 deletions(-)target-alpha/translate.c +0
-0
target-alpha/translate.c void gen_intermediate_code(CPUAlphaState *env, struct TranslationBlock *tb) · line 2924
Quoted 8 lines
target-alpha/translate.c +3
-0@@ -2917,6 +2917,9 @@ void gen_intermediate_code(CPUAlphaState *env, struct TranslationBlock *tb)if (unlikely (cpu_breakpoint_test (cs, ctx.pc,BP_ANY ))) {gen_excp (&ctx,EXCP_DEBUG ,0 ); +/* Advance PC so that clearing the breakpoint will +invalidate this TB. */ + ctx.pc +=4 ;break ; }
This is still the same cryptic comment we have in the targets which do do this. Can we have something that is a bit more explanatory about what is going on and why we need to do this, please?
(Also explaining what the number you need to advance by should be would be helpful for people writing new targets in future.)
thanks
-- PMM
Quoted 4 lines · Peter Maydell
This is still the same cryptic comment we have in the targets which do do this. Can we have something that is a bit more explanatory about what is going on and why we need to do this, please?
Suggestions?
Quoted 3 lines
(Also explaining what the number you need to advance by should be would be helpful for people writing new targets in future.)
The number needed for advancing *need* only be 1, but I've continued with the existing tradition of advancing by the minimum instruction size.
r~
Quoted 9 lines · Richard Henderson
Quoted 5 lines · Peter Maydell
This is still the same cryptic comment we have in the targets which do do this. Can we have something that is a bit more explanatory about what is going on and why we need to do this, please?
Suggestions?
...well, I don't entirely understand the problem it's fixing, which is why I'm asking for a better comment :-)
thanks
-- PMM
Quoted 9 lines · Peter Maydell
Quoted 8 lines · Richard Henderson
Quoted 5 lines · Peter Maydell
This is still the same cryptic comment we have in the targets which do do this. Can we have something that is a bit more explanatory about what is going on and why we need to do this, please?
Quoted 4 lines
Quoted 1 line
Suggestions?
...well, I don't entirely understand the problem it's fixing, which is why I'm asking for a better comment :-)
Heh. Fair enough. How about
/* The address covered by the breakpoint must be included in
[tb->pc, tb->pc + tb->size) in order to for it to be
properly cleared -- thus we increment the PC here so that
the logic setting tb->size below does the right thing. */There are two edge cases that cause the problem with clearing that could be described, but I think that the comment becomes too bulky, as well as confuses the situation for someone cutting-and-pasting the logic to a new port.
r~
Quoted 11 lines · Richard Henderson
Heh. Fair enough. How about
/* The address covered by the breakpoint must be included in
[tb->pc, tb->pc + tb->size) in order to for it to be properly cleared -- thus we increment the PC here so that the logic setting tb->size below does the right thing. */There are two edge cases that cause the problem with clearing that could be described, but I think that the comment becomes too bulky, as well as confuses the situation for someone cutting-and-pasting the logic to a new port.
OK, that sounds good. (It does suggest that we should just be advancing PC by 1 for all targets, though.)
-- PMM
Quoted 18 lines · Richard Henderson
Quoted 9 lines · Peter Maydell
Quoted 8 lines · Richard Henderson
Quoted 5 lines · Peter Maydell
This is still the same cryptic comment we have in the targets which do do this. Can we have something that is a bit more explanatory about what is going on and why we need to do this, please?
Quoted 4 lines
Quoted 1 line
Suggestions?
...well, I don't entirely understand the problem it's fixing, which is why I'm asking for a better comment :-)
Heh. Fair enough. How about
/* The address covered by the breakpoint must be included in
Quoted 8 lines
[tb->pc, tb->pc + tb->size) in order to for it to be properly cleared -- thus we increment the PC here so that the logic setting tb->size below does the right thing. */There are two edge cases that cause the problem with clearing that could be described, but I think that the comment becomes too bulky, as well as confuses the situation for someone cutting-and-pasting the logic to a new port.
Maybe we could rather fix that condition in tb_invalidate_phys_page_range()? It seems weird that it can't handle a zero-sized TB.
Best,
Sergey
Quoted 19 lines · Sergey Fedorov
Quoted 18 lines · Richard Henderson
Quoted 10 lines · Peter Maydell
Quoted 7 lines · Richard Henderson
Quoted 4 lines · Peter Maydell
This is still the same cryptic comment we have in the targets which do do this. Can we have something that is a bit more explanatory about what is going on and why we need to do this, please?
Suggestions?
...well, I don't entirely understand the problem it's fixing, which is why I'm asking for a better comment :-)
Heh. Fair enough. How about
/* The address covered by the breakpoint must be included in
[tb->pc, tb->pc + tb->size) in order to for it to be properly cleared -- thus we increment the PC here so that the logic setting tb->size below does the right thing. */
Quoted 7 lines
Quoted 4 lines
There are two edge cases that cause the problem with clearing that could be described, but I think that the comment becomes too bulky, as well as confuses the situation for someone cutting-and-pasting the logic to a new port.
Maybe we could rather fix that condition in
tb_invalidate_phys_page_range()? It seems weird that it can't handle a zero-sized TB.
I think extending "!(tb_end <= start || tb_start >= end)" condition to "!(tb_end <= start || tb_start >= end) || tb_start == start" would work fine. Thoughts? I could prepare a patch for that.
Best regards,
Sergey
Quoted 23 lines · Sergey Fedorov
Quoted 22 lines · Sergey Fedorov
Quoted 21 lines · Richard Henderson
Quoted 9 lines · Peter Maydell
Quoted 6 lines · Richard Henderson
Quoted 4 lines · Peter Maydell
This is still the same cryptic comment we have in the targets which do do this. Can we have something that is a bit more explanatory about what is going on and why we need to do this, please?
Suggestions?
...well, I don't entirely understand the problem it's fixing, which is why I'm asking for a better comment :-)
Heh. Fair enough. How about
/* The address covered by the breakpoint must be included in
[tb->pc, tb->pc + tb->size) in order to for it to be properly cleared -- thus we increment the PC here so that the logic setting tb->size below does the right thing. */There are two edge cases that cause the problem with clearing that could be described, but I think that the comment becomes too bulky, as well as confuses the situation for someone cutting-and-pasting the logic to a new port.
Quoted 6 lines
Quoted 3 lines
Maybe we could rather fix that condition in
tb_invalidate_phys_page_range()? It seems weird that it can't handle a zero-sized TB.I think extending "!(tb_end <= start ||
tb_start>= end)" condition to "!(tb_end <= start ||tb_start>= end) ||tb_start== start" would work fine. Thoughts? I could prepare a patch for that.
But there are at least two other places which doesn't seem to support a zero-sized TB: build_page_bitmap(), and tb_gen_code() when checking if a next page is needed.
Best,
Sergey
Quoted 23 lines · Sergey Fedorov
Quoted 22 lines · Richard Henderson
Quoted 9 lines · Peter Maydell
Quoted 8 lines · Richard Henderson
Quoted 5 lines · Peter Maydell
This is still the same cryptic comment we have in the targets which do do this. Can we have something that is a bit more explanatory about what is going on and why we need to do this, please?
Quoted 4 lines
Quoted 1 line
Suggestions?
...well, I don't entirely understand the problem it's fixing, which is why I'm asking for a better comment :-)
Heh. Fair enough. How about
/* The address covered by the breakpoint must be included in
[tb->pc, tb->pc + tb->size) in order to for it to be properly cleared -- thus we increment the PC here so that the logic setting tb->size below does the right thing. */
Quoted 8 lines
Quoted 4 lines
There are two edge cases that cause the problem with clearing that could be described, but I think that the comment becomes too bulky, as well as confuses the situation for someone cutting-and-pasting the logic to a new port.
Maybe we could rather fix that condition in
tb_invalidate_phys_page_range()? It seems weird that it can't handle a zero-sized TB.
We also need to be able to handle a TB which crosses a page. E.g. the breakpoint is at the page boundary, and we fall through into it from the top. This will be true on e.g. x86. This is not simply true for breakpoint insertion/removal, but also page invalidation.
The same fix, adding a byte to the size, handles this as well.
r~
Quoted 34 lines · Richard Henderson
Quoted 24 lines · Sergey Fedorov
Quoted 23 lines · Richard Henderson
Quoted 10 lines · Peter Maydell
Quoted 8 lines · Richard Henderson
Quoted 5 lines · Peter Maydell
This is still the same cryptic comment we have in the targets which do do this. Can we have something that is a bit more explanatory about what is going on and why we need to do this, please?
Quoted 4 lines
Quoted 1 line
Suggestions?
...well, I don't entirely understand the problem it's fixing, which is why I'm asking for a better comment :-)
Heh. Fair enough. How about
/* The address covered by the breakpoint must be included in
[tb->pc, tb->pc + tb->size) in order to for it to be properly cleared -- thus we increment the PC here so that the logic setting tb->size below does the right thing. */Quoted 8 lines
Quoted 4 lines
There are two edge cases that cause the problem with clearing that could be described, but I think that the comment becomes too bulky, as well as confuses the situation for someone cutting-and-pasting the logic to a new port.
Maybe we could rather fix that condition in
tb_invalidate_phys_page_range()? It seems weird that it can't handle a zero-sized TB.
Quoted 6 lines
We also need to be able to handle a TB which crosses a page. E.g. the breakpoint is at the page boundary, and we fall through into it from the top. This will be true on e.g. x86. This is not simply true for breakpoint insertion/removal, but also page invalidation.
The same fix, adding a byte to the size, handles this as well.
It's clear except that instructions crossing a page boundary can be different in size. AFAIK, x86 instructions can be up to 15-byte long. What if only the very last byte of instruction crosses a page boundary?
Best regards,
Sergey
Quoted 40 lines · Sergey Fedorov
Quoted 39 lines · Richard Henderson
Quoted 24 lines · Sergey Fedorov
Quoted 23 lines · Richard Henderson
Quoted 10 lines · Peter Maydell
Quoted 8 lines · Richard Henderson
Quoted 5 lines · Peter Maydell
This is still the same cryptic comment we have in the targets which do do this. Can we have something that is a bit more explanatory about what is going on and why we need to do this, please?
Quoted 4 lines
Quoted 1 line
Suggestions?
...well, I don't entirely understand the problem it's fixing, which is why I'm asking for a better comment :-)
Heh. Fair enough. How about
/* The address covered by the breakpoint must be included in [tb->pc, tb->pc + tb->size) in order to for it to be properly cleared -- thus we increment the PC here so that the logic setting tb->size below does the right thing. */Quoted 8 lines
Quoted 4 lines
There are two edge cases that cause the problem with clearing that could be described, but I think that the comment becomes too bulky, as well as confuses the situation for someone cutting-and-pasting the logic to a new port.
Maybe we could rather fix that condition in
tb_invalidate_phys_page_range()? It seems weird that it can't handle a zero-sized TB.We also need to be able to handle a TB which crosses a page. E.g. the breakpoint is at the page boundary, and we fall through into it from the top. This will be true on e.g. x86. This is not simply true for breakpoint insertion/removal, but also page invalidation.
Quoted 5 lines
Quoted 1 line
The same fix, adding a byte to the size, handles this as well.
It's clear except that instructions crossing a page boundary can be different in size. AFAIK, x86 instructions can be up to 15-byte long. What if only the very last byte of instruction crosses a page boundary?
Then only the last byte crosses? What's your point?
r~
Quoted 42 lines · Richard Henderson
Quoted 41 lines · Sergey Fedorov
Quoted 40 lines · Richard Henderson
Quoted 30 lines · Sergey Fedorov
Quoted 23 lines · Richard Henderson
Quoted 10 lines · Peter Maydell
Quoted 8 lines · Richard Henderson
Quoted 5 lines · Peter Maydell
This is still the same cryptic comment we have in the targets which do do this. Can we have something that is a bit more explanatory about what is going on and why we need to do this, please?
Quoted 4 lines
Quoted 1 line
Suggestions?
...well, I don't entirely understand the problem it's fixing, which is why I'm asking for a better comment :-)
Heh. Fair enough. How about
/* The address covered by the breakpoint must be included in [tb->pc, tb->pc + tb->size) in order to for it to be properly cleared -- thus we increment the PC here so that the logic setting tb->size below does the right thing. */Quoted 5 lines
There are two edge cases that cause the problem with clearing that could be described, but I think that the comment becomes too bulky, as
well as confuses the situation for someone cutting-and-pasting the logic to a new port.Quoted 3 lines
Maybe we could rather fix that condition in
tb_invalidate_phys_page_range()? It seems weird that it can't handle a zero-sized TB.We also need to be able to handle a TB which crosses a page. E.g. the breakpoint is at the page boundary, and we fall through into it from the top. This will be true on e.g. x86. This is not simply true for breakpoint insertion/removal, but also page invalidation.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
The same fix, adding a byte to the size, handles this as well.
It's clear except that instructions crossing a page boundary can be different in size. AFAIK, x86 instructions can be up to 15-byte long. What if only the very last byte of instruction crosses a page boundary?
Then only the last byte crosses? What's your point?
My point is if "adding a byte to the size" handles such case as well.
Best,
Sergey