summaryrefslogtreecommitdiff
path: root/OvmfPkg/XenBusDxe/X64
diff options
context:
space:
mode:
Diffstat (limited to 'OvmfPkg/XenBusDxe/X64')
-rw-r--r--OvmfPkg/XenBusDxe/X64/hypercall.S22
-rw-r--r--OvmfPkg/XenBusDxe/X64/hypercall.asm26
2 files changed, 48 insertions, 0 deletions
diff --git a/OvmfPkg/XenBusDxe/X64/hypercall.S b/OvmfPkg/XenBusDxe/X64/hypercall.S
new file mode 100644
index 0000000000..83cf466953
--- /dev/null
+++ b/OvmfPkg/XenBusDxe/X64/hypercall.S
@@ -0,0 +1,22 @@
+# INTN
+# EFIAPI
+# XenHypercall2 (
+# IN VOID *HypercallAddr,
+# IN OUT INTN Arg1,
+# IN OUT INTN Arg2
+# );
+ASM_GLOBAL ASM_PFX(XenHypercall2)
+ASM_PFX(XenHypercall2):
+ push %rdi
+ push %rsi
+ # Copy HypercallAddr to rax
+ movq %rcx, %rax
+ # Copy Arg1 to the register expected by Xen
+ movq %rdx, %rdi
+ # Copy Arg2 to the register expected by Xen
+ movq %r8, %rsi
+ # Call HypercallAddr
+ call *%rax
+ pop %rsi
+ pop %rdi
+ ret
diff --git a/OvmfPkg/XenBusDxe/X64/hypercall.asm b/OvmfPkg/XenBusDxe/X64/hypercall.asm
new file mode 100644
index 0000000000..5b3451473d
--- /dev/null
+++ b/OvmfPkg/XenBusDxe/X64/hypercall.asm
@@ -0,0 +1,26 @@
+.code
+
+; INTN
+; EFIAPI
+; XenHypercall2 (
+; IN VOID *HypercallAddr,
+; IN OUT INTN Arg1,
+; IN OUT INTN Arg2
+; );
+XenHypercall2 PROC
+ push rdi
+ push rsi
+ ; Copy HypercallAddr to rax
+ mov rax, rcx
+ ; Copy Arg1 to the register expected by Xen
+ mov rdi, rdx
+ ; Copy Arg2 to the register expected by Xen
+ mov rsi, r8
+ ; Call HypercallAddr
+ call rax
+ pop rsi
+ pop rdi
+ ret
+XenHypercall2 ENDP
+
+END