3 # This code provides low level routines that support the Virtual Machine
6 # Copyright (c) 2007 - 2008, Intel Corporation. <BR>
7 # All rights reserved. This program and the accompanying materials
8 # are licensed and made available under the terms and conditions of the BSD License
9 # which accompanies this distribution. The full text of the license may be found at
10 # http://opensource.org/licenses/bsd-license.php
12 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #---------------------------------------------------------------------------
18 # Equate files needed.
19 #---------------------------------------------------------------------------
21 #---------------------------------------------------------------------------
22 ##GenericPostSegment SEGMENT USE16
23 #---------------------------------------------------------------------------
25 #****************************************************************************
28 # This function is called to execute an EBC CALLEX instruction.
29 # This instruction requires that we thunk out to external native
30 # code. For x64, we switch stacks, copy the arguments to the stack
31 # and jump to the specified function.
32 # On return, we restore the stack pointer to its original location.
34 # Destroys no working registers.
35 #****************************************************************************
38 # VOID EbcLLCALLEXNative(UINTN FuncAddr, UINTN NewStackPointer, VOID *FramePtr)
39 .global _EbcLLCALLEXNative;
46 # Copy FuncAddr to a preserved register.
49 # Set stack pointer to new value
57 # Considering the worst case, load 4 potiential arguments
64 # Now call the external routine
74 # UINTN EbcLLGetEbcEntryPoint(VOID);
75 # Routine Description:
76 # The VM thunk code stuffs an EBC entry point into a processor
77 # register. Since we can't use inline assembly to get it from
78 # the interpreter C code, stuff it into the return value
79 # register and return.
85 # The contents of the register in which the entry point is passed.
87 .global _EbcLLGetEbcEntryPoint;
88 _EbcLLGetEbcEntryPoint:
95 # Return the caller's value of the stack pointer.
103 # The current value of the stack pointer for the caller. We
104 # adjust it by 4 here because when they called us, the return address
105 # is put on the stack, thereby lowering it by 4 bytes.
109 # UINTN EbcLLGetStackPointer()
110 .global _EbcLLGetStackPointer;
111 _EbcLLGetStackPointer:
113 # Stack adjusted by this much when we were called,
114 # For this function, it's 4.
118 .global _EbcLLGetReturnValue;
119 _EbcLLGetReturnValue:
120 # UINT64 EbcLLGetReturnValue(VOID);
121 # Routine Description:
122 # When EBC calls native, on return the VM has to stuff the return
123 # value into a VM register. It's assumed here that the value is still
124 # in the register, so simply return and the caller should get the
125 # return result properly.
131 # The unmodified value returned by the native code.