]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/EbcDxe/AArch64/EbcLowLevel.S
MdeModulePkg/EbcDxe AARCH64: use a fixed size thunk structure
[mirror_edk2.git] / MdeModulePkg / Universal / EbcDxe / AArch64 / EbcLowLevel.S
index 17f379248a6280cf98d8f3183232248856f21248..b4b8531f1a017b8b8b3099deb549d89e7ebaf829 100644 (file)
@@ -3,8 +3,10 @@
 //  This code provides low level routines that support the Virtual Machine\r
 //  for option ROMs.\r
 //\r
-//  Copyright (c) 2015, The Linux Foundation. All rights reserved.\r
+//  Copyright (c) 2016, Linaro, Ltd. All rights reserved.<BR>\r
+//  Copyright (c) 2015, The Linux Foundation. All rights reserved.<BR>\r
 //  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
+//\r
 //  This program and the accompanying materials\r
 //  are licensed and made available under the terms and conditions of the BSD License\r
 //  which accompanies this distribution.  The full text of the license may be found at\r
@@ -19,6 +21,8 @@ ASM_GLOBAL ASM_PFX(EbcLLCALLEXNative)
 ASM_GLOBAL ASM_PFX(EbcLLEbcInterpret)\r
 ASM_GLOBAL ASM_PFX(EbcLLExecuteEbcImageEntryPoint)\r
 \r
+ASM_GLOBAL ASM_PFX(mEbcInstructionBufferTemplate)\r
+\r
 //****************************************************************************\r
 // EbcLLCALLEX\r
 //\r
@@ -61,7 +65,7 @@ ASM_PFX(EbcLLCALLEXNative):
 //\r
 // This function is called by the thunk code to handle an Native to EBC call\r
 // This can handle up to 16 arguments (1-8 on in x0-x7, 9-16 are on the stack)\r
-// x9 contains the Entry point that will be the first argument when\r
+// x16 contains the Entry point that will be the first argument when\r
 // EBCInterpret is called.\r
 //\r
 //****************************************************************************\r
@@ -97,7 +101,7 @@ ASM_PFX(EbcLLEbcInterpret):
     mov x3, x2\r
     mov x2, x1\r
     mov x1, x0\r
-    mov x0, x9\r
+    mov x0, x16\r
 \r
     // call C-code\r
     bl ASM_PFX(EbcInterpret)\r
@@ -111,7 +115,7 @@ ASM_PFX(EbcLLEbcInterpret):
 // EbcLLExecuteEbcImageEntryPoint\r
 //\r
 // This function is called by the thunk code to handle the image entry point\r
-// x9 contains the Entry point that will be the first argument when\r
+// x16 contains the Entry point that will be the third argument when\r
 // ExecuteEbcImageEntryPoint is called.\r
 //\r
 //****************************************************************************\r
@@ -120,9 +124,27 @@ ASM_PFX(EbcLLExecuteEbcImageEntryPoint):
     // build new parameter calling convention\r
     mov  x2, x1\r
     mov  x1, x0\r
-    mov  x0, x9\r
+    mov  x0, x16\r
 \r
     // call C-code\r
     bl ASM_PFX(ExecuteEbcImageEntryPoint)\r
     ldp  x29, x30, [sp], #16\r
     ret\r
+\r
+//****************************************************************************\r
+// mEbcInstructionBufferTemplate\r
+//****************************************************************************\r
+    .section    ".rodata", "a"\r
+    .align      3\r
+ASM_PFX(mEbcInstructionBufferTemplate):\r
+    adr     x17, 0f\r
+    ldp     x16, x17, [x17]\r
+    br      x17\r
+\r
+    //\r
+    // Add a magic code here to help the VM recognize the thunk.\r
+    //\r
+    hlt     #0xEBC\r
+\r
+0:  .quad   0   // EBC_ENTRYPOINT_SIGNATURE\r
+    .quad   0   // EBC_LL_EBC_ENTRYPOINT_SIGNATURE\r