Skip to contentSkip to conversation

target-arm: Update PC before calling gen_helper_check_breakpoints()

PATCH Applied Sergey Fedorov 2 participants 2 messages Nov 10, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target-arm: Update PC before calling gen_helper_check_breakpoints()

PC should be updated in the CPU state before calling check_breakpoints() helper. Otherwise, the helper would not see the correct PC in the CPU state if it is not at the start of a TB.

---
 target-arm/translate-a64.c | 1 +
 target-arm/translate.c     | 1 +
 2 files changed, 2 insertions(+)
target-arm/translate-a64.c +1 -0
index d7e0954..fe485a4 100644
@@ -11102,6 +11102,7 @@ void gen_intermediate_code_a64(ARMCPU *cpu, TranslationBlock *tb)
             QTAILQ_FOREACH(bp, &cs->breakpoints, entry) {
                 if (bp->pc == dc->pc) {
                     if (bp->flags & BP_CPU) {
+                        gen_a64_set_pc_im(dc->pc);
                         gen_helper_check_breakpoints(cpu_env);
                         /* End the TB early; it likely won't be executed */
                         dc->is_jmp = DISAS_UPDATE;
target-arm/translate.c +1 -0
index a56f7fe..4351854 100644
@@ -11373,6 +11373,7 @@ void gen_intermediate_code(CPUARMState *env, TranslationBlock *tb)
             QTAILQ_FOREACH(bp, &cs->breakpoints, entry) {
                 if (bp->pc == dc->pc) {
                     if (bp->flags & BP_CPU) {
+                        gen_set_pc_im(dc, dc->pc);
                         gen_helper_check_breakpoints(cpu_env);
                         /* End the TB early; it's likely not going to be executed */
                         dc->is_jmp = DISAS_UPDATE;
Signature · 1 line
1.9.1
#1 lore raw
Quoted 35 lines · Sergey Fedorov

PC should be updated in the CPU state before calling check_breakpoints() helper. Otherwise, the helper would not see the correct PC in the CPU state if it is not at the start of a TB.

---
 target-arm/translate-a64.c | 1 +
 target-arm/translate.c     | 1 +
 2 files changed, 2 insertions(+)
target-arm/translate-a64.c +1 -0
index d7e0954..fe485a4 100644
@@ -11102,6 +11102,7 @@ void gen_intermediate_code_a64(ARMCPU *cpu, TranslationBlock *tb)
             QTAILQ_FOREACH(bp, &cs->breakpoints, entry) {
                 if (bp->pc == dc->pc) {
                     if (bp->flags & BP_CPU) {
+                        gen_a64_set_pc_im(dc->pc);
                         gen_helper_check_breakpoints(cpu_env);
                         /* End the TB early; it likely won't be executed */
                         dc->is_jmp = DISAS_UPDATE;
target-arm/translate.c +1 -1
index a56f7fe..4351854 100644
@@ -11373,6 +11373,7 @@ void gen_intermediate_code(CPUARMState *env, TranslationBlock *tb)
             QTAILQ_FOREACH(bp, &cs->breakpoints, entry) {
                 if (bp->pc == dc->pc) {
                     if (bp->flags & BP_CPU) {
+                        gen_set_pc_im(dc, dc->pc);
                         gen_helper_check_breakpoints(cpu_env);
                         /* End the TB early; it's likely not going to be executed */
                         dc->is_jmp = DISAS_UPDATE;
--
Quoted 2 lines

1.9.1

Applied to target-arm.next, thanks.

-- PMM