xref: /openbmc/qemu/include/sysemu/hvf.h (revision d0cda6f4)
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 "qom/object.h"
18 
19 #ifdef NEED_CPU_H
20 #include "cpu.h"
21 
22 #ifdef CONFIG_HVF
23 extern bool hvf_allowed;
24 #define hvf_enabled() (hvf_allowed)
25 #else /* !CONFIG_HVF */
26 #define hvf_enabled() 0
27 #endif /* !CONFIG_HVF */
28 
29 #endif /* NEED_CPU_H */
30 
31 #define TYPE_HVF_ACCEL ACCEL_CLASS_NAME("hvf")
32 
33 typedef struct HVFState HVFState;
34 DECLARE_INSTANCE_CHECKER(HVFState, HVF_STATE,
35                          TYPE_HVF_ACCEL)
36 
37 #ifdef NEED_CPU_H
38 struct hvf_sw_breakpoint {
39     vaddr pc;
40     vaddr saved_insn;
41     int use_count;
42     QTAILQ_ENTRY(hvf_sw_breakpoint) entry;
43 };
44 
45 struct hvf_sw_breakpoint *hvf_find_sw_breakpoint(CPUState *cpu,
46                                                  vaddr pc);
47 int hvf_sw_breakpoints_active(CPUState *cpu);
48 
49 int hvf_arch_insert_sw_breakpoint(CPUState *cpu, struct hvf_sw_breakpoint *bp);
50 int hvf_arch_remove_sw_breakpoint(CPUState *cpu, struct hvf_sw_breakpoint *bp);
51 int hvf_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type);
52 int hvf_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type);
53 void hvf_arch_remove_all_hw_breakpoints(void);
54 
55 /*
56  * hvf_update_guest_debug:
57  * @cs: CPUState for the CPU to update
58  *
59  * Update guest to enable or disable debugging. Per-arch specifics will be
60  * handled by calling down to hvf_arch_update_guest_debug.
61  */
62 int hvf_update_guest_debug(CPUState *cpu);
63 void hvf_arch_update_guest_debug(CPUState *cpu);
64 
65 /*
66  * Return whether the guest supports debugging.
67  */
68 bool hvf_arch_supports_guest_debug(void);
69 #endif /* NEED_CPU_H */
70 
71 #endif
72