2021-06-03 16:09:30 +03:00
|
|
|
/*
|
|
|
|
* QEMU Hypervisor.framework support
|
|
|
|
*
|
|
|
|
* This work is licensed under the terms of the GNU GPL, version 2. See
|
|
|
|
* the COPYING file in the top-level directory.
|
|
|
|
*
|
|
|
|
* Contributions after 2012-01-13 are licensed under the terms of the
|
|
|
|
* GNU GPL, version 2 or (at your option) any later version.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "qemu/osdep.h"
|
|
|
|
#include "qemu/error-report.h"
|
|
|
|
#include "sysemu/hvf.h"
|
|
|
|
#include "sysemu/hvf_int.h"
|
|
|
|
|
2024-06-05 14:25:56 +03:00
|
|
|
const char *hvf_return_string(hv_return_t ret)
|
2021-06-03 16:09:30 +03:00
|
|
|
{
|
|
|
|
switch (ret) {
|
2024-06-05 14:25:56 +03:00
|
|
|
case HV_SUCCESS: return "HV_SUCCESS";
|
|
|
|
case HV_ERROR: return "HV_ERROR";
|
|
|
|
case HV_BUSY: return "HV_BUSY";
|
|
|
|
case HV_BAD_ARGUMENT: return "HV_BAD_ARGUMENT";
|
|
|
|
case HV_NO_RESOURCES: return "HV_NO_RESOURCES";
|
|
|
|
case HV_NO_DEVICE: return "HV_NO_DEVICE";
|
|
|
|
case HV_UNSUPPORTED: return "HV_UNSUPPORTED";
|
|
|
|
case HV_DENIED: return "HV_DENIED";
|
|
|
|
default: return "[unknown hv_return value]";
|
2021-06-03 16:09:30 +03:00
|
|
|
}
|
2024-06-05 14:25:56 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void assert_hvf_ok_impl(hv_return_t ret, const char *file, unsigned int line,
|
|
|
|
const char *exp)
|
|
|
|
{
|
|
|
|
if (ret == HV_SUCCESS) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
error_report("Error: %s = %s (0x%x, at %s:%u)",
|
|
|
|
exp, hvf_return_string(ret), ret, file, line);
|
2021-06-03 16:09:30 +03:00
|
|
|
|
|
|
|
abort();
|
|
|
|
}
|
2023-06-06 12:19:30 +03:00
|
|
|
|
2023-08-07 18:56:59 +03:00
|
|
|
struct hvf_sw_breakpoint *hvf_find_sw_breakpoint(CPUState *cpu, vaddr pc)
|
2023-06-06 12:19:30 +03:00
|
|
|
{
|
|
|
|
struct hvf_sw_breakpoint *bp;
|
|
|
|
|
|
|
|
QTAILQ_FOREACH(bp, &hvf_state->hvf_sw_breakpoints, entry) {
|
|
|
|
if (bp->pc == pc) {
|
|
|
|
return bp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
int hvf_sw_breakpoints_active(CPUState *cpu)
|
|
|
|
{
|
|
|
|
return !QTAILQ_EMPTY(&hvf_state->hvf_sw_breakpoints);
|
|
|
|
}
|
2023-06-06 12:19:30 +03:00
|
|
|
|
|
|
|
int hvf_update_guest_debug(CPUState *cpu)
|
|
|
|
{
|
|
|
|
hvf_arch_update_guest_debug(cpu);
|
|
|
|
return 0;
|
|
|
|
}
|