]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/Library/XenHypercallLib/Ia32/hypercall.nasm
Ovmf/Xen: move XenBusDxe hypercall code to separate library
[mirror_edk2.git] / OvmfPkg / Library / XenHypercallLib / Ia32 / hypercall.nasm
diff --git a/OvmfPkg/Library/XenHypercallLib/Ia32/hypercall.nasm b/OvmfPkg/Library/XenHypercallLib/Ia32/hypercall.nasm
new file mode 100644 (file)
index 0000000..e0fa71b
--- /dev/null
@@ -0,0 +1,25 @@
+SECTION .text\r
+\r
+; INTN\r
+; EFIAPI\r
+; __XenHypercall2 (\r
+;   IN     VOID *HypercallAddr,\r
+;   IN OUT INTN Arg1,\r
+;   IN OUT INTN Arg2\r
+;   );\r
+global ASM_PFX(__XenHypercall2)\r
+ASM_PFX(__XenHypercall2):\r
+  ; Save only ebx, ecx is supposed to be a scratch register and needs to be\r
+  ; saved by the caller\r
+  push ebx\r
+  ; Copy HypercallAddr to eax\r
+  mov eax, [esp + 8]\r
+  ; Copy Arg1 to the register expected by Xen\r
+  mov ebx, [esp + 12]\r
+  ; Copy Arg2 to the register expected by Xen\r
+  mov ecx, [esp + 16]\r
+  ; Call HypercallAddr\r
+  call eax\r
+  pop ebx\r
+  ret\r
+\r