]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/EbcDxe/EbcDebugger/Edb.c
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Universal / EbcDxe / EbcDebugger / Edb.c
index e0b85c70eff52857fc2460b4db4da141066e3982..611b2de5d81f5512d0449e6e90a15cc9f332497b 100644 (file)
@@ -1,21 +1,9 @@
-/*++\r
+/** @file\r
 \r
-Copyright (c) 2007, 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
+Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\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
-  Ebc.c\r
-\r
-Abstract:\r
-\r
---*/\r
+**/\r
 \r
 #include <Uefi.h>\r
 #include "Edb.h"\r
@@ -27,6 +15,10 @@ EFI_DEBUGGER_PRIVATE_DATA mDebuggerPrivate = {
     EBC_DEBUGGER_MINOR_VERSION,              // EfiDebuggerRevision\r
   (VM_MAJOR_VERSION << 16) |\r
     VM_MINOR_VERSION,                        // EbcVmRevision\r
+  {\r
+    EFI_DEBUGGER_CONFIGURATION_VERSION,\r
+    &mDebuggerPrivate,\r
+  },                                         // DebuggerConfiguration\r
   NULL,                                      // DebugImageInfoTableHeader\r
   NULL,                                      // Vol\r
   NULL,                                      // PciRootBridgeIo\r
@@ -62,27 +54,19 @@ CHAR16 *mExceptionStr[] = {
   L"EXCEPT_EBC_SINGLE_STEP",\r
 };\r
 \r
+/**\r
+\r
+  Clear all the breakpoint.\r
+\r
+  @param DebuggerPrivate    EBC Debugger private data structure\r
+  @param NeedRemove         Whether need to remove all the breakpoint\r
+\r
+**/\r
 VOID\r
 EdbClearAllBreakpoint (\r
   IN     EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,\r
   IN     BOOLEAN                   NeedRemove\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Clear all the breakpoint\r
-\r
-Arguments:\r
-\r
-  DebuggerPrivate - EBC Debugger private data structure\r
-  NeedRemove      - Whether need to remove all the breakpoint\r
-\r
-Returns:\r
-\r
-  None\r
-\r
---*/\r
 {\r
   UINTN    Index;\r
 \r
@@ -113,25 +97,17 @@ Returns:
   return ;\r
 }\r
 \r
+/**\r
+\r
+  Set all the breakpoint.\r
+\r
+  @param DebuggerPrivate    EBC Debugger private data structure\r
+\r
+**/\r
 VOID\r
 EdbSetAllBreakpoint (\r
   IN     EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Set all the breakpoint\r
-\r
-Arguments:\r
-\r
-  DebuggerPrivate - EBC Debugger private data structure\r
-\r
-Returns:\r
-\r
-  None\r
-\r
---*/\r
 {\r
   UINTN    Index;\r
   UINT16   Data16;\r
@@ -169,32 +145,23 @@ Returns:
   return ;\r
 }\r
 \r
-VOID\r
-EdbCheckBreakpoint (\r
-  IN     EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,\r
-  IN     EFI_SYSTEM_CONTEXT        SystemContext\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
 \r
   Check all the breakpoint, if match, then set status flag, and record current breakpoint.\r
   Then clear all breakpoint to let user see a clean memory\r
 \r
-Arguments:\r
-\r
-  DebuggerPrivate - EBC Debugger private data structure\r
-  SystemContext   - EBC system context.\r
+  @param   DebuggerPrivate    EBC Debugger private data structure\r
+  @param   SystemContext      EBC system context.\r
 \r
-Returns:\r
-\r
-  None\r
-\r
---*/\r
+**/\r
+VOID\r
+EdbCheckBreakpoint (\r
+  IN     EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,\r
+  IN     EFI_SYSTEM_CONTEXT        SystemContext\r
+  )\r
 {\r
   UINT64   Address;\r
   UINTN    Index;\r
-  UINT16   OldInstruction;\r
   BOOLEAN  IsHitBreakpoint;\r
 \r
   //\r
@@ -209,7 +176,6 @@ Returns:
   for (Index = 0; (Index < DebuggerPrivate->DebuggerBreakpointCount) && (Index < EFI_DEBUGGER_BREAKPOINT_MAX); Index++) {\r
     if ((DebuggerPrivate->DebuggerBreakpointContext[Index].BreakpointAddress == Address) &&\r
         (DebuggerPrivate->DebuggerBreakpointContext[Index].State)) {\r
-      OldInstruction = (UINT16)DebuggerPrivate->DebuggerBreakpointContext[Index].OldInstruction;\r
       IsHitBreakpoint = TRUE;\r
       break;\r
     }\r
@@ -244,7 +210,6 @@ Returns:
     for (Index = 0; (Index < DebuggerPrivate->DebuggerBreakpointCount) && (Index < EFI_DEBUGGER_BREAKPOINT_MAX); Index++) {\r
       if ((DebuggerPrivate->DebuggerBreakpointContext[Index].BreakpointAddress == Address) &&\r
           (DebuggerPrivate->DebuggerBreakpointContext[Index].State)) {\r
-        OldInstruction = (UINT16)DebuggerPrivate->DebuggerBreakpointContext[Index].OldInstruction;\r
         IsHitBreakpoint = TRUE;\r
         break;\r
       }\r
@@ -276,25 +241,16 @@ Returns:
   return ;\r
 }\r
 \r
+/**\r
+  clear all the symbol.\r
+\r
+  @param DebuggerPrivate    EBC Debugger private data structure\r
+\r
+**/\r
 VOID\r
 EdbClearSymbol (\r
   IN     EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  clear all the symbol\r
-\r
-Arguments:\r
-\r
-  DebuggerPrivate - EBC Debugger private data structure\r
-\r
-Returns:\r
-\r
-  None\r
-\r
---*/\r
 {\r
   EFI_DEBUGGER_SYMBOL_CONTEXT *DebuggerSymbolContext;\r
   EFI_DEBUGGER_SYMBOL_OBJECT  *Object;\r
@@ -331,6 +287,16 @@ Returns:
   return ;\r
 }\r
 \r
+/**\r
+\r
+  Initialize Debugger private data structure\r
+\r
+  @param DebuggerPrivate   EBC Debugger private data structure\r
+  @param ExceptionType     Exception type.\r
+  @param SystemContext     EBC system context.\r
+  @param Initialized       Whether the DebuggerPrivate data is initialized.\r
+\r
+**/\r
 EFI_STATUS\r
 InitDebuggerPrivateData (\r
   IN     EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,\r
@@ -338,30 +304,12 @@ InitDebuggerPrivateData (
   IN     EFI_SYSTEM_CONTEXT        SystemContext,\r
   IN     BOOLEAN                   Initialized\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Initialize Debugger private data structure\r
-\r
-Arguments:\r
-\r
-  DebuggerPrivate - EBC Debugger private data structure\r
-  InterruptType   - Interrupt type.\r
-  SystemContext   - EBC system context.\r
-  Initialized     - Whether the DebuggerPrivate data is initialized.\r
-\r
-Returns:\r
-\r
-  None\r
-\r
---*/\r
 {\r
   //\r
   // clear STEP flag in any condition.\r
   //\r
-  if (SystemContext.SystemContextEbc->Flags & VMFLAGS_STEP) {\r
-    SystemContext.SystemContextEbc->Flags &= ~VMFLAGS_STEP;\r
+  if (SystemContext.SystemContextEbc->Flags & ((UINT64) VMFLAGS_STEP)) {\r
+    SystemContext.SystemContextEbc->Flags &= ~((UINT64) VMFLAGS_STEP);\r
   }\r
 \r
   if (!Initialized) {\r
@@ -403,6 +351,16 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+\r
+  De-initialize Debugger private data structure.\r
+\r
+  @param DebuggerPrivate   EBC Debugger private data structure\r
+  @param ExceptionType     Exception type.\r
+  @param SystemContext     EBC system context.\r
+  @param Initialized       Whether the DebuggerPrivate data is initialized.\r
+\r
+**/\r
 EFI_STATUS\r
 DeinitDebuggerPrivateData (\r
   IN     EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,\r
@@ -410,24 +368,6 @@ DeinitDebuggerPrivateData (
   IN     EFI_SYSTEM_CONTEXT        SystemContext,\r
   IN     BOOLEAN                   Initialized\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  De-initialize Debugger private data structure\r
-\r
-Arguments:\r
-\r
-  DebuggerPrivate - EBC Debugger private data structure\r
-  InterruptType   - Interrupt type.\r
-  SystemContext   - EBC system context.\r
-  Initialized     - Whether the DebuggerPrivate data is initialized.\r
-\r
-Returns:\r
-\r
-  None\r
-\r
---*/\r
 {\r
   if (!Initialized) {\r
     //\r
@@ -467,6 +407,16 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+\r
+  Print the reason of current break to EbcDebugger.\r
+\r
+  @param DebuggerPrivate   EBC Debugger private data structure\r
+  @param ExceptionType     Exception type.\r
+  @param SystemContext     EBC system context.\r
+  @param Initialized       Whether the DebuggerPrivate data is initialized.\r
+\r
+**/\r
 VOID\r
 PrintExceptionReason (\r
   IN     EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,\r
@@ -474,24 +424,6 @@ PrintExceptionReason (
   IN     EFI_SYSTEM_CONTEXT        SystemContext,\r
   IN     BOOLEAN                   Initialized\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Print the reason of current break to EbcDebugger.\r
-\r
-Arguments:\r
-\r
-  DebuggerPrivate - EBC Debugger private data structure\r
-  InterruptType   - Interrupt type.\r
-  SystemContext   - EBC system context.\r
-  Initialized     - Whether the DebuggerPrivate data is initialized.\r
-\r
-Returns:\r
-\r
-  None\r
-\r
---*/\r
 {\r
   //\r
   // Print break status\r
@@ -528,36 +460,30 @@ Returns:
   return ;\r
 }\r
 \r
-VOID\r
-EFIAPI\r
-EdbExceptionHandler (\r
-  IN     EFI_EXCEPTION_TYPE   ExceptionType,\r
-  IN OUT EFI_SYSTEM_CONTEXT   SystemContext\r
-  )\r
-/*++\r
-\r
-Routine Description:\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
-Arguments:\r
-\r
-  InterruptType - Interrupt type.\r
-  SystemContext - EBC system context.\r
+  @param ExceptionType    Exception type.\r
+  @param SystemContext    EBC system context.\r
 \r
-Returns:\r
-\r
-  None\r
-\r
---*/\r
+**/\r
+VOID\r
+EFIAPI\r
+EdbExceptionHandler (\r
+  IN     EFI_EXCEPTION_TYPE   ExceptionType,\r
+  IN OUT EFI_SYSTEM_CONTEXT   SystemContext\r
+  )\r
 {\r
   CHAR16                  InputBuffer[EFI_DEBUG_INPUS_BUFFER_SIZE];\r
   CHAR16                  *CommandArg;\r
   EFI_DEBUGGER_COMMAND    DebuggerCommand;\r
   EFI_DEBUG_STATUS        DebugStatus;\r
-  STATIC BOOLEAN          mInitialized = FALSE;\r
+  STATIC BOOLEAN          mInitialized;\r
+\r
+  mInitialized = FALSE;\r
 \r
   DEBUG ((DEBUG_ERROR, "Hello EBC Debugger!\n"));\r
 \r