1c97d6d2cSSergio Andres Gomez Del Real /* 2c97d6d2cSSergio Andres Gomez Del Real * QEMU Hypervisor.framework (HVF) support 3c97d6d2cSSergio Andres Gomez Del Real * 4c97d6d2cSSergio Andres Gomez Del Real * Copyright Google Inc., 2017 5c97d6d2cSSergio Andres Gomez Del Real * 6c97d6d2cSSergio Andres Gomez Del Real * This work is licensed under the terms of the GNU GPL, version 2 or later. 7c97d6d2cSSergio Andres Gomez Del Real * See the COPYING file in the top-level directory. 8c97d6d2cSSergio Andres Gomez Del Real * 9c97d6d2cSSergio Andres Gomez Del Real */ 10c97d6d2cSSergio Andres Gomez Del Real 11c97d6d2cSSergio Andres Gomez Del Real /* header to be included in non-HVF-specific code */ 12a8b991b5SMarkus Armbruster 13a8b991b5SMarkus Armbruster #ifndef HVF_H 14a8b991b5SMarkus Armbruster #define HVF_H 15c97d6d2cSSergio Andres Gomez Del Real 16940e43aaSClaudio Fontana #include "qemu/accel.h" 17*0af34b1dSPhilippe Mathieu-Daudé #include "qemu/queue.h" 18*0af34b1dSPhilippe Mathieu-Daudé #include "exec/vaddr.h" 19db1015e9SEduardo Habkost #include "qom/object.h" 20d48ad737SEduardo Habkost 217d7a21baSPhilippe Mathieu-Daudé #ifdef COMPILING_PER_TARGET 2213b48fb0SThomas Huth 23c97d6d2cSSergio Andres Gomez Del Real #ifdef CONFIG_HVF 24f291cf54SPhilippe Mathieu-Daudé extern bool hvf_allowed; 2592cc3aaaSRoman Bolshakov #define hvf_enabled() (hvf_allowed) 26f291cf54SPhilippe Mathieu-Daudé #else /* !CONFIG_HVF */ 27c97d6d2cSSergio Andres Gomez Del Real #define hvf_enabled() 0 28f291cf54SPhilippe Mathieu-Daudé #endif /* !CONFIG_HVF */ 29c97d6d2cSSergio Andres Gomez Del Real 307d7a21baSPhilippe Mathieu-Daudé #endif /* COMPILING_PER_TARGET */ 3113b48fb0SThomas Huth 32c97d6d2cSSergio Andres Gomez Del Real #define TYPE_HVF_ACCEL ACCEL_CLASS_NAME("hvf") 33c97d6d2cSSergio Andres Gomez Del Real 343932885aSEduardo Habkost typedef struct HVFState HVFState; 358110fa1dSEduardo Habkost DECLARE_INSTANCE_CHECKER(HVFState, HVF_STATE, 368110fa1dSEduardo Habkost TYPE_HVF_ACCEL) 37c97d6d2cSSergio Andres Gomez Del Real 387d7a21baSPhilippe Mathieu-Daudé #ifdef COMPILING_PER_TARGET 39f4152040SFrancesco Cagnin struct hvf_sw_breakpoint { 40fcfe7616SAnton Johansson vaddr pc; 41fcfe7616SAnton Johansson vaddr saved_insn; 42f4152040SFrancesco Cagnin int use_count; 43f4152040SFrancesco Cagnin QTAILQ_ENTRY(hvf_sw_breakpoint) entry; 44f4152040SFrancesco Cagnin }; 45f4152040SFrancesco Cagnin 46f4152040SFrancesco Cagnin struct hvf_sw_breakpoint *hvf_find_sw_breakpoint(CPUState *cpu, 47fcfe7616SAnton Johansson vaddr pc); 48f4152040SFrancesco Cagnin int hvf_sw_breakpoints_active(CPUState *cpu); 49f4152040SFrancesco Cagnin 50f4152040SFrancesco Cagnin int hvf_arch_insert_sw_breakpoint(CPUState *cpu, struct hvf_sw_breakpoint *bp); 51f4152040SFrancesco Cagnin int hvf_arch_remove_sw_breakpoint(CPUState *cpu, struct hvf_sw_breakpoint *bp); 52d447a624SAnton Johansson int hvf_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type); 53d447a624SAnton Johansson int hvf_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type); 54f4152040SFrancesco Cagnin void hvf_arch_remove_all_hw_breakpoints(void); 55eb2edc42SFrancesco Cagnin 56eb2edc42SFrancesco Cagnin /* 57eb2edc42SFrancesco Cagnin * hvf_update_guest_debug: 58eb2edc42SFrancesco Cagnin * @cs: CPUState for the CPU to update 59eb2edc42SFrancesco Cagnin * 60eb2edc42SFrancesco Cagnin * Update guest to enable or disable debugging. Per-arch specifics will be 61eb2edc42SFrancesco Cagnin * handled by calling down to hvf_arch_update_guest_debug. 62eb2edc42SFrancesco Cagnin */ 63eb2edc42SFrancesco Cagnin int hvf_update_guest_debug(CPUState *cpu); 64eb2edc42SFrancesco Cagnin void hvf_arch_update_guest_debug(CPUState *cpu); 65eb2edc42SFrancesco Cagnin 66eb2edc42SFrancesco Cagnin /* 67eb2edc42SFrancesco Cagnin * Return whether the guest supports debugging. 68eb2edc42SFrancesco Cagnin */ 69eb2edc42SFrancesco Cagnin bool hvf_arch_supports_guest_debug(void); 707d7a21baSPhilippe Mathieu-Daudé #endif /* COMPILING_PER_TARGET */ 71f4152040SFrancesco Cagnin 72c97d6d2cSSergio Andres Gomez Del Real #endif 73