diff --git a/qemu/accel/tcg/cpu-exec.c b/qemu/accel/tcg/cpu-exec.c index 9ccbb223..f747324f 100644 --- a/qemu/accel/tcg/cpu-exec.c +++ b/qemu/accel/tcg/cpu-exec.c @@ -290,7 +290,9 @@ static inline void cpu_handle_debug_exception(CPUState *cpu) } } - cc->debug_excp_handler(cpu); + if (cc->tcg_ops.debug_excp_handler) { + cc->tcg_ops.debug_excp_handler(cpu); + } } static inline bool cpu_handle_exception(struct uc_struct *uc, CPUState *cpu, int *ret) diff --git a/qemu/include/qom/cpu.h b/qemu/include/qom/cpu.h index 4af038ea..add1d0f7 100644 --- a/qemu/include/qom/cpu.h +++ b/qemu/include/qom/cpu.h @@ -116,6 +116,8 @@ typedef struct TcgCpuOperations { bool (*tlb_fill)(CPUState *cpu, vaddr address, int size, MMUAccessType access_type, int mmu_idx, bool probe, uintptr_t retaddr); + /** @debug_excp_handler: Callback for handling debug exceptions */ + void (*debug_excp_handler)(CPUState *cpu); } TcgCpuOperations; @@ -155,7 +157,6 @@ typedef struct TcgCpuOperations { * instead of get_phys_page_debug. * @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. @@ -200,7 +201,6 @@ typedef struct CPUClass { 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; diff --git a/qemu/qom/cpu.c b/qemu/qom/cpu.c index 2e013069..c989fb2f 100644 --- a/qemu/qom/cpu.c +++ b/qemu/qom/cpu.c @@ -293,7 +293,7 @@ static void cpu_class_init(struct uc_struct *uc, ObjectClass *klass, void *data) k->has_work = cpu_common_has_work; 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->tcg_ops.debug_excp_handler = cpu_common_noop; k->debug_check_watchpoint = cpu_common_debug_check_watchpoint; k->tcg_ops.cpu_exec_enter = cpu_common_noop; k->tcg_ops.cpu_exec_exit = cpu_common_noop; diff --git a/qemu/target/arm/cpu.c b/qemu/target/arm/cpu.c index c2baa507..597e10be 100644 --- a/qemu/target/arm/cpu.c +++ b/qemu/target/arm/cpu.c @@ -2112,7 +2112,7 @@ static void arm_cpu_class_init(struct uc_struct *uc, ObjectClass *oc, void *data cc->tcg_ops.cpu_exec_interrupt = arm_cpu_exec_interrupt; cc->tcg_ops.synchronize_from_tb = arm_cpu_synchronize_from_tb; cc->tcg_ops.tlb_fill = arm_cpu_tlb_fill; - cc->debug_excp_handler = arm_debug_excp_handler; + cc->tcg_ops.debug_excp_handler = arm_debug_excp_handler; cc->debug_check_watchpoint = arm_debug_check_watchpoint; cc->do_unaligned_access = arm_cpu_do_unaligned_access; #if !defined(CONFIG_USER_ONLY) diff --git a/qemu/target/i386/cpu.c b/qemu/target/i386/cpu.c index 79a5daef..48d28c73 100644 --- a/qemu/target/i386/cpu.c +++ b/qemu/target/i386/cpu.c @@ -5892,7 +5892,7 @@ static void x86_cpu_common_class_init(struct uc_struct *uc, ObjectClass *oc, voi cc->do_interrupt = x86_cpu_do_interrupt; #endif #if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY) - cc->debug_excp_handler = breakpoint_handler; + cc->tcg_ops.debug_excp_handler = breakpoint_handler; #endif }