winhvemulation is x86_64 only. Exception exit bitmaps are also x86_64 only Others are just variable definitions not used on arm64.
Signed-off-by: Mohamed Mediouni <moha...@unpredictable.fr> --- accel/whpx/whpx-common.c | 20 ++++++++++++++++++-- include/system/whpx-all.h | 2 ++ include/system/whpx-common.h | 2 ++ include/system/whpx-internal.h | 7 ++++++- 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/accel/whpx/whpx-common.c b/accel/whpx/whpx-common.c index b5e5fda696..eeefaea329 100644 --- a/accel/whpx/whpx-common.c +++ b/accel/whpx/whpx-common.c @@ -41,7 +41,9 @@ bool whpx_allowed; static bool whp_dispatch_initialized; static HMODULE hWinHvPlatform; +#ifdef __x86_64__ static HMODULE hWinHvEmulation; +#endif struct whpx_state whpx_global; struct WHPDispatch whp_dispatch; @@ -106,11 +108,16 @@ int whpx_first_vcpu_starting(CPUState *cpu) * whpx_translate_cpu_breakpoints(). WHPX breakpoints must * now be recomputed. */ +#ifdef __x86_64__ whpx_translate_cpu_breakpoints(&whpx->breakpoints, cpu, i); +#endif } +#ifdef __x86_64__ /* Actually insert the breakpoints into the memory. */ whpx_apply_breakpoints(whpx->breakpoints.breakpoints, cpu, true); +#endif } +#ifdef __x86_64__ HRESULT hr; uint64_t exception_mask; if (whpx->step_pending || @@ -132,6 +139,7 @@ int whpx_first_vcpu_starting(CPUState *cpu) "hr=%08lx.", hr); return 1; } +#endif return 0; } @@ -238,8 +246,10 @@ void whpx_destroy_vcpu(CPUState *cpu) struct whpx_state *whpx = &whpx_global; whp_dispatch.WHvDeleteVirtualProcessor(whpx->partition, cpu->cpu_index); +#ifdef __x86_64__ AccelCPUState *vcpu = cpu->accel; whp_dispatch.WHvEmulatorDestroyEmulator(vcpu->emulator); +#endif g_free(cpu->accel); } @@ -414,8 +424,12 @@ static bool load_whp_dispatch_fns(HMODULE *handle, LIST_WINHVPLATFORM_FUNCTIONS(WHP_LOAD_FIELD) break; case WINHV_EMULATION_FNS_DEFAULT: +#ifdef __x86_64__ WHP_LOAD_LIB(WINHV_EMULATION_DLL, hLib) LIST_WINHVEMULATION_FUNCTIONS(WHP_LOAD_FIELD) +#else + abort(); +#endif break; case WINHV_PLATFORM_FNS_SUPPLEMENTAL: WHP_LOAD_LIB(WINHV_PLATFORM_DLL, hLib) @@ -541,11 +555,11 @@ bool init_whp_dispatch(void) if (!load_whp_dispatch_fns(&hWinHvPlatform, WINHV_PLATFORM_FNS_DEFAULT)) { goto error; } - +#ifdef __x86_64__ if (!load_whp_dispatch_fns(&hWinHvEmulation, WINHV_EMULATION_FNS_DEFAULT)) { goto error; } - +#endif assert(load_whp_dispatch_fns(&hWinHvPlatform, WINHV_PLATFORM_FNS_SUPPLEMENTAL)); whp_dispatch_initialized = true; @@ -555,9 +569,11 @@ error: if (hWinHvPlatform) { FreeLibrary(hWinHvPlatform); } +#ifdef __x86_64__ if (hWinHvEmulation) { FreeLibrary(hWinHvEmulation); } +#endif return false; } diff --git a/include/system/whpx-all.h b/include/system/whpx-all.h index a82b083284..838a25fa75 100644 --- a/include/system/whpx-all.h +++ b/include/system/whpx-all.h @@ -8,5 +8,7 @@ void whpx_get_registers(CPUState *cpu); void whpx_set_registers(CPUState *cpu, int level); int whpx_accel_init(AccelState *as, MachineState *ms); void whpx_cpu_instance_init(CPUState *cs); +#ifdef __x86_64__ HRESULT whpx_set_exception_exit_bitmap(UINT64 exceptions); #endif +#endif diff --git a/include/system/whpx-common.h b/include/system/whpx-common.h index e549c7539c..629810b384 100644 --- a/include/system/whpx-common.h +++ b/include/system/whpx-common.h @@ -3,6 +3,7 @@ #define SYSTEM_WHPX_COMMON_H struct AccelCPUState { +#ifdef __x86_64__ WHV_EMULATOR_HANDLE emulator; bool window_registered; bool interruptable; @@ -10,6 +11,7 @@ struct AccelCPUState { uint64_t tpr; uint64_t apic_base; bool interruption_pending; +#endif /* Must be the last field as it may have a tail */ WHV_RUN_VP_EXIT_CONTEXT exit_ctx; }; diff --git a/include/system/whpx-internal.h b/include/system/whpx-internal.h index e61375d554..e57d2c8526 100644 --- a/include/system/whpx-internal.h +++ b/include/system/whpx-internal.h @@ -4,8 +4,9 @@ #include <windows.h> #include <winhvplatform.h> +#ifdef __x86_64__ #include <winhvemulation.h> - +#endif typedef enum WhpxBreakpointState { WHPX_BP_CLEARED = 0, WHPX_BP_SET_PENDING, @@ -98,12 +99,16 @@ void whpx_apic_get(DeviceState *s); /* Define function typedef */ LIST_WINHVPLATFORM_FUNCTIONS(WHP_DEFINE_TYPE) +#ifdef __x86_64__ LIST_WINHVEMULATION_FUNCTIONS(WHP_DEFINE_TYPE) +#endif LIST_WINHVPLATFORM_FUNCTIONS_SUPPLEMENTAL(WHP_DEFINE_TYPE) struct WHPDispatch { LIST_WINHVPLATFORM_FUNCTIONS(WHP_DECLARE_MEMBER) +#ifdef __x86_64__ LIST_WINHVEMULATION_FUNCTIONS(WHP_DECLARE_MEMBER) +#endif LIST_WINHVPLATFORM_FUNCTIONS_SUPPLEMENTAL(WHP_DECLARE_MEMBER) }; -- 2.39.5 (Apple Git-154)