]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/EbcDxe/EbcInt.c
Add doxygen style comments for functions in EBC module.
[mirror_edk2.git] / MdeModulePkg / Universal / EbcDxe / EbcInt.c
index 37a2b7f6b005f9008d9c6f352ae0302079bfcad9..b3fe0d5e4fc8dac152751c22b548038d2ba8875d 100644 (file)
@@ -1,9 +1,9 @@
 /** @file\r
   Top level module for the EBC virtual machine implementation.\r
-  Provides auxilliary support routines for the VM. That is, routines\r
+  Provides auxiliary support routines for the VM. That is, routines\r
   that are not particularly related to VM execution of EBC instructions.\r
 \r
-Copyright (c) 2006, Intel Corporation\r
+Copyright (c) 2006 - 2008, 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
@@ -34,6 +34,20 @@ typedef struct _EBC_IMAGE_LIST {
   EBC_THUNK_LIST          *ThunkList;\r
 } EBC_IMAGE_LIST;\r
 \r
+/**\r
+  This routine is called by the core when an image is being unloaded from\r
+  memory. Basically we now have the opportunity to do any necessary cleanup.\r
+  Typically this will include freeing any memory allocated for thunk-creation.\r
+\r
+  @param  This                  A pointer to the EFI_EBC_PROTOCOL instance.\r
+  @param  ImageHandle           Handle of image for which the thunk is being\r
+                                created.\r
+\r
+  @retval EFI_INVALID_PARAMETER The ImageHandle passed in was not found in the\r
+                                internal list of EBC image handles.\r
+  @retval EFI_SUCCESS           The function completed successfully.\r
+\r
+**/\r
 STATIC\r
 EFI_STATUS\r
 EFIAPI\r
@@ -42,6 +56,25 @@ EbcUnloadImage (
   IN EFI_HANDLE           ImageHandle\r
   );\r
 \r
+/**\r
+  This is the top-level routine plugged into the EBC protocol. Since thunks\r
+  are very processor-specific, from here we dispatch directly to the very\r
+  processor-specific routine EbcCreateThunks().\r
+\r
+  @param  This                  A pointer to the EFI_EBC_PROTOCOL instance.\r
+  @param  ImageHandle           Handle of image for which the thunk is being\r
+                                created. The EBC interpreter may use this to\r
+                                keep track of any resource allocations\r
+                                performed in loading and executing the image.\r
+  @param  EbcEntryPoint         Address of the actual EBC entry point or\r
+                                protocol service the thunk should call.\r
+  @param  Thunk                 Returned pointer to a thunk created.\r
+\r
+  @retval EFI_SUCCESS           The function completed successfully.\r
+  @retval EFI_INVALID_PARAMETER Image entry point is not 2-byte aligned.\r
+  @retval EFI_OUT_OF_RESOURCES  Memory could not be allocated for the thunk.\r
+\r
+**/\r
 STATIC\r
 EFI_STATUS\r
 EFIAPI\r
@@ -52,6 +85,17 @@ EbcCreateThunk (
   OUT VOID                **Thunk\r
   );\r
 \r
+/**\r
+  Called to get the version of the interpreter.\r
+\r
+  @param  This                  A pointer to the EFI_EBC_PROTOCOL instance.\r
+  @param  Version               Pointer to where to store the returned version\r
+                                of the interpreter.\r
+   \r
+  @retval EFI_SUCCESS           The function completed successfully.\r
+  @retval EFI_INVALID_PARAMETER Version pointer is NULL.\r
+\r
+**/\r
 STATIC\r
 EFI_STATUS\r
 EFIAPI\r
@@ -60,6 +104,16 @@ EbcGetVersion (
   IN OUT UINT64           *Version\r
   );\r
 \r
+/**\r
+  To install default Callback function for the VM interpreter.\r
+\r
+  @param  This                  A pointer to the EFI_DEBUG_SUPPORT_PROTOCOL\r
+                                instance.\r
+\r
+  @retval EFI_SUCCESS           The function completed successfully.\r
+  @retval Others                Some error occurs when creating periodic event.\r
+\r
+**/\r
 STATIC\r
 EFI_STATUS\r
 EFIAPI\r
@@ -67,6 +121,15 @@ InitializeEbcCallback (
   IN EFI_DEBUG_SUPPORT_PROTOCOL  *This\r
   );\r
 \r
