3 // This code provides low level routines that support the Virtual Machine
6 // Copyright (c) 2015, The Linux Foundation. All rights reserved.
7 // Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
8 // This program and the accompanying materials
9 // are licensed and made available under the terms and conditions of the BSD License
10 // which accompanies this distribution. The full text of the license may be found at
11 // http://opensource.org/licenses/bsd-license.php
13 // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 ASM_GLOBAL ASM_PFX(EbcLLCALLEXNative)
19 ASM_GLOBAL ASM_PFX(EbcLLEbcInterpret)
20 ASM_GLOBAL ASM_PFX(EbcLLExecuteEbcImageEntryPoint)
22 //****************************************************************************
25 // This function is called to execute an EBC CALLEX instruction.
26 // This instruction requires that we thunk out to external native
27 // code. For AArch64, we copy the VM stack into the main stack and then pop
28 // the first 8 arguments off according to the AArch64 Procedure Call Standard
29 // On return, we restore the stack pointer to its original location.
31 //****************************************************************************
32 // UINTN EbcLLCALLEXNative(UINTN FuncAddr, UINTN NewStackPointer, VOID *FramePtr)
33 ASM_PFX(EbcLLCALLEXNative):
34 stp x19, x20, [sp, #-16]!
35 stp x29, x30, [sp, #-16]!
39 sub x2, x2, x1 // Length = NewStackPointer-FramePtr
41 sub sp, sp, #64 // Make sure there is room for at least 8 args in the new stack
44 bl CopyMem // Sp, NewStackPointer, Length
54 ldp x29, x30, [sp], #16
55 ldp x19, x20, [sp], #16
59 //****************************************************************************
62 // This function is called by the thunk code to handle an Native to EBC call
63 // This can handle up to 16 arguments (1-8 on in x0-x7, 9-16 are on the stack)
64 // x9 contains the Entry point that will be the first argument when
65 // EBCInterpret is called.
67 //****************************************************************************
68 ASM_PFX(EbcLLEbcInterpret):
69 stp x29, x30, [sp, #-16]!
71 // copy the current arguments 9-16 from old location and add arg 7 to stack
72 // keeping 16 byte stack alignment
92 // Shift arguments and add entry point and as argument 1
103 bl ASM_PFX(EbcInterpret)
106 ldp x29, x30, [sp], #16
110 //****************************************************************************
111 // EbcLLExecuteEbcImageEntryPoint
113 // This function is called by the thunk code to handle the image entry point
114 // x9 contains the Entry point that will be the first argument when
115 // ExecuteEbcImageEntryPoint is called.
117 //****************************************************************************
118 ASM_PFX(EbcLLExecuteEbcImageEntryPoint):
119 stp x29, x30, [sp, #-16]!
120 // build new parameter calling convention
126 bl ASM_PFX(ExecuteEbcImageEntryPoint)
127 ldp x29, x30, [sp], #16