]>
git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Library/XenHypercallLib/X86XenHypercall.c
67892bcf37e48b8b95756e0a94b8dff29d17bb62
2 Xen Hypercall Library implementation for Intel architecture
4 Copyright (c) 2014, Linaro Ltd. All rights reserved.<BR>
5 This program and the accompanying materials are licensed and made available under
6 the terms and conditions of the BSD License that accompanies this distribution.
7 The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include <Library/HobLib.h>
17 #include <Library/DebugLib.h>
18 #include <Guid/XenInfo.h>
20 STATIC VOID
*HyperPage
;
23 Check if the Xen Hypercall library is able to make calls to the Xen
26 Client code should call further functions in this library only if, and after,
27 this function returns TRUE.
29 @retval TRUE Hypercalls are available.
30 @retval FALSE Hypercalls are not available.
34 XenHypercallIsAvailable (
38 return HyperPage
!= NULL
;
42 // Interface exposed by the ASM implementation of the core hypercall
47 IN VOID
*HypercallAddr
,
53 Library constructor: retrieves the Hyperpage address
54 from the gEfiXenInfoGuid HOB
63 EFI_HOB_GUID_TYPE
*GuidHob
;
64 EFI_XEN_INFO
*XenInfo
;
66 GuidHob
= GetFirstGuidHob (&gEfiXenInfoGuid
);
67 if (GuidHob
== NULL
) {
68 return RETURN_NOT_FOUND
;
70 XenInfo
= (EFI_XEN_INFO
*) GET_GUID_HOB_DATA (GuidHob
);
71 HyperPage
= XenInfo
->HyperPages
;
72 return RETURN_SUCCESS
;
76 This function will put the two arguments in the right place (registers) and
77 invoke the hypercall identified by HypercallID.
79 @param HypercallID The symbolic ID of the hypercall to be invoked
80 @param Arg1 First argument.
81 @param Arg2 Second argument.
83 @return Return 0 if success otherwise it return an errno.
93 ASSERT (HyperPage
!= NULL
);
95 return __XenHypercall2 ((UINT8
*)HyperPage
+ HypercallID
* 32, Arg1
, Arg2
);