]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/EbcDxe/Ipf/EbcSupport.c
Update the copyright notice format
[mirror_edk2.git] / MdeModulePkg / Universal / EbcDxe / Ipf / EbcSupport.c
index 83d596c4c7e4c5fb383d60049268507bb4ae7fb0..cdaae8785bae9ec412615911c28b0ae12fb03dd0 100644 (file)
@@ -2,8 +2,8 @@
   This module contains EBC support routines that are customized based on\r
   the target processor.\r
 \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+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
@@ -34,7 +34,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   @retval EFI_SUCCESS            All data is written.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 WriteBundle (\r
   IN    VOID    *MemPtr,\r
@@ -51,7 +50,6 @@ WriteBundle (
   @param Arg    The value to be pushed.\r
 \r
 **/\r
-STATIC\r
 VOID\r
 PushU64 (\r
   IN VM_CONTEXT *VmPtr,\r
@@ -62,8 +60,8 @@ PushU64 (
   // 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
@@ -81,7 +79,6 @@ PushU64 (
   @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
@@ -179,14 +176,14 @@ EbcInterpret (
     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
@@ -214,7 +211,7 @@ EbcInterpret (
   //\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
@@ -223,7 +220,7 @@ EbcInterpret (
   // 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
@@ -239,7 +236,6 @@ EbcInterpret (
   @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
@@ -287,9 +283,9 @@ ExecuteEbcImageEntryPoint (
     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
@@ -297,7 +293,7 @@ ExecuteEbcImageEntryPoint (
   // 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
@@ -308,15 +304,15 @@ ExecuteEbcImageEntryPoint (
   // 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
@@ -331,7 +327,7 @@ ExecuteEbcImageEntryPoint (
   //\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
@@ -342,7 +338,7 @@ ExecuteEbcImageEntryPoint (
   // 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
@@ -365,10 +361,10 @@ ExecuteEbcImageEntryPoint (
 **/\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
@@ -591,7 +587,7 @@ EbcCreateThunks (
   // to the address of the entry point of the interpreter.\r
   //\r
   Ptr += 16;\r
-  if (Flags & FLAG_THUNK_ENTRY_POINT) {\r
+  if ((Flags & FLAG_THUNK_ENTRY_POINT) != 0) {\r
     Addr = (UINT64) ExecuteEbcImageEntryPoint;\r
   } else {\r
     Addr = (UINT64) EbcInterpret;\r
@@ -722,7 +718,6 @@ EbcCreateThunks (
   @retval EFI_SUCCESS            All data is written.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 WriteBundle (\r
   IN    VOID    *MemPtr,\r
@@ -746,13 +741,13 @@ WriteBundle (
   //\r
   // Verify no more than 5 bits in template\r
   //\r
-  if (Template &~0x1F) {\r
+  if ((Template &~0x1F) != 0) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
   //\r
   // Verify max of 41 bits used in code\r
   //\r
-  if ((Slot0 | Slot1 | Slot2) &~0x1ffffffffff) {\r
+  if (((Slot0 | Slot1 | Slot2) &~0x1ffffffffff) != 0) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -860,11 +855,11 @@ Action:
     // 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
@@ -876,7 +871,7 @@ Action:
     //\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