This module contains EBC support routines that are customized based on\r
the target processor.\r
\r
-Copyright (c) 2006, Intel Corporation\r
+Copyright (c) 2006 - 2010, Intel Corporation. <BR>\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
@retval EFI_SUCCESS All data is written.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
WriteBundle (\r
IN VOID *MemPtr,\r
@param Arg The value to be pushed.\r
\r
**/\r
-STATIC\r
VOID\r
PushU64 (\r
IN VM_CONTEXT *VmPtr,\r
// Advance the VM stack down, and then copy the argument to the stack.\r
// Hope it's aligned.\r
//\r
- VmPtr->R[0] -= sizeof (UINT64);\r
- *(UINT64 *) VmPtr->R[0] = Arg;\r
+ VmPtr->Gpr[0] -= sizeof (UINT64);\r
+ *(UINT64 *) VmPtr->Gpr[0] = Arg;\r
}\r
\r
/**\r
@return The value returned by the EBC application we're going to run.\r
\r
**/\r
-STATIC\r
UINT64\r
EbcInterpret (\r
UINT64 Arg1,\r
return Status;\r
}\r
VmContext.StackTop = (UINT8*)VmContext.StackPool + (STACK_REMAIN_SIZE);\r
- VmContext.R[0] = (UINT64) ((UINT8*)VmContext.StackPool + STACK_POOL_SIZE);\r
- VmContext.HighStackBottom = (UINTN) VmContext.R[0];\r
- VmContext.R[0] -= sizeof (UINTN);\r
+ VmContext.Gpr[0] = (UINT64) ((UINT8*)VmContext.StackPool + STACK_POOL_SIZE);\r
+ VmContext.HighStackBottom = (UINTN) VmContext.Gpr[0];\r
+ VmContext.Gpr[0] -= sizeof (UINTN);\r
\r
\r
PushU64 (&VmContext, (UINT64) VM_STACK_KEY_VALUE);\r
- VmContext.StackMagicPtr = (UINTN *) VmContext.R[0];\r
- VmContext.LowStackTop = (UINTN) VmContext.R[0];\r
+ VmContext.StackMagicPtr = (UINTN *) VmContext.Gpr[0];\r
+ VmContext.LowStackTop = (UINTN) VmContext.Gpr[0];\r
//\r
// Push the EBC arguments on the stack. Does not matter that they may not\r
// all be valid.\r
//\r
PushU64 (&VmContext, 0);\r
PushU64 (&VmContext, 0xDEADBEEFDEADBEEF);\r
- VmContext.StackRetAddr = (UINT64) VmContext.R[0];\r
+ VmContext.StackRetAddr = (UINT64) VmContext.Gpr[0];\r
//\r
// Begin executing the EBC code\r
//\r
// Return the value in R[7] unless there was an error\r
//\r
ReturnEBCStack(StackIndex);\r
- return (UINT64) VmContext.R[7];\r
+ return (UINT64) VmContext.Gpr[7];\r
}\r
\r
\r
@return The value returned by the EBC application we're going to run.\r
\r
**/\r
-STATIC\r
UINT64\r
ExecuteEbcImageEntryPoint (\r
IN EFI_HANDLE ImageHandle,\r
return Status;\r
}\r
VmContext.StackTop = (UINT8*)VmContext.StackPool + (STACK_REMAIN_SIZE);\r
- VmContext.R[0] = (UINT64) ((UINT8*)VmContext.StackPool + STACK_POOL_SIZE);\r
- VmContext.HighStackBottom = (UINTN) VmContext.R[0];\r
- VmContext.R[0] -= sizeof (UINTN);\r
+ VmContext.Gpr[0] = (UINT64) ((UINT8*)VmContext.StackPool + STACK_POOL_SIZE);\r
+ VmContext.HighStackBottom = (UINTN) VmContext.Gpr[0];\r
+ VmContext.Gpr[0] -= sizeof (UINTN);\r
\r
\r
//\r
// at the bottom so we can detect stack corruption.\r
//\r
PushU64 (&VmContext, (UINT64) VM_STACK_KEY_VALUE);\r
- VmContext.StackMagicPtr = (UINTN *) (UINTN) VmContext.R[0];\r
+ VmContext.StackMagicPtr = (UINTN *) (UINTN) VmContext.Gpr[0];\r
\r
//\r
// When we thunk to external native code, we copy the last 8 qwords from\r
// Therefore, leave another gap below the magic value. Pick 10 qwords down,\r
// just as a starting point.\r
//\r
- VmContext.R[0] -= 10 * sizeof (UINT64);\r
+ VmContext.Gpr[0] -= 10 * sizeof (UINT64);\r
\r
//\r
// Align the stack pointer such that after pushing the system table,\r
// image handle, and return address on the stack, it's aligned on a 16-byte\r
// boundary as required for IPF.\r
//\r
- VmContext.R[0] &= (INT64)~0x0f;\r
- VmContext.LowStackTop = (UINTN) VmContext.R[0];\r
+ VmContext.Gpr[0] &= (INT64)~0x0f;\r
+ VmContext.LowStackTop = (UINTN) VmContext.Gpr[0];\r
//\r
// Simply copy the image handle and system table onto the EBC stack.\r
// Greatly simplifies things by not having to spill the args\r
//\r
PushU64 (&VmContext, (UINT64) 0);\r
PushU64 (&VmContext, (UINT64) 0x1234567887654321);\r
- VmContext.StackRetAddr = (UINT64) VmContext.R[0];\r
+ VmContext.StackRetAddr = (UINT64) VmContext.Gpr[0];\r
\r
//\r
// Begin executing the EBC code\r
// Return the value in R[7] unless there was an error\r
//\r
ReturnEBCStack(StackIndex);\r
- return (UINT64) VmContext.R[7];\r
+ return (UINT64) VmContext.Gpr[7];\r
}\r
\r
\r
**/\r
EFI_STATUS\r
EbcCreateThunks (\r
- IN EFI_HANDLE ImageHandle,\r
- IN VOID *EbcEntryPoint,\r
- OUT VOID **Thunk,\r
- IN UINT32 Flags\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN VOID *EbcEntryPoint,\r
+ OUT VOID **Thunk,\r
+ IN UINT32 Flags\r
)\r
{\r
UINT8 *Ptr;\r
@retval EFI_SUCCESS All data is written.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
WriteBundle (\r
IN VOID *MemPtr,\r
// put our return address and frame pointer on the VM stack.\r
// Then set the VM's IP to new EBC code.\r
//\r
- VmPtr->R[0] -= 8;\r
- VmWriteMemN (VmPtr, (UINTN) VmPtr->R[0], (UINTN) FramePtr);\r
- VmPtr->FramePtr = (VOID *) (UINTN) VmPtr->R[0];\r
- VmPtr->R[0] -= 8;\r
- VmWriteMem64 (VmPtr, (UINTN) VmPtr->R[0], (UINT64) (VmPtr->Ip + Size));\r
+ VmPtr->Gpr[0] -= 8;\r
+ VmWriteMemN (VmPtr, (UINTN) VmPtr->Gpr[0], (UINTN) FramePtr);\r
+ VmPtr->FramePtr = (VOID *) (UINTN) VmPtr->Gpr[0];\r
+ VmPtr->Gpr[0] -= 8;\r
+ VmWriteMem64 (VmPtr, (UINTN) VmPtr->Gpr[0], (UINT64) (VmPtr->Ip + Size));\r
\r
VmPtr->Ip = (VMIP) (UINTN) TargetEbcAddr;\r
} else {\r
//\r
// Get return value and advance the IP.\r
//\r
- VmPtr->R[7] = EbcLLGetReturnValue ();\r
+ VmPtr->Gpr[7] = EbcLLGetReturnValue ();\r
VmPtr->Ip += Size;\r
}\r
}\r