Skip to content

Commit

Permalink
target/arm: Wrap breakpoint/watchpoint updates with tcg_enabled
Browse files Browse the repository at this point in the history
This is in preparation for restricting compilation of some parts of
debug_helper.c to TCG only.

Signed-off-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
Fabiano Rosas authored and pm215 committed Feb 27, 2023
1 parent 2121548 commit fa05d1a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
6 changes: 4 additions & 2 deletions target/arm/cpu.c
Expand Up @@ -539,8 +539,10 @@ static void arm_cpu_reset_hold(Object *obj)
}
#endif

hw_breakpoint_update_all(cpu);
hw_watchpoint_update_all(cpu);
if (tcg_enabled()) {
hw_breakpoint_update_all(cpu);
hw_watchpoint_update_all(cpu);
}
arm_rebuild_hflags(env);
}

Expand Down
16 changes: 12 additions & 4 deletions target/arm/debug_helper.c
Expand Up @@ -939,7 +939,9 @@ static void dbgwvr_write(CPUARMState *env, const ARMCPRegInfo *ri,
value &= ~3ULL;

raw_write(env, ri, value);
hw_watchpoint_update(cpu, i);
if (tcg_enabled()) {
hw_watchpoint_update(cpu, i);
}
}

static void dbgwcr_write(CPUARMState *env, const ARMCPRegInfo *ri,
Expand All @@ -949,7 +951,9 @@ static void dbgwcr_write(CPUARMState *env, const ARMCPRegInfo *ri,
int i = ri->crm;

raw_write(env, ri, value);
hw_watchpoint_update(cpu, i);
if (tcg_enabled()) {
hw_watchpoint_update(cpu, i);
}
}

void hw_breakpoint_update(ARMCPU *cpu, int n)
Expand Down Expand Up @@ -1062,7 +1066,9 @@ static void dbgbvr_write(CPUARMState *env, const ARMCPRegInfo *ri,
int i = ri->crm;

raw_write(env, ri, value);
hw_breakpoint_update(cpu, i);
if (tcg_enabled()) {
hw_breakpoint_update(cpu, i);
}
}

static void dbgbcr_write(CPUARMState *env, const ARMCPRegInfo *ri,
Expand All @@ -1079,7 +1085,9 @@ static void dbgbcr_write(CPUARMState *env, const ARMCPRegInfo *ri,
value = deposit64(value, 8, 1, extract64(value, 7, 1));

raw_write(env, ri, value);
hw_breakpoint_update(cpu, i);
if (tcg_enabled()) {
hw_breakpoint_update(cpu, i);
}
}

void define_debug_regs(ARMCPU *cpu)
Expand Down
7 changes: 5 additions & 2 deletions target/arm/machine.c
Expand Up @@ -2,6 +2,7 @@
#include "cpu.h"
#include "qemu/error-report.h"
#include "sysemu/kvm.h"
#include "sysemu/tcg.h"
#include "kvm_arm.h"
#include "internals.h"
#include "migration/cpu.h"
Expand Down Expand Up @@ -848,8 +849,10 @@ static int cpu_post_load(void *opaque, int version_id)
return -1;
}

hw_breakpoint_update_all(cpu);
hw_watchpoint_update_all(cpu);
if (tcg_enabled()) {
hw_breakpoint_update_all(cpu);
hw_watchpoint_update_all(cpu);
}

/*
* TCG gen_update_fp_context() relies on the invariant that
Expand Down

0 comments on commit fa05d1a

Please sign in to comment.