1 #****************************************************************************
3 #* Copyright (c) 2006, Intel Corporation
4 #* All rights reserved. This program and the accompanying materials
5 #* are licensed and made available under the terms and conditions of the BSD License
6 #* which accompanies this distribution. The full text of the license may be found at
7 #* http://opensource.org/licenses/bsd-license.php
9 #* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 #* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 #****************************************************************************
13 #****************************************************************************
15 #****************************************************************************
17 # Rev Date Description
18 # --- -------- ------------------------------------------------------------
19 # 1.0 05/09/12 Initial creation of file.
21 #****************************************************************************
23 #* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
24 # This code provides low level routines that support the Virtual Machine
26 #* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
28 #---------------------------------------------------------------------------
29 # Equate files needed.
30 #---------------------------------------------------------------------------
32 #---------------------------------------------------------------------------
33 ##GenericPostSegment SEGMENT USE16
34 #---------------------------------------------------------------------------
36 #****************************************************************************
39 # This function is called to execute an EBC CALLEX instruction.
40 # This instruction requires that we thunk out to external native
41 # code. For x64, we switch stacks, copy the arguments to the stack
42 # and jump to the specified function.
43 # On return, we restore the stack pointer to its original location.
45 # Destroys no working registers.
46 #****************************************************************************
49 # VOID EbcLLCALLEXNative(UINTN FuncAddr, UINTN NewStackPointer, VOID *FramePtr)
50 .global _EbcLLCALLEXNative;
57 # Copy FuncAddr to a preserved register.
60 # Set stack pointer to new value
68 # Considering the worst case, load 4 potiential arguments
75 # Now call the external routine
85 # UINTN EbcLLGetEbcEntryPoint(VOID);
86 # Routine Description:
87 # The VM thunk code stuffs an EBC entry point into a processor
88 # register. Since we can't use inline assembly to get it from
89 # the interpreter C code, stuff it into the return value
90 # register and return.
96 # The contents of the register in which the entry point is passed.
98 .global _EbcLLGetEbcEntryPoint;
99 _EbcLLGetEbcEntryPoint:
104 #Routine Description:
106 # Return the caller's value of the stack pointer.
114 # The current value of the stack pointer for the caller. We
115 # adjust it by 4 here because when they called us, the return address
116 # is put on the stack, thereby lowering it by 4 bytes.
120 # UINTN EbcLLGetStackPointer()
121 .global _EbcLLGetStackPointer;
122 _EbcLLGetStackPointer:
124 # Stack adjusted by this much when we were called,
125 # For this function, it's 4.
129 .global _EbcLLGetReturnValue;
130 _EbcLLGetReturnValue:
131 # UINT64 EbcLLGetReturnValue(VOID);
132 # Routine Description:
133 # When EBC calls native, on return the VM has to stuff the return
134 # value into a VM register. It's assumed here that the value is still
135 # in the register, so simply return and the caller should get the
136 # return result properly.
142 # The unmodified value returned by the native code.