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 #****************************************************************************
47 # VOID EbcLLCALLEXNative(UINTN FuncAddr, UINTN NewStackPointer, VOID *FramePtr)
48 .global _EbcLLCALLEXNative;
55 # Copy FuncAddr to a preserved register.
58 # Set stack pointer to new value
61 # Considering the worst case, load 4 potiential arguments
68 # Now call the external routine
78 # UINTN EbcLLGetEbcEntryPoint(VOID);
79 # Routine Description:
80 # The VM thunk code stuffs an EBC entry point into a processor
81 # register. Since we can't use inline assembly to get it from
82 # the interpreter C code, stuff it into the return value
83 # register and return.
89 # The contents of the register in which the entry point is passed.
91 .global _EbcLLGetEbcEntryPoint;
92 _EbcLLGetEbcEntryPoint:
99 # Return the caller's value of the stack pointer.
107 # The current value of the stack pointer for the caller. We
108 # adjust it by 4 here because when they called us, the return address
109 # is put on the stack, thereby lowering it by 4 bytes.
113 # UINTN EbcLLGetStackPointer()
114 .global _EbcLLGetStackPointer;
115 _EbcLLGetStackPointer:
117 # Stack adjusted by this much when we were called,
118 # For this function, it's 4.
122 .global _EbcLLGetReturnValue;
123 _EbcLLGetReturnValue:
124 # UINT64 EbcLLGetReturnValue(VOID);
125 # Routine Description:
126 # When EBC calls native, on return the VM has to stuff the return
127 # value into a VM register. It's assumed here that the value is still
128 # in the register, so simply return and the caller should get the
129 # return result properly.
135 # The unmodified value returned by the native code.