TianoCore EDK2 master
Loading...
Searching...
No Matches
XenHypercall.c
Go to the documentation of this file.
1
10#include <PiDxe.h>
11
12#include <IndustryStandard/Xen/hvm/params.h>
13#include <IndustryStandard/Xen/memory.h>
14
15#include <Library/DebugLib.h>
17
18RETURN_STATUS
19EFIAPI
20XenHypercallLibConstruct (
21 VOID
22 )
23{
25 //
26 // We don't fail library construction, since that has catastrophic
27 // consequences for client modules (whereas those modules may easily be
28 // running on a non-Xen platform). Instead, XenHypercallIsAvailable()
29 // will return FALSE.
30 //
31 return RETURN_SUCCESS;
32}
33
34UINT64
35EFIAPI
37 IN UINT32 Index
38 )
39{
40 xen_hvm_param_t Parameter;
41 INTN Error;
42
43 Parameter.domid = DOMID_SELF;
44 Parameter.index = Index;
45 Error = XenHypercall2 (
46 __HYPERVISOR_hvm_op,
47 HVMOP_get_param,
48 (INTN)&Parameter
49 );
50 if (Error != 0) {
51 DEBUG ((
52 DEBUG_ERROR,
53 "XenHypercall: Error %Ld trying to get HVM parameter %d\n",
54 (INT64)Error,
55 Index
56 ));
57 return 0;
58 }
59
60 return Parameter.value;
61}
62
63INTN
64EFIAPI
66 IN UINTN Operation,
67 IN OUT VOID *Arguments
68 )
69{
70 return XenHypercall2 (
71 __HYPERVISOR_memory_op,
72 Operation,
73 (INTN)Arguments
74 );
75}
76
77INTN
78EFIAPI
80 IN INTN Operation,
81 IN OUT VOID *Arguments
82 )
83{
84 return XenHypercall2 (
85 __HYPERVISOR_event_channel_op,
86 Operation,
87 (INTN)Arguments
88 );
89}
90
91INTN
92EFIAPI
93XenHypercallSchedOp (
94 IN INTN Operation,
95 IN OUT VOID *Arguments
96 )
97{
98 return XenHypercall2 (
99 __HYPERVISOR_sched_op,
100 Operation,
101 (INTN)Arguments
102 );
103}
UINT64 UINTN
INT64 INTN
#define RETURN_SUCCESS
Definition: Base.h:1066
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define DEBUG(Expression)
Definition: DebugLib.h:434
INTN EFIAPI XenHypercallEventChannelOp(IN INTN Operation, IN OUT VOID *Arguments)
Definition: XenHypercall.c:79
INTN EFIAPI XenHypercallMemoryOp(IN UINTN Operation, IN OUT VOID *Arguments)
Definition: XenHypercall.c:65
RETURN_STATUS EFIAPI XenHypercallLibInit(VOID)
INTN EFIAPI XenHypercall2(IN UINTN HypercallID, IN OUT INTN Arg1, IN OUT INTN Arg2)
UINT64 EFIAPI XenHypercallHvmGetParam(UINT32 Index)