1 /* 2 * QEMU Hypervisor.framework (HVF) support 3 * 4 * Copyright Google Inc., 2017 5 * 6 * This work is licensed under the terms of the GNU GPL, version 2 or later. 7 * See the COPYING file in the top-level directory. 8 * 9 */ 10 11 /* header to be included in non-HVF-specific code */ 12 13 #ifndef HVF_H 14 #define HVF_H 15 16 #include "qemu/accel.h" 17 #include "qemu/queue.h" 18 #include "exec/vaddr.h" 19 #include "qom/object.h" 20 21 #ifdef COMPILING_PER_TARGET 22 23 #ifdef CONFIG_HVF 24 extern bool hvf_allowed; 25 #define hvf_enabled() (hvf_allowed) 26 #else /* !CONFIG_HVF */ 27 #define hvf_enabled() 0 28 #endif /* !CONFIG_HVF */ 29 30 #endif /* COMPILING_PER_TARGET */ 31 32 #define TYPE_HVF_ACCEL ACCEL_CLASS_NAME("hvf") 33 34 typedef struct HVFState HVFState; 35 DECLARE_INSTANCE_CHECKER(HVFState, HVF_STATE, 36 TYPE_HVF_ACCEL) 37 38 #ifdef COMPILING_PER_TARGET 39 struct hvf_sw_breakpoint { 40 vaddr pc; 41 vaddr saved_insn; 42 int use_count; 43 QTAILQ_ENTRY(hvf_sw_breakpoint) entry; 44 }; 45 46 struct hvf_sw_breakpoint *hvf_find_sw_breakpoint(CPUState *cpu, 47 vaddr pc); 48 int hvf_sw_breakpoints_active(CPUState *cpu); 49 50 int hvf_arch_insert_sw_breakpoint(CPUState *cpu, struct hvf_sw_breakpoint *bp); 51 int hvf_arch_remove_sw_breakpoint(CPUState *cpu, struct hvf_sw_breakpoint *bp); 52 int hvf_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type); 53 int hvf_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type); 54 void hvf_arch_remove_all_hw_breakpoints(void); 55 56 /* 57 * hvf_update_guest_debug: 58 * @cs: CPUState for the CPU to update 59 * 60 * Update guest to enable or disable debugging. Per-arch specifics will be 61 * handled by calling down to hvf_arch_update_guest_debug. 62 */ 63 int hvf_update_guest_debug(CPUState *cpu); 64 void hvf_arch_update_guest_debug(CPUState *cpu); 65 66 /* 67 * Return whether the guest supports debugging. 68 */ 69 bool hvf_arch_supports_guest_debug(void); 70 #endif /* COMPILING_PER_TARGET */ 71 72 #endif 73