xref: /openbmc/qemu/accel/hvf/hvf-all.c (revision afb81fe8)
1 /*
2  * QEMU Hypervisor.framework support
3  *
4  * This work is licensed under the terms of the GNU GPL, version 2.  See
5  * the COPYING file in the top-level directory.
6  *
7  * Contributions after 2012-01-13 are licensed under the terms of the
8  * GNU GPL, version 2 or (at your option) any later version.
9  */
10 
11 #include "qemu/osdep.h"
12 #include "qemu/error-report.h"
13 #include "sysemu/hvf.h"
14 #include "sysemu/hvf_int.h"
15 
16 void assert_hvf_ok(hv_return_t ret)
17 {
18     if (ret == HV_SUCCESS) {
19         return;
20     }
21 
22     switch (ret) {
23     case HV_ERROR:
24         error_report("Error: HV_ERROR");
25         break;
26     case HV_BUSY:
27         error_report("Error: HV_BUSY");
28         break;
29     case HV_BAD_ARGUMENT:
30         error_report("Error: HV_BAD_ARGUMENT");
31         break;
32     case HV_NO_RESOURCES:
33         error_report("Error: HV_NO_RESOURCES");
34         break;
35     case HV_NO_DEVICE:
36         error_report("Error: HV_NO_DEVICE");
37         break;
38     case HV_UNSUPPORTED:
39         error_report("Error: HV_UNSUPPORTED");
40         break;
41 #if defined(MAC_OS_VERSION_11_0) && \
42     MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_VERSION_11_0
43     case HV_DENIED:
44         error_report("Error: HV_DENIED");
45         break;
46 #endif
47     default:
48         error_report("Unknown Error");
49     }
50 
51     abort();
52 }
53 
54 struct hvf_sw_breakpoint *hvf_find_sw_breakpoint(CPUState *cpu, vaddr pc)
55 {
56     struct hvf_sw_breakpoint *bp;
57 
58     QTAILQ_FOREACH(bp, &hvf_state->hvf_sw_breakpoints, entry) {
59         if (bp->pc == pc) {
60             return bp;
61         }
62     }
63     return NULL;
64 }
65 
66 int hvf_sw_breakpoints_active(CPUState *cpu)
67 {
68     return !QTAILQ_EMPTY(&hvf_state->hvf_sw_breakpoints);
69 }
70 
71 int hvf_update_guest_debug(CPUState *cpu)
72 {
73     hvf_arch_update_guest_debug(cpu);
74     return 0;
75 }
76