diff --git a/qemu/include/qom/cpu.h b/qemu/include/qom/cpu.h index bd4dfdb8..6bad665c 100644 --- a/qemu/include/qom/cpu.h +++ b/qemu/include/qom/cpu.h @@ -63,6 +63,7 @@ typedef uint64_t vaddr; #define CPU_GET_CLASS(uc, obj) OBJECT_GET_CLASS(uc, CPUClass, (obj), TYPE_CPU) typedef struct CPUState CPUState; +typedef struct CPUWatchpoint CPUWatchpoint; typedef void (*CPUUnassignedAccess)(CPUState *cpu, hwaddr addr, bool is_write, bool is_exec, int opaque, @@ -100,6 +101,8 @@ struct TranslationBlock; * @asidx_from_attrs: Callback to return the CPU AddressSpace to use for * a memory access with the specified memory transaction attributes. * @debug_excp_handler: Callback for handling debug exceptions. + * @debug_check_watchpoint: Callback: return true if the architectural + * watchpoint whose address has matched should really fire. * @vmsd: State description for migration. * @cpu_exec_enter: Callback for cpu_exec preparation. * @cpu_exec_exit: Callback for cpu_exec cleanup. @@ -140,6 +143,7 @@ typedef struct CPUClass { hwaddr (*get_phys_page_attrs_debug)(CPUState *cpu, vaddr addr, MemTxAttrs *attrs); int (*asidx_from_attrs)(CPUState *cpu, MemTxAttrs attrs); + bool (*debug_check_watchpoint)(CPUState *cpu, CPUWatchpoint *wp); void (*debug_excp_handler)(CPUState *cpu); const struct VMStateDescription *vmsd; @@ -167,13 +171,13 @@ typedef struct CPUBreakpoint { QTAILQ_ENTRY(CPUBreakpoint) entry; } CPUBreakpoint; -typedef struct CPUWatchpoint { +struct CPUWatchpoint { vaddr vaddr; vaddr len; vaddr hitaddr; int flags; /* BP_* */ QTAILQ_ENTRY(CPUWatchpoint) entry; -} CPUWatchpoint; +}; struct KVMState; struct kvm_run; diff --git a/qemu/qom/cpu.c b/qemu/qom/cpu.c index db0f4789..a58d4f3c 100644 --- a/qemu/qom/cpu.c +++ b/qemu/qom/cpu.c @@ -178,6 +178,14 @@ static bool cpu_common_has_work(CPUState *cs) return false; } +static bool cpu_common_debug_check_watchpoint(CPUState *cpu, CPUWatchpoint *wp) +{ + /* If no extra check is required, QEMU watchpoint match can be considered + * as an architectural match. + */ + return true; +} + ObjectClass *cpu_class_by_name(struct uc_struct *uc, const char *typename, const char *cpu_model) { CPUClass *cc = CPU_CLASS(uc, object_class_by_name(uc, typename)); @@ -255,6 +263,7 @@ static void cpu_class_init(struct uc_struct *uc, ObjectClass *klass, void *data) k->get_paging_enabled = cpu_common_get_paging_enabled; k->get_memory_mapping = cpu_common_get_memory_mapping; k->debug_excp_handler = cpu_common_noop; + k->debug_check_watchpoint = cpu_common_debug_check_watchpoint; k->cpu_exec_enter = cpu_common_noop; k->cpu_exec_exit = cpu_common_noop; k->cpu_exec_interrupt = cpu_common_exec_interrupt;