X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FEbcDxe%2FEbcDebugger%2FEdb.c;h=611b2de5d81f5512d0449e6e90a15cc9f332497b;hb=9d510e61fceee7b92955ef9a3c20343752d8ce3f;hp=e0b85c70eff52857fc2460b4db4da141066e3982;hpb=748edcd5eb706b34ffd0af6900a8db19605b0ffd;p=mirror_edk2.git
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/Edb.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/Edb.c
index e0b85c70ef..611b2de5d8 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/Edb.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/Edb.c
@@ -1,21 +1,9 @@
-/*++
+/** @file
-Copyright (c) 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
+Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Ebc.c
-
-Abstract:
-
---*/
+**/
#include
#include "Edb.h"
@@ -27,6 +15,10 @@ EFI_DEBUGGER_PRIVATE_DATA mDebuggerPrivate = {
EBC_DEBUGGER_MINOR_VERSION, // EfiDebuggerRevision
(VM_MAJOR_VERSION << 16) |
VM_MINOR_VERSION, // EbcVmRevision
+ {
+ EFI_DEBUGGER_CONFIGURATION_VERSION,
+ &mDebuggerPrivate,
+ }, // DebuggerConfiguration
NULL, // DebugImageInfoTableHeader
NULL, // Vol
NULL, // PciRootBridgeIo
@@ -62,27 +54,19 @@ CHAR16 *mExceptionStr[] = {
L"EXCEPT_EBC_SINGLE_STEP",
};
+/**
+
+ Clear all the breakpoint.
+
+ @param DebuggerPrivate EBC Debugger private data structure
+ @param NeedRemove Whether need to remove all the breakpoint
+
+**/
VOID
EdbClearAllBreakpoint (
IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
IN BOOLEAN NeedRemove
)
-/*++
-
-Routine Description:
-
- Clear all the breakpoint
-
-Arguments:
-
- DebuggerPrivate - EBC Debugger private data structure
- NeedRemove - Whether need to remove all the breakpoint
-
-Returns:
-
- None
-
---*/
{
UINTN Index;
@@ -113,25 +97,17 @@ Returns:
return ;
}
+/**
+
+ Set all the breakpoint.
+
+ @param DebuggerPrivate EBC Debugger private data structure
+
+**/
VOID
EdbSetAllBreakpoint (
IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate
)
-/*++
-
-Routine Description:
-
- Set all the breakpoint
-
-Arguments:
-
- DebuggerPrivate - EBC Debugger private data structure
-
-Returns:
-
- None
-
---*/
{
UINTN Index;
UINT16 Data16;
@@ -169,32 +145,23 @@ Returns:
return ;
}
-VOID
-EdbCheckBreakpoint (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_SYSTEM_CONTEXT SystemContext
- )
-/*++
-
-Routine Description:
+/**
Check all the breakpoint, if match, then set status flag, and record current breakpoint.
Then clear all breakpoint to let user see a clean memory
-Arguments:
-
- DebuggerPrivate - EBC Debugger private data structure
- SystemContext - EBC system context.
+ @param DebuggerPrivate EBC Debugger private data structure
+ @param SystemContext EBC system context.
-Returns:
-
- None
-
---*/
+**/
+VOID
+EdbCheckBreakpoint (
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_SYSTEM_CONTEXT SystemContext
+ )
{
UINT64 Address;
UINTN Index;
- UINT16 OldInstruction;
BOOLEAN IsHitBreakpoint;
//
@@ -209,7 +176,6 @@ Returns:
for (Index = 0; (Index < DebuggerPrivate->DebuggerBreakpointCount) && (Index < EFI_DEBUGGER_BREAKPOINT_MAX); Index++) {
if ((DebuggerPrivate->DebuggerBreakpointContext[Index].BreakpointAddress == Address) &&
(DebuggerPrivate->DebuggerBreakpointContext[Index].State)) {
- OldInstruction = (UINT16)DebuggerPrivate->DebuggerBreakpointContext[Index].OldInstruction;
IsHitBreakpoint = TRUE;
break;
}
@@ -244,7 +210,6 @@ Returns:
for (Index = 0; (Index < DebuggerPrivate->DebuggerBreakpointCount) && (Index < EFI_DEBUGGER_BREAKPOINT_MAX); Index++) {
if ((DebuggerPrivate->DebuggerBreakpointContext[Index].BreakpointAddress == Address) &&
(DebuggerPrivate->DebuggerBreakpointContext[Index].State)) {
- OldInstruction = (UINT16)DebuggerPrivate->DebuggerBreakpointContext[Index].OldInstruction;
IsHitBreakpoint = TRUE;
break;
}
@@ -276,25 +241,16 @@ Returns:
return ;
}
+/**
+ clear all the symbol.
+
+ @param DebuggerPrivate EBC Debugger private data structure
+
+**/
VOID
EdbClearSymbol (
IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate
)
-/*++
-
-Routine Description:
-
- clear all the symbol
-
-Arguments:
-
- DebuggerPrivate - EBC Debugger private data structure
-
-Returns:
-
- None
-
---*/
{
EFI_DEBUGGER_SYMBOL_CONTEXT *DebuggerSymbolContext;
EFI_DEBUGGER_SYMBOL_OBJECT *Object;
@@ -331,6 +287,16 @@ Returns:
return ;
}
+/**
+
+ Initialize Debugger private data structure
+
+ @param DebuggerPrivate EBC Debugger private data structure
+ @param ExceptionType Exception type.
+ @param SystemContext EBC system context.
+ @param Initialized Whether the DebuggerPrivate data is initialized.
+
+**/
EFI_STATUS
InitDebuggerPrivateData (
IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
@@ -338,30 +304,12 @@ InitDebuggerPrivateData (
IN EFI_SYSTEM_CONTEXT SystemContext,
IN BOOLEAN Initialized
)
-/*++
-
-Routine Description:
-
- Initialize Debugger private data structure
-
-Arguments:
-
- DebuggerPrivate - EBC Debugger private data structure
- InterruptType - Interrupt type.
- SystemContext - EBC system context.
- Initialized - Whether the DebuggerPrivate data is initialized.
-
-Returns:
-
- None
-
---*/
{
//
// clear STEP flag in any condition.
//
- if (SystemContext.SystemContextEbc->Flags & VMFLAGS_STEP) {
- SystemContext.SystemContextEbc->Flags &= ~VMFLAGS_STEP;
+ if (SystemContext.SystemContextEbc->Flags & ((UINT64) VMFLAGS_STEP)) {
+ SystemContext.SystemContextEbc->Flags &= ~((UINT64) VMFLAGS_STEP);
}
if (!Initialized) {
@@ -403,6 +351,16 @@ Returns:
return EFI_SUCCESS;
}
+/**
+
+ De-initialize Debugger private data structure.
+
+ @param DebuggerPrivate EBC Debugger private data structure
+ @param ExceptionType Exception type.
+ @param SystemContext EBC system context.
+ @param Initialized Whether the DebuggerPrivate data is initialized.
+
+**/
EFI_STATUS
DeinitDebuggerPrivateData (
IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
@@ -410,24 +368,6 @@ DeinitDebuggerPrivateData (
IN EFI_SYSTEM_CONTEXT SystemContext,
IN BOOLEAN Initialized
)
-/*++
-
-Routine Description:
-
- De-initialize Debugger private data structure
-
-Arguments:
-
- DebuggerPrivate - EBC Debugger private data structure
- InterruptType - Interrupt type.
- SystemContext - EBC system context.
- Initialized - Whether the DebuggerPrivate data is initialized.
-
-Returns:
-
- None
-
---*/
{
if (!Initialized) {
//
@@ -467,6 +407,16 @@ Returns:
return EFI_SUCCESS;
}
+/**
+
+ Print the reason of current break to EbcDebugger.
+
+ @param DebuggerPrivate EBC Debugger private data structure
+ @param ExceptionType Exception type.
+ @param SystemContext EBC system context.
+ @param Initialized Whether the DebuggerPrivate data is initialized.
+
+**/
VOID
PrintExceptionReason (
IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
@@ -474,24 +424,6 @@ PrintExceptionReason (
IN EFI_SYSTEM_CONTEXT SystemContext,
IN BOOLEAN Initialized
)
-/*++
-
-Routine Description:
-
- Print the reason of current break to EbcDebugger.
-
-Arguments:
-
- DebuggerPrivate - EBC Debugger private data structure
- InterruptType - Interrupt type.
- SystemContext - EBC system context.
- Initialized - Whether the DebuggerPrivate data is initialized.
-
-Returns:
-
- None
-
---*/
{
//
// Print break status
@@ -528,36 +460,30 @@ Returns:
return ;
}
-VOID
-EFIAPI
-EdbExceptionHandler (
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
- )
-/*++
-
-Routine Description:
+/**
The default Exception Callback for the VM interpreter.
In this function, we report status code, and print debug information
about EBC_CONTEXT, then dead loop.
-Arguments:
-
- InterruptType - Interrupt type.
- SystemContext - EBC system context.
+ @param ExceptionType Exception type.
+ @param SystemContext EBC system context.
-Returns:
-
- None
-
---*/
+**/
+VOID
+EFIAPI
+EdbExceptionHandler (
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ )
{
CHAR16 InputBuffer[EFI_DEBUG_INPUS_BUFFER_SIZE];
CHAR16 *CommandArg;
EFI_DEBUGGER_COMMAND DebuggerCommand;
EFI_DEBUG_STATUS DebugStatus;
- STATIC BOOLEAN mInitialized = FALSE;
+ STATIC BOOLEAN mInitialized;
+
+ mInitialized = FALSE;
DEBUG ((DEBUG_ERROR, "Hello EBC Debugger!\n"));