]>
git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Library/XenHypercallLib/X86XenHypercall.c
f779e46470b86ea3d7c929e4d484963950254eb3
2 Xen Hypercall Library implementation for Intel architecture
4 Copyright (c) 2014, Linaro Ltd. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include <Library/HobLib.h>
11 #include <Library/DebugLib.h>
12 #include <Guid/XenInfo.h>
14 STATIC VOID
*HyperPage
;
17 Check if the Xen Hypercall library is able to make calls to the Xen
20 Client code should call further functions in this library only if, and after,
21 this function returns TRUE.
23 @retval TRUE Hypercalls are available.
24 @retval FALSE Hypercalls are not available.
28 XenHypercallIsAvailable (
32 return HyperPage
!= NULL
;
36 // Interface exposed by the ASM implementation of the core hypercall
41 IN VOID
*HypercallAddr
,
47 Library constructor: retrieves the Hyperpage address
48 from the gEfiXenInfoGuid HOB
57 EFI_HOB_GUID_TYPE
*GuidHob
;
58 EFI_XEN_INFO
*XenInfo
;
60 GuidHob
= GetFirstGuidHob (&gEfiXenInfoGuid
);
61 if (GuidHob
== NULL
) {
62 return RETURN_NOT_FOUND
;
64 XenInfo
= (EFI_XEN_INFO
*) GET_GUID_HOB_DATA (GuidHob
);
65 HyperPage
= XenInfo
->HyperPages
;
66 return RETURN_SUCCESS
;
70 This function will put the two arguments in the right place (registers) and
71 invoke the hypercall identified by HypercallID.
73 @param HypercallID The symbolic ID of the hypercall to be invoked
74 @param Arg1 First argument.
75 @param Arg2 Second argument.
77 @return Return 0 if success otherwise it return an errno.
87 ASSERT (HyperPage
!= NULL
);
89 return __XenHypercall2 ((UINT8
*)HyperPage
+ HypercallID
* 32, Arg1
, Arg2
);