include/exec: Split out watchpoint.h

Relatively few objects in qemu care about watchpoints, so split
out to a new header.  Removes an instance of CONFIG_USER_ONLY
from hw/core/cpu.h.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2025-03-14 10:39:19 -07:00
parent 17a71e8969
commit 3e57baa22e
14 changed files with 53 additions and 32 deletions

View file

@ -37,6 +37,7 @@
#include "exec/hwaddr.h" #include "exec/hwaddr.h"
#include "exec/tb-flush.h" #include "exec/tb-flush.h"
#include "exec/translation-block.h" #include "exec/translation-block.h"
#include "exec/watchpoint.h"
#include "gdbstub/enums.h" #include "gdbstub/enums.h"
#include "hw/core/cpu.h" #include "hw/core/cpu.h"

41
include/exec/watchpoint.h Normal file
View file

@ -0,0 +1,41 @@
/*
* CPU watchpoints
*
* Copyright (c) 2012 SUSE LINUX Products GmbH
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#ifndef EXEC_WATCHPOINT_H
#define EXEC_WATCHPOINT_H
#if defined(CONFIG_USER_ONLY)
static inline int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,
int flags, CPUWatchpoint **watchpoint)
{
return -ENOSYS;
}
static inline int cpu_watchpoint_remove(CPUState *cpu, vaddr addr,
vaddr len, int flags)
{
return -ENOSYS;
}
static inline void cpu_watchpoint_remove_by_ref(CPUState *cpu,
CPUWatchpoint *wp)
{
}
static inline void cpu_watchpoint_remove_all(CPUState *cpu, int mask)
{
}
#else
int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,
int flags, CPUWatchpoint **watchpoint);
int cpu_watchpoint_remove(CPUState *cpu, vaddr addr,
vaddr len, int flags);
void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUWatchpoint *watchpoint);
void cpu_watchpoint_remove_all(CPUState *cpu, int mask);
#endif
#endif /* EXEC_WATCHPOINT_H */

View file

@ -1109,36 +1109,6 @@ static inline bool cpu_breakpoint_test(CPUState *cpu, vaddr pc, int mask)
return false; return false;
} }
#if defined(CONFIG_USER_ONLY)
static inline int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,
int flags, CPUWatchpoint **watchpoint)
{
return -ENOSYS;
}
static inline int cpu_watchpoint_remove(CPUState *cpu, vaddr addr,
vaddr len, int flags)
{
return -ENOSYS;
}
static inline void cpu_watchpoint_remove_by_ref(CPUState *cpu,
CPUWatchpoint *wp)
{
}
static inline void cpu_watchpoint_remove_all(CPUState *cpu, int mask)
{
}
#else
int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,
int flags, CPUWatchpoint **watchpoint);
int cpu_watchpoint_remove(CPUState *cpu, vaddr addr,
vaddr len, int flags);
void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUWatchpoint *watchpoint);
void cpu_watchpoint_remove_all(CPUState *cpu, int mask);
#endif
/** /**
* cpu_get_address_space: * cpu_get_address_space:
* @cpu: CPU to get address space from * @cpu: CPU to get address space from

View file

@ -21,6 +21,7 @@
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "exec/cputlb.h" #include "exec/cputlb.h"
#include "exec/target_page.h" #include "exec/target_page.h"
#include "exec/watchpoint.h"
#include "hw/core/cpu.h" #include "hw/core/cpu.h"
/* Add a watchpoint. */ /* Add a watchpoint. */

View file

@ -13,6 +13,7 @@
#include "cpregs.h" #include "cpregs.h"
#include "exec/exec-all.h" #include "exec/exec-all.h"
#include "exec/helper-proto.h" #include "exec/helper-proto.h"
#include "exec/watchpoint.h"
#include "system/tcg.h" #include "system/tcg.h"
#ifdef CONFIG_TCG #ifdef CONFIG_TCG

View file

