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 #---------------------------------------------------------------------------
19 # Equate files needed.
20 #---------------------------------------------------------------------------
22 ASM_GLOBAL ASM_PFX(CopyMem);
23 ASM_GLOBAL ASM_PFX(EbcInterpret);
24 ASM_GLOBAL ASM_PFX(ExecuteEbcImageEntryPoint);
26 #****************************************************************************
29 # This function is called to execute an EBC CALLEX instruction.
30 # This instruction requires that we thunk out to external native
31 # code. For AArch64, we copy the VM stack into the main stack and then pop
32 # the first 8 arguments off according to the AArch64 Procedure Call Standard
33 # On return, we restore the stack pointer to its original location.
35 #****************************************************************************
36 # UINTN EbcLLCALLEXNative(UINTN FuncAddr, UINTN NewStackPointer, VOID *FramePtr)
37 ASM_GLOBAL ASM_PFX(EbcLLCALLEXNative);
38 ASM_PFX(EbcLLCALLEXNative):
39 stp x19, x20, [sp, #-16]!
40 stp x29, x30, [sp, #-16]!
44 sub x2, x2, x1 // Length = NewStackPointer-FramePtr
46 sub sp, sp, #64 // Make sure there is room for at least 8 args in the new stack
49 bl CopyMem // Sp, NewStackPointer, Length
59 ldp x29, x30, [sp], #16
60 ldp x19, x20, [sp], #16
64 #****************************************************************************
67 # This function is called by the thunk code to handle an Native to EBC call
68 # This can handle up to 16 arguments (1-8 on in x0-x7, 9-16 are on the stack)
69 # x9 contains the Entry point that will be the first argument when
70 # EBCInterpret is called.
72 #****************************************************************************
73 ASM_GLOBAL ASM_PFX(EbcLLEbcInterpret);
74 ASM_PFX(EbcLLEbcInterpret):
75 stp x29, x30, [sp, #-16]!
77 // copy the current arguments 9-16 from old location and add arg 7 to stack
78 // keeping 16 byte stack alignment
98 // Shift arguments and add entry point and as argument 1
109 bl ASM_PFX(EbcInterpret)
112 ldp x29, x30, [sp], #16
116 #****************************************************************************
117 # EbcLLExecuteEbcImageEntryPoint
119 # This function is called by the thunk code to handle the image entry point
120 # x9 contains the Entry point that will be the first argument when
121 # ExecuteEbcImageEntryPoint is called.
123 #****************************************************************************
124 ASM_GLOBAL ASM_PFX(EbcLLExecuteEbcImageEntryPoint);
125 ASM_PFX(EbcLLExecuteEbcImageEntryPoint):
126 stp x29, x30, [sp, #-16]!
127 # build new paramater calling convention
133 bl ASM_PFX(ExecuteEbcImageEntryPoint)
134 ldp x29, x30, [sp], #16