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" 17db1015e9SEduardo Habkost #include "qom/object.h" 18d48ad737SEduardo Habkost 1913b48fb0SThomas Huth #ifdef NEED_CPU_H 20f4152040SFrancesco Cagnin #include "cpu.h" 2113b48fb0SThomas Huth 22c97d6d2cSSergio Andres Gomez Del Real #ifdef CONFIG_HVF 23c97d6d2cSSergio Andres Gomez Del Real uint32_t hvf_get_supported_cpuid(uint32_t func, uint32_t idx, 24c97d6d2cSSergio Andres Gomez Del Real int reg); 25f291cf54SPhilippe Mathieu-Daudé extern bool hvf_allowed; 2692cc3aaaSRoman Bolshakov #define hvf_enabled() (hvf_allowed) 27f291cf54SPhilippe Mathieu-Daudé #else /* !CONFIG_HVF */ 28c97d6d2cSSergio Andres Gomez Del Real #define hvf_enabled() 0 29c97d6d2cSSergio Andres Gomez Del Real #define hvf_get_supported_cpuid(func, idx, reg) 0 30f291cf54SPhilippe Mathieu-Daudé #endif /* !CONFIG_HVF */ 31c97d6d2cSSergio Andres Gomez Del Real 3213b48fb0SThomas Huth #endif /* NEED_CPU_H */ 3313b48fb0SThomas Huth 34c97d6d2cSSergio Andres Gomez Del Real #define TYPE_HVF_ACCEL ACCEL_CLASS_NAME("hvf") 35c97d6d2cSSergio Andres Gomez Del Real 363932885aSEduardo Habkost typedef struct HVFState HVFState; 378110fa1dSEduardo Habkost DECLARE_INSTANCE_CHECKER(HVFState, HVF_STATE, 388110fa1dSEduardo Habkost TYPE_HVF_ACCEL) 39c97d6d2cSSergio Andres Gomez Del Real 40f4152040SFrancesco Cagnin #ifdef NEED_CPU_H 41f4152040SFrancesco Cagnin struct hvf_sw_breakpoint { 42*fcfe7616SAnton Johansson vaddr pc; 43*fcfe7616SAnton Johansson vaddr saved_insn; 44f4152040SFrancesco Cagnin int use_count; 45f4152040SFrancesco Cagnin QTAILQ_ENTRY(hvf_sw_breakpoint) entry; 46f4152040SFrancesco Cagnin }; 47f4152040SFrancesco Cagnin 48f4152040SFrancesco Cagnin struct hvf_sw_breakpoint *hvf_find_sw_breakpoint(CPUState *cpu, 49*fcfe7616SAnton Johansson vaddr pc); 50f4152040SFrancesco Cagnin int hvf_sw_breakpoints_active(CPUState *cpu); 51f4152040SFrancesco Cagnin 52f4152040SFrancesco Cagnin int hvf_arch_insert_sw_breakpoint(CPUState *cpu, struct hvf_sw_breakpoint *bp); 53f4152040SFrancesco Cagnin int hvf_arch_remove_sw_breakpoint(CPUState *cpu, struct hvf_sw_breakpoint *bp); 54f4152040SFrancesco Cagnin int hvf_arch_insert_hw_breakpoint(target_ulong addr, target_ulong len, 55f4152040SFrancesco Cagnin int type); 56f4152040SFrancesco Cagnin int hvf_arch_remove_hw_breakpoint(target_ulong addr, target_ulong len, 57f4152040SFrancesco Cagnin int type); 58f4152040SFrancesco Cagnin void hvf_arch_remove_all_hw_breakpoints(void); 59eb2edc42SFrancesco Cagnin 60eb2edc42SFrancesco Cagnin /* 61eb2edc42SFrancesco Cagnin * hvf_update_guest_debug: 62eb2edc42SFrancesco Cagnin * @cs: CPUState for the CPU to update 63eb2edc42SFrancesco Cagnin * 64eb2edc42SFrancesco Cagnin * Update guest to enable or disable debugging. Per-arch specifics will be 65eb2edc42SFrancesco Cagnin * handled by calling down to hvf_arch_update_guest_debug. 66eb2edc42SFrancesco Cagnin */ 67eb2edc42SFrancesco Cagnin int hvf_update_guest_debug(CPUState *cpu); 68eb2edc42SFrancesco Cagnin void hvf_arch_update_guest_debug(CPUState *cpu); 69eb2edc42SFrancesco Cagnin 70eb2edc42SFrancesco Cagnin /* 71eb2edc42SFrancesco Cagnin * Return whether the guest supports debugging. 72eb2edc42SFrancesco Cagnin */ 73eb2edc42SFrancesco Cagnin bool hvf_arch_supports_guest_debug(void); 74f4152040SFrancesco Cagnin #endif /* NEED_CPU_H */ 75f4152040SFrancesco Cagnin 76c97d6d2cSSergio Andres Gomez Del Real #endif 77