-/*++\r
-\r
-Copyright (c) 2006, Intel Corporation \r
-All rights reserved. This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
-\r
-Module Name:\r
-\r
- EbcSupport.c\r
-\r
-Abstract:\r
-\r
+/** @file\r
This module contains EBC support routines that are customized based on\r
the target processor.\r
\r
---*/\r
+Copyright (c) 2006, Intel Corporation\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
\r
#include "EbcInt.h"\r
#include "EbcExecute.h"\r
#define EBC_THUNK_SIZE 32\r
\r
#define STACK_REMAIN_SIZE (1024 * 4)\r
-VOID\r
-EbcLLCALLEX (\r
- IN VM_CONTEXT *VmPtr,\r
- IN UINTN FuncAddr,\r
- IN UINTN NewStackPointer,\r
- IN VOID *FramePtr,\r
- IN UINT8 Size\r
- )\r
-/*++\r
\r
-Routine Description:\r
\r
- This function is called to execute an EBC CALLEX instruction. \r
+/**\r
+ This function is called to execute an EBC CALLEX instruction.\r
The function check the callee's content to see whether it is common native\r
code or a thunk to another piece of EBC code.\r
If the callee is common native code, use EbcLLCAllEXASM to manipulate,\r
otherwise, set the VM->IP to target EBC code directly to avoid another VM\r
be startup which cost time and stack space.\r
- \r
-Arguments:\r
\r
- VmPtr - Pointer to a VM context.\r
- FuncAddr - Callee's address\r
- NewStackPointer - New stack pointer after the call\r
- FramePtr - New frame pointer after the call\r
- Size - The size of call instruction\r
+ @parm VmPtr Pointer to a VM context.\r
+ @parm FuncAddr Callee's address\r
+ @parm NewStackPointer New stack pointer after the call\r
+ @parm FramePtr New frame pointer after the call\r
+ @parm Size The size of call instruction\r
\r
-Returns:\r
+ @return None.\r
\r
- None.\r
- \r
---*/\r
+**/\r
+VOID\r
+EbcLLCALLEX (\r
+ IN VM_CONTEXT *VmPtr,\r
+ IN UINTN FuncAddr,\r
+ IN UINTN NewStackPointer,\r
+ IN VOID *FramePtr,\r
+ IN UINT8 Size\r
+ )\r
{\r
UINTN IsThunk;\r
UINTN TargetEbcAddr;\r
// The callee is not a thunk to EBC, call native code.\r
//\r
EbcLLCALLEXNative (FuncAddr, NewStackPointer, FramePtr);\r
- \r
+\r
//\r
// Get return value and advance the IP.\r
//\r
}\r
}\r
\r
+\r
+/**\r
+ Begin executing an EBC image. The address of the entry point is passed\r
+ in via a processor register, so we'll need to make a call to get the\r
+ value.\r
+\r
+ None. Since we're called from a fixed up thunk (which we want to keep\r
+ small), our only so-called argument is the EBC entry point passed in\r
+ to us in a processor register.\r
+\r
+ @return The value returned by the EBC application we're going to run.\r
+\r
+**/\r
STATIC\r
UINT64\r
EbcInterpret (\r
IN OUT UINTN Arg15,\r
IN OUT UINTN Arg16\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Begin executing an EBC image. The address of the entry point is passed\r
- in via a processor register, so we'll need to make a call to get the\r
- value.\r
- \r
-Arguments:\r
-\r
- None. Since we're called from a fixed up thunk (which we want to keep\r
- small), our only so-called argument is the EBC entry point passed in\r
- to us in a processor register.\r
-\r
-Returns:\r
-\r
- The value returned by the EBC application we're going to run.\r
- \r
---*/\r
{\r
//\r
// Create a new VM context on the stack\r
return (UINT64) VmContext.R[7];\r
}\r
\r
-STATIC\r
-UINT64\r
-ExecuteEbcImageEntryPoint (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
- )\r
-/*++\r
-\r
-Routine Description:\r
\r
+/**\r
Begin executing an EBC image. The address of the entry point is passed\r
in via a processor register, so we'll need to make a call to get the\r
value.\r
- \r
-Arguments:\r
\r
- ImageHandle - image handle for the EBC application we're executing\r
- SystemTable - standard system table passed into an driver's entry point\r
+ @param ImageHandle image handle for the EBC application we're executing\r
+ @param SystemTable standard system table passed into an driver's entry point\r
\r
-Returns:\r
+ @return The value returned by the EBC application we're going to run.\r
\r
- The value returned by the EBC application we're going to run.\r
-\r
---*/\r
+**/\r
+STATIC\r
+UINT64\r
+ExecuteEbcImageEntryPoint (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
{\r
//\r
// Create a new VM context on the stack\r
VmContext.R[0] = (UINT64)(UINTN) ((UINT8*)VmContext.StackPool + STACK_POOL_SIZE);\r
VmContext.HighStackBottom = (UINTN)VmContext.R[0];\r
VmContext.R[0] -= sizeof (UINTN);\r
- \r
+\r
//\r
// Put a magic value in the stack gap, then adjust down again\r
//\r
VmContext.R[0] -= sizeof (UINTN);\r
*(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) ImageHandle;\r
\r
- VmContext.R[0] -= 16; \r
+ VmContext.R[0] -= 16;\r
VmContext.StackRetAddr = (UINT64) VmContext.R[0];\r
//\r
// VM pushes 16-bytes for return address. Simulate that here.\r
return (UINT64) VmContext.R[7];\r
}\r
\r
+\r
+/**\r
+ Create an IA32 thunk for the given EBC entry point.\r
+\r
+ @param ImageHandle Handle of image for which this thunk is being created\r
+ @param EbcEntryPoint Address of the EBC code that the thunk is to call\r
+ @param Thunk Returned thunk we create here\r
+\r
+ @return Standard EFI status.\r
+\r
+**/\r
EFI_STATUS\r
EbcCreateThunks (\r
IN EFI_HANDLE ImageHandle,\r
OUT VOID **Thunk,\r
IN UINT32 Flags\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Create an IA32 thunk for the given EBC entry point.\r
- \r
-Arguments:\r
-\r
- ImageHandle - Handle of image for which this thunk is being created\r
- EbcEntryPoint - Address of the EBC code that the thunk is to call\r
- Thunk - Returned thunk we create here\r
-\r
-Returns:\r
-\r
- Standard EFI status.\r
- \r
---*/\r
{\r
UINT8 *Ptr;\r
UINT8 *ThunkBase;\r