+/**\r
+  The default Exception Callback for the VM interpreter.\r
+  In this function, we report status code, and print debug information\r
+  about EBC_CONTEXT, then dead loop.\r
+\r
+  @param  InterruptType          Interrupt type.\r
+  @param  SystemContext          EBC system context.\r
+\r
+**/\r
 STATIC\r
 VOID\r
 EFIAPI\r
@@ -75,6 +138,14 @@ CommonEbcExceptionHandler (
   IN EFI_SYSTEM_CONTEXT   SystemContext\r
   );\r
 \r
+/**\r
+  The periodic callback function for EBC VM interpreter, which is used\r
+  to support the EFI debug support protocol.\r
+\r
+  @param  Event                  The Periodic Callback Event.\r
+  @param  Context                It should be the address of VM_CONTEXT pointer.\r
+\r
+**/\r
 STATIC\r
 VOID\r
 EFIAPI\r
@@ -83,6 +154,16 @@ EbcPeriodicNotifyFunction (
   IN VOID          *Context\r
   );\r
 \r
+/**\r
+  The VM interpreter calls this function on a periodic basis to support\r
+  the EFI debug support protocol.\r
+\r
+  @param  VmPtr                  Pointer to a VM context for passing info to the\r
+                                 debugger.\r
+\r
+  @retval EFI_SUCCESS            The function completed successfully.\r
+\r
+**/\r
 STATIC\r
 EFI_STATUS\r
 EFIAPI\r