@ -35,6 +35,7 @@
#include "standard-headers/asm-x86/kvm_para.h" #include "standard-headers/asm-x86/kvm_para.h"
#include "hw/qdev-properties.h" #include "hw/qdev-properties.h"
#include "hw/i386/topology.h" #include "hw/i386/topology.h"
#include "exec/watchpoint.h"
#ifndef CONFIG_USER_ONLY #ifndef CONFIG_USER_ONLY
#include "system/reset.h" #include "system/reset.h"
#include "qapi/qapi-commands-machine-target.h" #include "qapi/qapi-commands-machine-target.h"

View file

@ -7,7 +7,7 @@
#include "hw/i386/x86.h" #include "hw/i386/x86.h"
#include "kvm/kvm_i386.h" #include "kvm/kvm_i386.h"
#include "hw/xen/xen.h" #include "hw/xen/xen.h"
#include "exec/watchpoint.h"
#include "system/kvm.h" #include "system/kvm.h"
#include "system/kvm_xen.h" #include "system/kvm_xen.h"
#include "system/tcg.h" #include "system/tcg.h"

View file

@ -21,6 +21,7 @@
#include "cpu.h" #include "cpu.h"
#include "exec/exec-all.h" #include "exec/exec-all.h"
#include "exec/helper-proto.h" #include "exec/helper-proto.h"
#include "exec/watchpoint.h"
#include "tcg/helper-tcg.h" #include "tcg/helper-tcg.h"

View file

@ -22,6 +22,7 @@
#include "cpu-models.h" #include "cpu-models.h"
#include "cpu-qom.h" #include "cpu-qom.h"
#include "exec/log.h" #include "exec/log.h"
#include "exec/watchpoint.h"
#include "fpu/softfloat-helpers.h" #include "fpu/softfloat-helpers.h"
#include "mmu-hash64.h" #include "mmu-hash64.h"
#include "helper_regs.h" #include "helper_regs.h"

View file

@ -40,7 +40,7 @@
#include "qemu/cutils.h" #include "qemu/cutils.h"
#include "disas/capstone.h" #include "disas/capstone.h"
#include "fpu/softfloat.h" #include "fpu/softfloat.h"
#include "exec/watchpoint.h"
#include "helper_regs.h" #include "helper_regs.h"
#include "internal.h" #include "internal.h"
#include "spr_common.h" #include "spr_common.h"

View file

@ -30,6 +30,7 @@
#include "trace.h" #include "trace.h"
#include "exec/exec-all.h" #include "exec/exec-all.h"
#include "exec/helper-proto.h" #include "exec/helper-proto.h"
#include "exec/watchpoint.h"
#include "system/cpu-timers.h" #include "system/cpu-timers.h"
/* /*

View file

@ -27,6 +27,7 @@
#include "target/s390x/kvm/pv.h" #include "target/s390x/kvm/pv.h"
#include "system/hw_accel.h" #include "system/hw_accel.h"
#include "system/runstate.h" #include "system/runstate.h"
#include "exec/watchpoint.h"
void s390x_tod_timer(void *opaque) void s390x_tod_timer(void *opaque)
{ {

View file

@ -24,6 +24,7 @@
#include "exec/helper-proto.h" #include "exec/helper-proto.h"
#include "exec/cputlb.h" #include "exec/cputlb.h"
#include "exec/exec-all.h" #include "exec/exec-all.h"
#include "exec/watchpoint.h"
#include "s390x-internal.h" #include "s390x-internal.h"
#include "tcg_s390x.h" #include "tcg_s390x.h"
#ifndef CONFIG_USER_ONLY #ifndef CONFIG_USER_ONLY

View file

@ -31,6 +31,7 @@
#include "exec/helper-proto.h" #include "exec/helper-proto.h"
#include "qemu/host-utils.h" #include "qemu/host-utils.h"
#include "exec/exec-all.h" #include "exec/exec-all.h"
#include "exec/watchpoint.h"
#include "system/address-spaces.h" #include "system/address-spaces.h"
void HELPER(wsr_ibreakenable)(CPUXtensaState *env, uint32_t v) void HELPER(wsr_ibreakenable)(CPUXtensaState *env, uint32_t v)