@@ -94,18 +175,43 @@ EbcDebugPeriodic (
 // These two functions and the  GUID are used to produce an EBC test protocol.\r
 // This functionality is definitely not required for execution.\r
 //\r
+/**\r
+  Produces an EBC VM test protocol that can be used for regression tests.\r
+\r
+  @param  IHandle                Handle on which to install the protocol.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES   Memory allocation failed.\r
+  @retval EFI_SUCCESS            The function completed successfully.\r
+\r
+**/\r
 STATIC\r
 EFI_STATUS\r
 InitEbcVmTestProtocol (\r
   IN EFI_HANDLE     *Handle\r
   );\r
 \r
+/**\r
+  Returns the EFI_UNSUPPORTED Status.\r
+   \r
+  @return EFI_UNSUPPORTED  This function always return EFI_UNSUPPORTED status.\r
+\r
+**/\r
 STATIC\r
 EFI_STATUS\r
 EbcVmTestUnsupported (\r
   VOID\r
   );\r
 \r
+/**\r
+  Registers a callback function that the EBC interpreter calls to flush the\r
+  processor instruction cache following creation of thunks. \r
+\r
+  @param  This        A pointer to the EFI_EBC_PROTOCOL instance.\r
+  @param  Flush       Pointer to a function of type EBC_ICACH_FLUSH.\r
+   \r
+  @retval EFI_SUCCESS The function completed successfully.\r
+\r
+**/\r
 STATIC\r
 EFI_STATUS\r
 EFIAPI\r
@@ -114,6 +220,17 @@ EbcRegisterICacheFlush (
   IN EBC_ICACHE_FLUSH               Flush\r
   );\r
 \r
+/**\r
+  This EBC debugger protocol service is called by the debug agent\r
+\r
+  @param  This                  A pointer to the EFI_DEBUG_SUPPORT_PROTOCOL\r
+                                instance.\r
+  @param  MaxProcessorIndex     Pointer to a caller-allocated UINTN in which the\r
+                                maximum supported processor index is returned.\r
+\r
+  @retval EFI_SUCCESS           The function completed successfully.\r
+\r
+**/\r
 STATIC\r
 EFI_STATUS\r
 EFIAPI\r
@@ -122,6 +239,27 @@ EbcDebugGetMaximumProcessorIndex (
   OUT UINTN                         *MaxProcessorIndex\r
   );\r
 \r
+/**\r
+  This protocol service is called by the debug agent to register a function\r
+  for us to call on a periodic basis.\r
+\r
+  @param  This                  A pointer to the EFI_DEBUG_SUPPORT_PROTOCOL\r
+                                instance.\r
+  @param  ProcessorIndex        Specifies which processor the callback function\r
+                                applies to.\r
+  @param  PeriodicCallback      A pointer to a function of type\r
+                                PERIODIC_CALLBACK that is the main periodic\r
+                                entry point of the debug agent. It receives as a\r
+                                parameter a pointer to the full context of the\r
+                                interrupted execution thread.\r
+\r
+  @retval EFI_SUCCESS           The function completed successfully.\r
+  @retval EFI_ALREADY_STARTED   Non-NULL PeriodicCallback parameter when a\r
+                                callback function was previously registered.\r
+  @retval EFI_INVALID_PARAMETER Null PeriodicCallback parameter when no\r
+                                callback function was previously registered.\r
+\r
+**/\r
 STATIC\r
 EFI_STATUS\r
 EFIAPI\r
@@ -131,6 +269,31 @@ EbcDebugRegisterPeriodicCallback (
   IN EFI_PERIODIC_CALLBACK          PeriodicCallback\r
   );\r
 \r
+/**\r
+  This protocol service is called by the debug agent to register a function\r
+  for us to call when we detect an exception.\r
+\r
+  @param  This                  A pointer to the EFI_DEBUG_SUPPORT_PROTOCOL\r
+                                instance.\r
+  @param  ProcessorIndex        Specifies which processor the callback function\r
+                                applies to.\r
+  @param  ExceptionCallback     A pointer to a function of type\r
+                                EXCEPTION_CALLBACK that is called when the\r
+                                processor exception specified by ExceptionType\r
+                                occurs. Passing NULL unregisters any previously\r
+                                registered function associated with\r
+                                ExceptionType.\r
+  @param  ExceptionType         Specifies which processor exception to hook.\r
+\r
+  @retval EFI_SUCCESS           The function completed successfully.\r
+  @retval EFI_ALREADY_STARTED   Non-NULL ExceptionCallback parameter when a\r
+                                callback function was previously registered.\r
+  @retval EFI_INVALID_PARAMETER ExceptionType parameter is negative or exceeds\r
+                                MAX_EBC_EXCEPTION.\r
+  @retval EFI_INVALID_PARAMETER Null ExceptionCallback parameter when no\r
+                                callback function was previously registered.\r
+\r
+**/\r
 STATIC\r
 EFI_STATUS\r
 EFIAPI\r
@@ -141,6 +304,22 @@ EbcDebugRegisterExceptionCallback (
   IN EFI_EXCEPTION_TYPE             ExceptionType\r
   );\r
 \r
+/**\r
+  This EBC debugger protocol service is called by the debug agent.  Required\r
+  for DebugSupport compliance but is only stubbed out for EBC.\r
+\r
+  @param  This                  A pointer to the EFI_DEBUG_SUPPORT_PROTOCOL\r
+                                instance.\r
+  @param  ProcessorIndex        Specifies which processor the callback function\r
+                                applies to.\r
+  @param  Start                 StartSpecifies the physical base of the memory\r
+                                range to be invalidated.\r
+  @param  Length                Specifies the minimum number of bytes in the\r
+                                processor's instruction cache to invalidate. \r
+\r
+  @retval EFI_SUCCESS           The function completed successfully.\r
+\r
+**/\r
 STATIC\r
 EFI_STATUS\r
 EFIAPI\r
@@ -157,28 +336,28 @@ EbcDebugInvalidateInstructionCache (
 // also be global since the execution of an EBC image does not provide\r
 // a This pointer.\r
 //\r
-static EBC_IMAGE_LIST         *mEbcImageList = NULL;\r
+STATIC EBC_IMAGE_LIST         *mEbcImageList = NULL;\r
 \r
 //\r
 // Callback function to flush the icache after thunk creation\r
 //\r
-static EBC_ICACHE_FLUSH       mEbcICacheFlush;\r
+STATIC EBC_ICACHE_FLUSH       mEbcICacheFlush;\r
 \r
 //\r
 // These get set via calls by the debug agent\r
 //\r
-static EFI_PERIODIC_CALLBACK  mDebugPeriodicCallback                            = NULL;\r
-static EFI_EXCEPTION_CALLBACK mDebugExceptionCallback[MAX_EBC_EXCEPTION + 1] = {NULL};\r
-static EFI_GUID               mEfiEbcVmTestProtocolGuid = EFI_EBC_VM_TEST_PROTOCOL_GUID;\r
+STATIC EFI_PERIODIC_CALLBACK  mDebugPeriodicCallback                            = NULL;\r
+STATIC EFI_EXCEPTION_CALLBACK mDebugExceptionCallback[MAX_EBC_EXCEPTION + 1] = {NULL};\r
+STATIC EFI_GUID               mEfiEbcVmTestProtocolGuid = EFI_EBC_VM_TEST_PROTOCOL_GUID;\r
 \r
-static VOID*      mStackBuffer[MAX_STACK_NUM];\r
-static EFI_HANDLE mStackBufferIndex[MAX_STACK_NUM];\r
-static UINTN      mStackNum = 0;\r
+STATIC VOID*      mStackBuffer[MAX_STACK_NUM];\r
+STATIC EFI_HANDLE mStackBufferIndex[MAX_STACK_NUM];\r
+STATIC UINTN      mStackNum = 0;\r
 \r
 //\r
 // Event for Periodic callback\r
 //\r
-static EFI_EVENT              mEbcPeriodicEvent;\r
+STATIC EFI_EVENT              mEbcPeriodicEvent;\r
 VM_CONTEXT                    *mVmPtr = NULL;\r
 \r
 \r
@@ -378,16 +557,18 @@ ErrorExit:
   are very processor-specific, from here we dispatch directly to the very\r
   processor-specific routine EbcCreateThunks().\r
 \r
-  @param  This                   protocol instance pointer\r
-  @param  ImageHandle            handle to the image. The EBC interpreter may use\r
-                                 this to keep track of any resource allocations\r
-                                 performed in loading and executing the image.\r
-  @param  EbcEntryPoint          the entry point for the image (as defined in the\r
-                                 file header)\r
-  @param  Thunk                  pointer to thunk pointer where the address of the\r
-                                 created thunk is returned.\r
+  @param  This                  A pointer to the EFI_EBC_PROTOCOL instance.\r
+  @param  ImageHandle           Handle of image for which the thunk is being\r
+                                created. The EBC interpreter may use this to\r
+                                keep track of any resource allocations\r
+                                performed in loading and executing the image.\r
+  @param  EbcEntryPoint         Address of the actual EBC entry point or\r
+                                protocol service the thunk should call.\r
+  @param  Thunk                 Returned pointer to a thunk created.\r
 \r
-  @return EFI_STATUS\r
+  @retval EFI_SUCCESS           The function completed successfully.\r
+  @retval EFI_INVALID_PARAMETER Image entry point is not 2-byte aligned.\r
+  @retval EFI_OUT_OF_RESOURCES  Memory could not be allocated for the thunk.\r
 \r
 **/\r
 STATIC\r
@@ -415,12 +596,12 @@ EbcCreateThunk (
 /**\r
   This EBC debugger protocol service is called by the debug agent\r
 \r
-  @param  This                   pointer to the caller's debug support protocol\r
-                                 interface\r
-  @param  MaxProcessorIndex      pointer to a caller allocated UINTN in which the\r
-                                 maximum processor index is returned.\r
+  @param  This                  A pointer to the EFI_DEBUG_SUPPORT_PROTOCOL\r
+                                instance.\r
+  @param  MaxProcessorIndex     Pointer to a caller-allocated UINTN in which the\r
+                                maximum supported processor index is returned.\r
 \r
-  @return Standard EFI_STATUS\r
+  @retval EFI_SUCCESS           The function completed successfully.\r
 \r
 **/\r
 STATIC\r
@@ -440,11 +621,21 @@ EbcDebugGetMaximumProcessorIndex (
   This protocol service is called by the debug agent to register a function\r
   for us to call on a periodic basis.\r
 \r
-  @param  This                   pointer to the caller's debug support protocol\r
-                                 interface\r
-  @param  PeriodicCallback       pointer to the function to call periodically\r
-\r
-  @return Always EFI_SUCCESS\r
+  @param  This                  A pointer to the EFI_DEBUG_SUPPORT_PROTOCOL\r
+                                instance.\r
+  @param  ProcessorIndex        Specifies which processor the callback function\r
+                                applies to.\r
+  @param  PeriodicCallback      A pointer to a function of type\r
+                                PERIODIC_CALLBACK that is the main periodic\r
+                                entry point of the debug agent. It receives as a\r
+                                parameter a pointer to the full context of the\r
+                                interrupted execution thread.\r
+\r
+  @retval EFI_SUCCESS           The function completed successfully.\r
+  @retval EFI_ALREADY_STARTED   Non-NULL PeriodicCallback parameter when a\r
+                                callback function was previously registered.\r
+  @retval EFI_INVALID_PARAMETER Null PeriodicCallback parameter when no\r
+                                callback function was previously registered.\r
 \r
 **/\r
 STATIC\r
@@ -472,11 +663,25 @@ EbcDebugRegisterPeriodicCallback (
   This protocol service is called by the debug agent to register a function\r
   for us to call when we detect an exception.\r
 \r
-  @param  This                   pointer to the caller's debug support protocol\r
-                                 interface\r
-  @param  ExceptionCallback      pointer to the function to the exception\r
-\r
-  @return Always EFI_SUCCESS\r
+  @param  This                  A pointer to the EFI_DEBUG_SUPPORT_PROTOCOL\r
+                                instance.\r
+  @param  ProcessorIndex        Specifies which processor the callback function\r
+                                applies to.\r
+  @param  ExceptionCallback     A pointer to a function of type\r
+                                EXCEPTION_CALLBACK that is called when the\r
+                                processor exception specified by ExceptionType\r
+                                occurs. Passing NULL unregisters any previously\r
+                                registered function associated with\r
+                                ExceptionType.\r
+  @param  ExceptionType         Specifies which processor exception to hook.\r
+\r
+  @retval EFI_SUCCESS           The function completed successfully.\r
+  @retval EFI_ALREADY_STARTED   Non-NULL ExceptionCallback parameter when a\r
+                                callback function was previously registered.\r
+  @retval EFI_INVALID_PARAMETER ExceptionType parameter is negative or exceeds\r
+                                MAX_EBC_EXCEPTION.\r
+  @retval EFI_INVALID_PARAMETER Null ExceptionCallback parameter when no\r
+                                callback function was previously registered.\r
 \r
 **/\r
 STATIC\r
@@ -507,8 +712,16 @@ EbcDebugRegisterExceptionCallback (
   This EBC debugger protocol service is called by the debug agent.  Required\r
   for DebugSupport compliance but is only stubbed out for EBC.\r
 \r
+  @param  This                  A pointer to the EFI_DEBUG_SUPPORT_PROTOCOL\r
+                                instance.\r
+  @param  ProcessorIndex        Specifies which processor the callback function\r
+                                applies to.\r
+  @param  Start                 StartSpecifies the physical base of the memory\r
+                                range to be invalidated.\r
+  @param  Length                Specifies the minimum number of bytes in the\r
+                                processor's instruction cache to invalidate. \r
 \r
-  @return EFI_SUCCESS\r
+  @retval EFI_SUCCESS           The function completed successfully.\r
 \r
 **/\r
 STATIC\r
@@ -528,10 +741,12 @@ EbcDebugInvalidateInstructionCache (
 /**\r
   The VM interpreter calls this function when an exception is detected.\r
 \r
-  @param  VmPtr                  pointer to a VM context for passing info to the\r
+  @param  ExceptionType          Specifies the processor exception detected.\r
+  @param  ExceptionFlags         Specifies the exception context. \r
+  @param  VmPtr                  Pointer to a VM context for passing info to the\r
                                  EFI debugger.\r
 \r
-  @return EFI_SUCCESS if it returns at all\r
+  @retval EFI_SUCCESS            This function completed successfully.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -605,13 +820,16 @@ EbcDebugSignalException (
 /**\r
   To install default Callback function for the VM interpreter.\r
 \r
-  @param  This                   pointer to the instance of DebugSupport protocol\r
+  @param  This                  A pointer to the EFI_DEBUG_SUPPORT_PROTOCOL\r
+                                instance.\r
 \r
-  @return None\r
+  @retval EFI_SUCCESS           The function completed successfully.\r
+  @retval Others                Some error occurs when creating periodic event.\r
 \r
 **/\r
 STATIC\r
 EFI_STATUS\r
+EFIAPI\r
 InitializeEbcCallback (\r
   IN EFI_DEBUG_SUPPORT_PROTOCOL  *This\r
   )\r
@@ -666,11 +884,10 @@ InitializeEbcCallback (
   @param  InterruptType          Interrupt type.\r
   @param  SystemContext          EBC system context.\r
 \r
-  @return None\r
-\r
 **/\r
 STATIC\r
 VOID\r
+EFIAPI\r
 CommonEbcExceptionHandler (\r
   IN EFI_EXCEPTION_TYPE   InterruptType,\r
   IN EFI_SYSTEM_CONTEXT   SystemContext\r
@@ -692,8 +909,6 @@ CommonEbcExceptionHandler (
   @param  Event                  The Periodic Callback Event.\r
   @param  Context                It should be the address of VM_CONTEXT pointer.\r
 \r
-  @return None.\r
-\r
 **/\r
 STATIC\r
 VOID\r
@@ -719,14 +934,15 @@ EbcPeriodicNotifyFunction (
   The VM interpreter calls this function on a periodic basis to support\r
   the EFI debug support protocol.\r
 \r
-  @param  VmPtr                  pointer to a VM context for passing info to the\r
+  @param  VmPtr                  Pointer to a VM context for passing info to the\r
                                  debugger.\r
 \r
-  @return Standard EFI status.\r
+  @retval EFI_SUCCESS            The function completed successfully.\r
 \r
 **/\r
 STATIC\r
 EFI_STATUS\r
+EFIAPI\r
 EbcDebugPeriodic (\r
   IN VM_CONTEXT *VmPtr\r
   )\r
@@ -781,12 +997,13 @@ EbcDebugPeriodic (
   memory. Basically we now have the opportunity to do any necessary cleanup.\r
   Typically this will include freeing any memory allocated for thunk-creation.\r
 \r
-  @param  This                   protocol instance pointer\r
-  @param  ImageHandle            handle to the image being unloaded.\r
+  @param  This                  A pointer to the EFI_EBC_PROTOCOL instance.\r
+  @param  ImageHandle           Handle of image for which the thunk is being\r
+                                created.\r
 \r
-  @retval EFI_INVALID_PARAMETER  the ImageHandle passed in was not found in the\r
-                                 internal list of EBC image handles.\r
-  @retval EFI_STATUS             completed successfully\r
+  @retval EFI_INVALID_PARAMETER The ImageHandle passed in was not found in the\r
+                                internal list of EBC image handles.\r
+  @retval EFI_SUCCESS           The function completed successfully.\r
 \r
 **/\r
 STATIC\r
@@ -855,12 +1072,12 @@ EbcUnloadImage (
   Also flush the instruction cache since we've written thunk code\r
   to memory that will be executed eventually.\r
 \r
-  @param  ImageHandle            the image handle to which the thunk is tied\r
-  @param  ThunkBuffer            the buffer we've created/allocated\r
-  @param  ThunkSize              the size of the thunk memory allocated\r
+  @param  ImageHandle            The image handle to which the thunk is tied.\r
+  @param  ThunkBuffer            The buffer that has been created/allocated.\r
+  @param  ThunkSize              The size of the thunk memory allocated.\r
 \r
-  @retval EFI_OUT_OF_RESOURCES   memory allocation failed\r
-  @retval EFI_SUCCESS            successful completion\r
+  @retval EFI_OUT_OF_RESOURCES   Memory allocation failed.\r
+  @retval EFI_SUCCESS            The function completed successfully.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -925,6 +1142,16 @@ EbcAddImageThunk (
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Registers a callback function that the EBC interpreter calls to flush the\r
+  processor instruction cache following creation of thunks. \r
+\r
+  @param  This        A pointer to the EFI_EBC_PROTOCOL instance.\r
+  @param  Flush       Pointer to a function of type EBC_ICACH_FLUSH.\r
+   \r
+  @retval EFI_SUCCESS The function completed successfully.\r
+\r
+**/\r
 STATIC\r
 EFI_STATUS\r
 EFIAPI\r
@@ -937,6 +1164,17 @@ EbcRegisterICacheFlush (
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Called to get the version of the interpreter.\r
+\r
+  @param  This                  A pointer to the EFI_EBC_PROTOCOL instance.\r
+  @param  Version               Pointer to where to store the returned version\r
+                                of the interpreter.\r
+   \r
+  @retval EFI_SUCCESS           The function completed successfully.\r
+  @retval EFI_INVALID_PARAMETER Version pointer is NULL.\r
+\r
+**/\r
 STATIC\r
 EFI_STATUS\r
 EFIAPI\r
@@ -953,11 +1191,24 @@ EbcGetVersion (
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Returns the stack index and buffer assosicated with the Handle parameter.\r
+\r
+  @param  Handle                The EFI handle as the index to the EBC stack. \r
+  @param  StackBuffer           A pointer to hold the returned stack buffer.\r
+  @param  BufferIndex           A pointer to hold the returned stack index.\r
+   \r
+  @retval EFI_OUT_OF_RESOURCES  The Handle parameter does not correspond to any\r
+                                existing EBC stack.\r
+  @retval EFI_SUCCESS           The stack index and buffer were found and\r
+                                returned to the caller.\r
+\r
+**/\r
 EFI_STATUS\r
 GetEBCStack(\r
-  EFI_HANDLE Handle,\r
-  VOID       **StackBuffer,\r
-  UINTN      *BufferIndex\r
+  IN  EFI_HANDLE Handle,\r
+  OUT VOID       **StackBuffer,\r
+  OUT UINTN      *BufferIndex\r
   )\r
 {\r
   UINTN   Index;\r
@@ -978,18 +1229,34 @@ GetEBCStack(
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Returns from the EBC stack by stack Index. \r
+   \r
+  @param  Index        Specifies which EBC stack to return from.\r
+   \r
+  @retval EFI_SUCCESS  The function completed successfully.\r
+\r
+**/\r
 EFI_STATUS\r
 ReturnEBCStack(\r
-  UINTN Index\r
+  IN UINTN Index\r
   )\r
 {\r
-  mStackBufferIndex[Index] =NULL;\r
+  mStackBufferIndex[Index] = NULL;\r
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Returns from the EBC stack associated with the Handle parameter. \r
+   \r
+  @param  Handle      Specifies the EFI handle to find the EBC stack with.\r
+   \r
+  @retval EFI_SUCCESS The function completed successfully.\r
+\r
+**/\r
 EFI_STATUS\r
 ReturnEBCStackByHandle(\r
-  EFI_HANDLE Handle\r
+  IN EFI_HANDLE Handle\r
   )\r
 {\r
   UINTN Index;\r
@@ -1005,6 +1272,13 @@ ReturnEBCStackByHandle(
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Allocates memory to hold all the EBC stacks.\r
+\r
+  @retval EFI_SUCCESS          The EBC stacks were allocated successfully. \r
+  @retval EFI_OUT_OF_RESOURCES Not enough memory available for EBC stacks.\r
+\r
+**/\r
 EFI_STATUS\r
 InitEBCStack (\r
   VOID\r
@@ -1023,6 +1297,13 @@ InitEBCStack (
   return EFI_SUCCESS;\r
 }\r
 \r
+\r
+/**\r
+  Free all EBC stacks allocated before.\r
+\r
+  @retval EFI_SUCCESS   All the EBC stacks were freed.\r
+\r
+**/\r
 EFI_STATUS\r
 FreeEBCStack(\r
   VOID\r
@@ -1036,12 +1317,12 @@ FreeEBCStack(
 }\r
 \r
 /**\r
-  Produce an EBC VM test protocol that can be used for regression tests.\r
+  Produces an EBC VM test protocol that can be used for regression tests.\r
 \r
-  @param  IHandle                handle on which to install the protocol.\r
+  @param  IHandle                Handle on which to install the protocol.\r
 \r
-  @retval EFI_OUT_OF_RESOURCES   memory allocation failed\r
-  @retval EFI_SUCCESS            successful completion\r
+  @retval EFI_OUT_OF_RESOURCES   Memory allocation failed.\r
+  @retval EFI_SUCCESS            The function completed successfully.\r
 \r
 **/\r
 STATIC\r
@@ -1078,9 +1359,19 @@ InitEbcVmTestProtocol (
   }\r
   return Status;\r
 }\r
+\r
+\r
+/**\r
+  Returns the EFI_UNSUPPORTED Status.\r
+   \r
+  @return EFI_UNSUPPORTED  This function always return EFI_UNSUPPORTED status.\r
+\r
+**/\r
 STATIC\r
 EFI_STATUS\r
-EbcVmTestUnsupported ()\r
+EbcVmTestUnsupported (\r
+  VOID\r
+  )\r
 {\r
   return EFI_UNSUPPORTED;\r
 }\r