зеркало из https://github.com/microsoft/mu_plus.git
Merged PR 3173: Convert from DEBUG_BUFFER/DebugDumpMemory to the new DEBUG_HEX macro
Convert from DEBUG_BUFFER/DebugDumpMemory to the new DEBUG_HEX macro
This commit is contained in:
Родитель
a371e5867f
Коммит
362fa030f0
|
@ -61,29 +61,10 @@ VOID
|
|||
IN CONST CHAR8 *Description
|
||||
);
|
||||
|
||||
/**
|
||||
Function pointer for PPI routing to correct DebugDumpMemory function
|
||||
|
||||
@param Address The address of the memory to dump.
|
||||
@param Length The length of the region to dump.
|
||||
@param Flags PrintAddress, PrintOffset etc
|
||||
|
||||
**/
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *ADVANCED_LOGGER_DUMP_MEMORY)(
|
||||
IN UINTN ErrorLevel,
|
||||
IN CONST VOID *Address,
|
||||
IN UINTN Length,
|
||||
IN UINT32 Flags
|
||||
);
|
||||
|
||||
|
||||
struct _ADVANCED_LOGGER_PPI {
|
||||
ADVANCED_LOGGER_WRITE AdvancedLoggerWrite;
|
||||
ADVANCED_LOGGER_PRINT AdvancedLoggerPrint;
|
||||
ADVANCED_LOGGER_ASSERT AdvancedLoggerAssert;
|
||||
ADVANCED_LOGGER_DUMP_MEMORY AdvancedLoggerDumpMemory;
|
||||
};
|
||||
|
||||
extern EFI_GUID gAdvancedLoggerPpiGuid;
|
||||
|
|
|
@ -130,7 +130,7 @@ AdvancedLoggerAccessLibGetNextMessageBlock (
|
|||
LogEntry = (ADVANCED_LOGGER_MESSAGE_ENTRY *) MESSAGE_ENTRY_FROM_MSG(BlockEntry->Message);
|
||||
if (LogEntry->Signature != MESSAGE_ENTRY_SIGNATURE) {
|
||||
DEBUG((DEBUG_ERROR, "Resume LogEntry invalid signature at %p\n", LogEntry));
|
||||
DEBUG_BUFFER(DEBUG_INFO, (CHAR8 *)LogEntry - 128, 256, DEBUG_DM_PRINT_ADDRESS | DEBUG_DM_PRINT_ASCII);
|
||||
DUMP_HEX(DEBUG_INFO, 0, (CHAR8 *)LogEntry - 128, 256, "");
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
LogEntry = NEXT_LOG_ENTRY (LogEntry);
|
||||
|
@ -151,8 +151,8 @@ AdvancedLoggerAccessLibGetNextMessageBlock (
|
|||
|
||||
if (LogEntry->Signature != MESSAGE_ENTRY_SIGNATURE) {
|
||||
DEBUG((DEBUG_ERROR, "Next LogEntry invalid signature at %p, Last=%p\n", LogEntry, BlockEntry->Message));
|
||||
DEBUG_BUFFER(DEBUG_INFO, (CHAR8 *)BlockEntry->Message - 128, 256, DEBUG_DM_PRINT_ADDRESS | DEBUG_DM_PRINT_ASCII);
|
||||
DEBUG_BUFFER(DEBUG_INFO, (CHAR8 *)LogEntry - 128, 256, DEBUG_DM_PRINT_ADDRESS | DEBUG_DM_PRINT_ASCII);
|
||||
DUMP_HEX(DEBUG_INFO, 0, (CHAR8 *)BlockEntry->Message - 128, 256, "");
|
||||
DUMP_HEX(DEBUG_INFO, 0, (CHAR8 *)LogEntry - 128, 256, "");
|
||||
return EFI_COMPROMISED_DATA;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@ ADVANCED_LOGGER_PPI mAdvancedLoggerPpi = {
|
|||
AdvancedLoggerWrite,
|
||||
DebugVPrint,
|
||||
DebugAssert,
|
||||
DebugDumpMemory
|
||||
};
|
||||
|
||||
CONST EFI_PEI_PPI_DESCRIPTOR mAdvancedLoggerPpiList[] = {
|
||||
|
|
|
@ -169,118 +169,6 @@ DebugPrintMarker (
|
|||
AdvancedLoggerWrite (ErrorLevel, Buffer, AsciiStrLen (Buffer));
|
||||
}
|
||||
|
||||
// MS_CHANGE_?
|
||||
/**
|
||||
// MS_CHANGE Added DebugDumpMemory
|
||||
Dumps memory formatted.
|
||||
|
||||
Dumps the memory as hex bytes. Other additional options
|
||||
are controlled with the Flags parameter.
|
||||
|
||||
|
||||
@param Address The address of the memory to dump.
|
||||
@param Length The length of the region to dump.
|
||||
@param Flags PrintAddress, PrintOffset etc
|
||||
|
||||
**/
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
DebugDumpMemory(
|
||||
IN UINTN ErrorLevel,
|
||||
IN CONST VOID *Address,
|
||||
IN UINTN Length,
|
||||
IN UINT32 Flags
|
||||
)
|
||||
{
|
||||
UINTN Indx;
|
||||
UINT8 *p;
|
||||
CHAR8 Txt[17]; // 16 characters, and a NULL
|
||||
|
||||
p = (UINT8 *)Address;
|
||||
|
||||
Txt[16] = '\0';
|
||||
Indx = 0;
|
||||
while (Indx < Length)
|
||||
{
|
||||
UINTN LoopLen = ((Length - Indx) >= 16) ? 16 : (Length - Indx);
|
||||
if (0 == (Indx % 16)) // first time and every 16 bytes thereafter
|
||||
{
|
||||
if (Flags & DEBUG_DM_PRINT_ADDRESS)
|
||||
{
|
||||
DebugPrint(ErrorLevel, "\n0x%16.16X: ", p);
|
||||
}
|
||||
else if (Flags & DEBUG_DM_PRINT_OFFSET)
|
||||
{
|
||||
DebugPrint(ErrorLevel, "\n0x%8.8X: ", (p - (UINT8 *)Address));
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugPrint(ErrorLevel, "\n");
|
||||
}
|
||||
|
||||
//Get all ASCII Chars if ASCII flag for the next 16 or less
|
||||
if (Flags & DEBUG_DM_PRINT_ASCII)
|
||||
{
|
||||
SetMem(Txt, sizeof(Txt) - 1, ' ');
|
||||
for (UINTN I = (Indx % 16); I < LoopLen; I++)
|
||||
{
|
||||
CHAR8* c = ((CHAR8 *)p) + I;
|
||||
Txt[I] = ((*c >= 0x20) && (*c <= 0x7e)) ? *c : '.';
|
||||
}
|
||||
}
|
||||
} //first pass -- done only at (index % 16 == 0)
|
||||
|
||||
if (LoopLen == 16)
|
||||
{
|
||||
DebugPrint(ErrorLevel, "%02X %02X %02X %02X %02X %02X %02X %02X - ", *(p), *(p + 1), *(p + 2), *(p + 3), *(p + 4), *(p + 5), *(p + 6), *(p + 7));
|
||||
DebugPrint(ErrorLevel, "%02X %02X %02X %02X %02X %02X %02X %02X ", *(p + 8), *(p + 9), *(p + 10), *(p + 11), *(p + 12), *(p + 13), *(p + 14), *(p + 15));
|
||||
Indx += 16;
|
||||
p += 16;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((Indx % 16) == 7)
|
||||
{
|
||||
DebugPrint(ErrorLevel, "%02X - ", *(p));
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugPrint(ErrorLevel, "%02X ", *(p));
|
||||
}
|
||||
Indx++;
|
||||
p++;
|
||||
}
|
||||
|
||||
//end of line and/or end of buffer
|
||||
if (((Indx % 16) == 0) || (Indx == Length))
|
||||
{
|
||||
|
||||
//special case where we need to print out a few blank spaces because our length
|
||||
//was not evenly divisible by 16
|
||||
if (Flags & DEBUG_DM_PRINT_ASCII)
|
||||
{
|
||||
if ((Indx % 16) != 0)
|
||||
{
|
||||
//figure out how many spaces to print
|
||||
CHAR8 empty[48]; //(15 bytes * 3 chars) + 2 (for -) + 1 (\0)
|
||||
UINTN endchar = ((16 - (Indx % 16)) * 3);
|
||||
SetMem(empty, 47, ' ');
|
||||
if ((Indx % 16) <= 8)
|
||||
{
|
||||
endchar += 2;
|
||||
}
|
||||
empty[endchar] = '\0'; //null terminate
|
||||
DebugPrint(ErrorLevel, "%a", empty);
|
||||
}
|
||||
DebugPrint(ErrorLevel, " *%a*", Txt); // print the text
|
||||
}
|
||||
}
|
||||
} //End while loop
|
||||
DebugPrint(ErrorLevel, "\n");
|
||||
}
|
||||
// END
|
||||
|
||||
|
||||
/**
|
||||
Prints a debug message to the debug output device if the specified
|
||||
|
|
|
@ -123,7 +123,7 @@ InitializeDebugAgent (
|
|||
LogPtr->Signature = ADVANCED_LOGGER_PTR_SIGNATURE;
|
||||
|
||||
DEBUG((DEBUG_INFO, "%a: Start. SecLogInfo=%p\n", __FUNCTION__, LoggerInfo));
|
||||
DEBUG_BUFFER(DEBUG_INFO, (VOID *) LoggerInfo, sizeof(ADVANCED_LOGGER_INFO), DEBUG_DM_PRINT_ADDRESS | DEBUG_DM_PRINT_ASCII);
|
||||
DUMP_HEX(DEBUG_INFO, 0, (VOID *) LoggerInfo, sizeof(ADVANCED_LOGGER_INFO), "");
|
||||
// From this point until the PeiDebugLib constructor creates the Logger Info HOB, the access
|
||||
// to the LoggerInfo is via PCD to the well known address. However, there is some overlap between
|
||||
// PEI and SEC due to SEC PPI callbacks. There will be two transition of logging:
|
||||
|
@ -219,8 +219,8 @@ InitializeDebugAgent (
|
|||
NewLoggerInfo->LogCurrent,
|
||||
NewLoggerInfo->LogBufferSize,
|
||||
NewLoggerInfo->DiscardedSize));
|
||||
DEBUG_BUFFER(DEBUG_INFO, (VOID *) LogPtr, sizeof(ADVANCED_LOGGER_PTR), DEBUG_DM_PRINT_ADDRESS | DEBUG_DM_PRINT_ASCII);
|
||||
DEBUG_BUFFER(DEBUG_INFO, (VOID *) NewLoggerInfo, sizeof(ADVANCED_LOGGER_INFO), DEBUG_DM_PRINT_ADDRESS | DEBUG_DM_PRINT_ASCII);
|
||||
DUMP_HEX(DEBUG_INFO, 0, (VOID *) LogPtr, sizeof(ADVANCED_LOGGER_PTR), "");
|
||||
DUMP_HEX(DEBUG_INFO, 0, (VOID *) NewLoggerInfo, sizeof(ADVANCED_LOGGER_INFO), "");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -74,52 +74,6 @@ DebugPrint (
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Dumps memory formatted.
|
||||
|
||||
Dumps the memory as hex bytes. Other additional options
|
||||
are controlled with the Flags parameter.
|
||||
|
||||
|
||||
@param Address The address of the memory to dump.
|
||||
@param Length The length of the region to dump.
|
||||
@param Flags PrintAddress, PrintOffset etc
|
||||
**/
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
DebugDumpMemory (
|
||||
IN UINTN ErrorLevel,
|
||||
IN CONST VOID *Address,
|
||||
IN UINTN Length,
|
||||
IN UINT32 Flags
|
||||
)
|
||||
{
|
||||
ADVANCED_LOGGER_PPI *AdvLoggerPPI;
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// If Format is NULL, then ASSERT().
|
||||
//
|
||||
ASSERT(Address != NULL);
|
||||
|
||||
//
|
||||
// Check driver Debug Level value and global debug level
|
||||
//
|
||||
if ((ErrorLevel & GetDebugPrintErrorLevel()) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Status = PeiServicesLocatePpi(
|
||||
&gAdvancedLoggerPpiGuid,
|
||||
0,
|
||||
NULL,
|
||||
(VOID **)&AdvLoggerPPI
|
||||
);
|
||||
if (Status == EFI_SUCCESS) {
|
||||
AdvLoggerPPI->AdvancedLoggerDumpMemory(ErrorLevel, Address, Length, Flags);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Prints an assert message containing a filename, line number, and description.
|
||||
|
|
|
@ -837,9 +837,9 @@ DfciIssueRequest (
|
|||
DEBUG((DEBUG_INFO, "Making Request - Headers:\n"));
|
||||
DumpHeaders (RequestMessage->HeaderCount, RequestMessage->Headers);
|
||||
DEBUG((DEBUG_INFO, "HttpRequestToken:\n"));
|
||||
DEBUG_BUFFER(DEBUG_INFO, RequestToken, sizeof(EFI_HTTP_TOKEN), DEBUG_DM_PRINT_ADDRESS | DEBUG_DM_PRINT_ASCII);
|
||||
DEBUG_BUFFER(DEBUG_INFO, RequestMessage, sizeof(EFI_HTTP_MESSAGE), DEBUG_DM_PRINT_ADDRESS | DEBUG_DM_PRINT_ASCII);
|
||||
DEBUG_BUFFER(DEBUG_INFO, RequestData, sizeof(EFI_HTTP_REQUEST_DATA), DEBUG_DM_PRINT_ADDRESS | DEBUG_DM_PRINT_ASCII);
|
||||
DUMP_HEX(DEBUG_INFO, 0, RequestToken, sizeof(EFI_HTTP_TOKEN), "");
|
||||
DUMP_HEX(DEBUG_INFO, 0, RequestMessage, sizeof(EFI_HTTP_MESSAGE), "");
|
||||
DUMP_HEX(DEBUG_INFO, 0, RequestData, sizeof(EFI_HTTP_REQUEST_DATA), "");
|
||||
DEBUG((DEBUG_INFO, "%p Url=%s\n", RequestData->Url,RequestData->Url));
|
||||
|
||||
Status = NetworkRequest->Http.HttpProtocol->Request(NetworkRequest->Http.HttpProtocol, RequestToken);
|
||||
|
@ -902,10 +902,10 @@ DfciGetResponse (
|
|||
ResponseData = ResponseMessage->Data.Response;
|
||||
|
||||
DEBUG((DEBUG_INFO, "HttpResponseToken:\n"));
|
||||
DEBUG_BUFFER(DEBUG_INFO, ResponseToken, sizeof(EFI_HTTP_TOKEN), DEBUG_DM_PRINT_ADDRESS | DEBUG_DM_PRINT_ASCII);
|
||||
DEBUG_BUFFER(DEBUG_INFO, ResponseMessage, sizeof(EFI_HTTP_MESSAGE), DEBUG_DM_PRINT_ADDRESS | DEBUG_DM_PRINT_ASCII);
|
||||
DUMP_HEX(DEBUG_INFO, 0, ResponseToken, sizeof(EFI_HTTP_TOKEN), "");
|
||||
DUMP_HEX(DEBUG_INFO, 0, ResponseMessage, sizeof(EFI_HTTP_MESSAGE), "");
|
||||
if (NULL != ResponseData) {
|
||||
DEBUG_BUFFER(DEBUG_INFO, ResponseData, sizeof(EFI_HTTP_RESPONSE_DATA), DEBUG_DM_PRINT_ADDRESS | DEBUG_DM_PRINT_ASCII);
|
||||
DUMP_HEX(DEBUG_INFO, 0, ResponseData, sizeof(EFI_HTTP_RESPONSE_DATA), "");
|
||||
}
|
||||
|
||||
Status = NetworkRequest->Http.HttpProtocol->Response(NetworkRequest->Http.HttpProtocol, ResponseToken);
|
||||
|
@ -931,8 +931,8 @@ DfciGetResponse (
|
|||
|
||||
DumpHeaders (ResponseMessage->HeaderCount, ResponseMessage->Headers);
|
||||
DEBUG((DEBUG_INFO, "HttpResponseData:\n"));
|
||||
DEBUG_BUFFER(DEBUG_INFO, ResponseToken, sizeof(EFI_HTTP_TOKEN), DEBUG_DM_PRINT_ADDRESS | DEBUG_DM_PRINT_ASCII);
|
||||
DEBUG_BUFFER(DEBUG_INFO, ResponseMessage->Body, ResponseMessage->BodyLength, DEBUG_DM_PRINT_ADDRESS | DEBUG_DM_PRINT_ASCII);
|
||||
DUMP_HEX(DEBUG_INFO, 0, ResponseToken, sizeof(EFI_HTTP_TOKEN), "");
|
||||
DUMP_HEX(DEBUG_INFO, 0, ResponseMessage->Body, ResponseMessage->BodyLength, "");
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
|
|
@ -534,13 +534,13 @@ VerifySignature(
|
|||
//
|
||||
|
||||
DEBUG((DEBUG_INFO, "\n====\n[AM] %a - Printing Out The Trusted Cert\n", __FUNCTION__));
|
||||
DEBUG_BUFFER(DEBUG_INFO, TrustedCert, TrustedCertSize, (DEBUG_DM_PRINT_OFFSET | DEBUG_DM_PRINT_ASCII));
|
||||
DUMP_HEX(DEBUG_INFO, 0, TrustedCert, TrustedCertSize, "");
|
||||
|
||||
DEBUG((DEBUG_INFO, "\n====\n[AM] %a - Printing Out The %a\n", __FUNCTION__, "Incoming Sig Data Struct"));
|
||||
DEBUG_BUFFER(DEBUG_INFO, (UINT8 *)(Signature), Signature->dwLength, (DEBUG_DM_PRINT_OFFSET | DEBUG_DM_PRINT_ASCII));
|
||||
DUMP_HEX(DEBUG_INFO, 0, (UINT8 *)(Signature), Signature->dwLength, "");
|
||||
|
||||
DEBUG((DEBUG_INFO, "\n====\n[AM] %a - Printing Out The %a\n", __FUNCTION__, "Incoming Signed Data"));
|
||||
DEBUG_BUFFER(DEBUG_INFO, (UINT8 *)(SignedData), SignedDataSize, (DEBUG_DM_PRINT_OFFSET | DEBUG_DM_PRINT_ASCII));
|
||||
DUMP_HEX(DEBUG_INFO, 0, (UINT8 *)(SignedData), SignedDataSize, "");
|
||||
|
||||
|
||||
WIN_CERTIFICATE_UEFI_GUID *Cert = (WIN_CERTIFICATE_UEFI_GUID*)Signature;
|
||||
|
|
|
@ -220,10 +220,6 @@ GetRecoveryPacket(
|
|||
//Set the identity so we can use later once authenticated
|
||||
mRecoveryId = Identity;
|
||||
|
||||
//TODO: remove this code once tool is written to decode
|
||||
//DEBUG((DEBUG_INFO, "%a: DEBUG FEATURE - Print response. todo: remove before production\n", __FUNCTION__));
|
||||
//DEBUG_BUFFER(DEBUG_INFO, &(Challenge->Nonce.Parts.Key), sizeof(Challenge->Nonce.Parts.Key), DEBUG_DM_PRINT_ASCII);
|
||||
|
||||
|
||||
CLEANUP:
|
||||
if (EFI_ERROR(Status))
|
||||
|
|
|
@ -328,7 +328,7 @@ SetProviderValueFromAscii(
|
|||
|
||||
SetValue = ByteArray;
|
||||
DEBUG((DEBUG_INFO, "Setting BINARY data\n"));
|
||||
DEBUG_BUFFER(DEBUG_VERBOSE, SetValue, ValueSize, DEBUG_DM_PRINT_OFFSET | DEBUG_DM_PRINT_ASCII);
|
||||
DUMP_HEX(DEBUG_VERBOSE, 0, SetValue, ValueSize, "");
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -42,27 +42,9 @@ VOID
|
|||
IN CONST CHAR8 *Description
|
||||
);
|
||||
|
||||
/**
|
||||
Function pointer for PPI routing to correct DebugDumpMemory function
|
||||
|
||||
@param Address The address of the memory to dump.
|
||||
@param Length The length of the region to dump.
|
||||
@param Flags PrintAddress, PrintOffset etc
|
||||
|
||||
**/
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *DEBUG_PORT_DUMP_MEMORY)(
|
||||
IN UINTN ErrorLevel,
|
||||
IN CONST VOID *Address,
|
||||
IN UINTN Length,
|
||||
IN UINT32 Flags
|
||||
);
|
||||
|
||||
typedef struct {
|
||||
DEBUG_PORT_PRINT DebugPortPrint;
|
||||
DEBUG_PORT_ASSERT DebugPortAssert;
|
||||
DEBUG_PORT_DUMP_MEMORY DebugPortDumpMemory;
|
||||
} DEBUG_PORT_PPI;
|
||||
|
||||
extern EFI_GUID gDebugPortPpiGuid;
|
||||
|
|
|
@ -40,27 +40,6 @@ DebugPortPrint (
|
|||
DebugVPrint (ErrorLevel, Format, VaListMarker);
|
||||
}
|
||||
|
||||
/**
|
||||
Dumps memory formatted.
|
||||
|
||||
Calls into the DebugDumpMemory inside MdeModulePkg
|
||||
|
||||
@param Address The address of the memory to dump.
|
||||
@param Length The length of the region to dump.
|
||||
@param Flags PrintAddress, PrintOffset etc
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
DebugPortDumpMemory (
|
||||
IN UINTN ErrorLevel,
|
||||
IN CONST VOID *Address,
|
||||
IN UINTN Length,
|
||||
IN UINT32 Flags
|
||||
) {
|
||||
DebugDumpMemory(ErrorLevel, Address, Length, Flags);
|
||||
}
|
||||
|
||||
/**
|
||||
Prints an assert message containing a filename, line number, and description.
|
||||
This may be followed by a breakpoint or a dead loop.
|
||||
|
@ -95,7 +74,6 @@ DebugPortAssert (
|
|||
DEBUG_PORT_PPI mDebugPortPpi = {
|
||||
DebugPortPrint,
|
||||
DebugPortAssert,
|
||||
DebugPortDumpMemory
|
||||
};
|
||||
|
||||
EFI_PEI_PPI_DESCRIPTOR mPpiList[] = {
|
||||
|
|
|
@ -206,115 +206,6 @@ DebugPrint (
|
|||
VA_END (Marker);
|
||||
}
|
||||
|
||||
/**
|
||||
MS_CHANGE_?
|
||||
// MSCHANGE Added DebugDumpMemory
|
||||
Dumps memory formatted.
|
||||
|
||||
Dumps the memory as hex bytes with ASCII text to the right
|
||||
|
||||
@param Address The address of the memory to dump.
|
||||
@param Length The length of the region to dump.
|
||||
@param Flags PrintAddress, PrintOffset etc
|
||||
|
||||
**/
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
DebugDumpMemory (
|
||||
IN UINTN ErrorLevel,
|
||||
IN CONST VOID *Address,
|
||||
IN UINTN Length,
|
||||
IN UINT32 Flags
|
||||
)
|
||||
{
|
||||
UINTN Indx;
|
||||
UINT8 *p;
|
||||
CHAR8 Txt[17]; // 16 characters, and a NULL
|
||||
|
||||
p = (UINT8 *)Address;
|
||||
|
||||
Txt[16] = '\0';
|
||||
Indx = 0;
|
||||
while (Indx < Length)
|
||||
{
|
||||
UINTN LoopLen = ((Length - Indx) >= 16) ? 16 : (Length - Indx);
|
||||
if (0 == (Indx % 16)) // first time and every 16 bytes thereafter
|
||||
{
|
||||
if (Flags & DEBUG_DM_PRINT_ADDRESS)
|
||||
{
|
||||
DebugPrint(ErrorLevel, "\n0x%16.16X: ", p);
|
||||
}
|
||||
else if (Flags & DEBUG_DM_PRINT_OFFSET)
|
||||
{
|
||||
DebugPrint(ErrorLevel, "\n0x%8.8X: ", (p - (UINT8 *)Address));
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugPrint(ErrorLevel, "\n");
|
||||
}
|
||||
|
||||
//Get all Ascii Chars if Ascii flag for the next 16 or less
|
||||
if (Flags & DEBUG_DM_PRINT_ASCII)
|
||||
{
|
||||
SetMem(Txt, sizeof(Txt) - 1, ' ');
|
||||
for (UINTN I = (Indx % 16); I < LoopLen; I++)
|
||||
{
|
||||
CHAR8* c = ((CHAR8 *)p) + I;
|
||||
Txt[I] = ((*c >= 0x20) && (*c <= 0x7e)) ? *c : '.';
|
||||
}
|
||||
}
|
||||
} //first pass -- done only at (index % 16 == 0)
|
||||
|
||||
if (LoopLen == 16)
|
||||
{
|
||||
DebugPrint(ErrorLevel, "%02X %02X %02X %02X %02X %02X %02X %02X - ", *(p), *(p + 1), *(p + 2), *(p + 3), *(p + 4), *(p + 5), *(p + 6), *(p + 7));
|
||||
DebugPrint(ErrorLevel, "%02X %02X %02X %02X %02X %02X %02X %02X ", *(p + 8), *(p + 9), *(p + 10), *(p + 11), *(p + 12), *(p + 13), *(p + 14), *(p + 15));
|
||||
Indx += 16;
|
||||
p += 16;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((Indx % 16) == 7)
|
||||
{
|
||||
DebugPrint(ErrorLevel, "%02X - ", *(p));
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugPrint(ErrorLevel, "%02X ", *(p));
|
||||
}
|
||||
Indx++;
|
||||
p++;
|
||||
}
|
||||
|
||||
//end of line and/or end of buffer
|
||||
if (((Indx % 16) == 0) || (Indx == Length))
|
||||
{
|
||||
|
||||
//special case where we need to print out a few blank spaces because our length
|
||||
//was not evenly divisible by 16
|
||||
if (Flags & DEBUG_DM_PRINT_ASCII)
|
||||
{
|
||||
if ((Indx % 16) != 0)
|
||||
{
|
||||
//figure out how many spaces to print
|
||||
CHAR8 empty[48]; //(15 bytes * 3 chars) + 2 (for -) + 1 (\0)
|
||||
UINTN endchar = ((16 - (Indx % 16)) * 3);
|
||||
SetMem(empty, 47, ' ');
|
||||
if ((Indx % 16) <= 8)
|
||||
{
|
||||
endchar += 2;
|
||||
}
|
||||
empty[endchar] = '\0'; //null terminate
|
||||
DebugPrint(ErrorLevel, "%a", empty);
|
||||
}
|
||||
DebugPrint(ErrorLevel, " *%a*", Txt); // print the txt
|
||||
}
|
||||
}
|
||||
} //End while loop
|
||||
DebugPrint(ErrorLevel, "\n");
|
||||
}
|
||||
// END
|
||||
|
||||
/**
|
||||
If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
|
||||
|
|
|
@ -159,7 +159,7 @@ JsonLibEncode (
|
|||
FreePool (RequestBuffer);
|
||||
} else {
|
||||
DEBUG((DEBUG_INFO,"Request Buffer:\n"));
|
||||
DEBUG_BUFFER(DEBUG_INFO, RequestBuffer, RequestSize, (DEBUG_DM_PRINT_OFFSET | DEBUG_DM_PRINT_ASCII));
|
||||
DUMP_HEX(DEBUG_INFO, 0, RequestBuffer, RequestSize, "");
|
||||
*JsonString = RequestBuffer;
|
||||
*JsonStringSize = RequestSize;
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ JsonLibParse (
|
|||
Processed = FALSE;
|
||||
Changed = FALSE;
|
||||
DEBUG((DEBUG_INFO,"Parse buffer @ %p, Size = %d:\n", JsonString, JsonStringSize));
|
||||
DEBUG_BUFFER(DEBUG_INFO, JsonString, JsonStringSize, (DEBUG_DM_PRINT_OFFSET | DEBUG_DM_PRINT_ASCII));
|
||||
DUMP_HEX(DEBUG_INFO, 0, JsonString, JsonStringSize, "");
|
||||
|
||||
Length = AsciiStrnLenS (JsonString, JsonStringSize);
|
||||
if (Length == JsonStringSize) {
|
||||
|
|
|
@ -74,53 +74,6 @@ DebugPrint (
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Dumps memory formatted.
|
||||
|
||||
Dumps the memory as hex bytes. Other additional options
|
||||
are controlled with the Flags parameter.
|
||||
|
||||
|
||||
@param Address The address of the memory to dump.
|
||||
@param Length The length of the region to dump.
|
||||
@param Flags PrintAddress, PrintOffset etc
|
||||
**/
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
DebugDumpMemory (
|
||||
IN UINTN ErrorLevel,
|
||||
IN CONST VOID *Address,
|
||||
IN UINTN Length,
|
||||
IN UINT32 Flags
|
||||
)
|
||||
{
|
||||
DEBUG_PORT_PPI *DebugPortPPI;
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// If Format is NULL, then ASSERT().
|
||||
//
|
||||
ASSERT(Address != NULL);
|
||||
|
||||
//
|
||||
// Check driver Debug Level value and global debug level
|
||||
//
|
||||
if ((ErrorLevel & GetDebugPrintErrorLevel()) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Status = PeiServicesLocatePpi(
|
||||
&gDebugPortPpiGuid,
|
||||
0,
|
||||
NULL,
|
||||
(VOID **)&DebugPortPPI
|
||||
);
|
||||
if (Status == EFI_SUCCESS) {
|
||||
DebugPortPPI->DebugPortDumpMemory(ErrorLevel, Address, Length, Flags);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Prints an assert message containing a filename, line number, and description.
|
||||
This may be followed by a breakpoint or a dead loop.
|
||||
|
|
|
@ -2478,11 +2478,11 @@ UiDisplayMenu (IN FORM_DISPLAY_ENGINE_FORM *FormData) {
|
|||
Tgt = ReturnData.TargetCell;
|
||||
#define EXTENDED_DEBUG 0 // Set to 1 for extra debug
|
||||
#if (EXTENDED_DEBUG)
|
||||
DEBUG((DEBUG_ERROR,"Old Buffer\n"));
|
||||
DebugDumpMemory(DEBUG_ERROR,((CHAR8 *)ValueArray) - 0x18, Statement->CurrentValue.BufferLen + 0x20,DEBUG_DM_PRINT_ASCII);
|
||||
DEBUG((DEBUG_ERROR,"Old Buffer %p\n", ((CHAR8 *)ValueArray) - 0x18));
|
||||
DUMP_HEX(DEBUG_ERROR, 0, ((CHAR8 *)ValueArray) - 0x18, Statement->CurrentValue.BufferLen + 0x20, "");
|
||||
|
||||
DEBUG((DEBUG_ERROR,"New empty Buffer\n"));
|
||||
DebugDumpMemory(DEBUG_ERROR,((CHAR8 *)ReturnValue) - 0x18, Statement->CurrentValue.BufferLen + 0x20,DEBUG_DM_PRINT_ASCII);
|
||||
DEBUG((DEBUG_ERROR,"New empty Buffer %p\n", ((CHAR8 *)ReturnValue) - 0x18));
|
||||
DUMP_HEX(DEBUG_ERROR, 0, ((CHAR8 *)ReturnValue) - 0x18, Statement->CurrentValue.BufferLen + 0x20, "");
|
||||
#endif
|
||||
// An ordered list always returns all of the data, so
|
||||
// move old value to return value honoring the values of
|
||||
|
@ -2526,8 +2526,8 @@ UiDisplayMenu (IN FORM_DISPLAY_ENGINE_FORM *FormData) {
|
|||
break;
|
||||
}
|
||||
#if (EXTENDED_DEBUG)
|
||||
DEBUG((DEBUG_ERROR,"New filled Buffer\n"));
|
||||
DebugDumpMemory(DEBUG_ERROR,((CHAR8 *)ReturnValue) - 0x18, Statement->CurrentValue.BufferLen + 0x20,DEBUG_DM_PRINT_ASCII);
|
||||
DEBUG((DEBUG_ERROR,"New filled Buffer %p\n", ((CHAR8 *)ReturnValue) - 0x18));
|
||||
DUMP_HEX(DEBUG_ERROR, 0, ((CHAR8 *)ReturnValue) - 0x18, Statement->CurrentValue.BufferLen + 0x20, "");
|
||||
#endif
|
||||
if (CompareMem (ReturnValue, ValueArray, Statement->CurrentValue.BufferLen) == 0) {
|
||||
DEBUG ((DEBUG_ERROR, "%a no change detected\n", __FUNCTION__));
|
||||
|
|
|
@ -36,8 +36,8 @@ VOID DumpFontInfo (MS_UI_FONT_DESCRIPTION *Font) {
|
|||
DEBUG((DEBUG_VERBOSE,"Package Size=%d, GlyphsSize=%d\n",
|
||||
Font->PackageSize,
|
||||
Font->GlyphsSize));
|
||||
DebugDumpMemory (DEBUG_VERBOSE,PACKAGE_PTR_GET Font->Package,64,DEBUG_DM_PRINT_ADDRESS);
|
||||
DebugDumpMemory (DEBUG_VERBOSE,PACKAGE_PTR_GET Font->Glyphs,64,DEBUG_DM_PRINT_ADDRESS);
|
||||
DUMP_HEX(DEBUG_VERBOSE, 0, PACKAGE_PTR_GET Font->Package, 64, "");
|
||||
DUMP_HEX(DEBUG_VERBOSE, 0, PACKAGE_PTR_GET Font->Glyphs, 64, "");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -437,7 +437,7 @@ MsUiGetPlatformTheme (VOID) {
|
|||
ASSERT (gPlatformTheme != NULL);
|
||||
if (FirstTime) {
|
||||
|
||||
DebugDumpMemory (DEBUG_VERBOSE, gPlatformTheme, sizeof(MS_UI_THEME_DESCRIPTION),DEBUG_DM_PRINT_ADDRESS | DEBUG_DM_PRINT_ASCII);
|
||||
DUMP_HEX(DEBUG_VERBOSE, 0, gPlatformTheme, sizeof(MS_UI_THEME_DESCRIPTION), "");
|
||||
DEBUG((DEBUG_VERBOSE,__FUNCTION__ " Theme information\n"));
|
||||
DEBUG((DEBUG_VERBOSE,"Scale = %d\n",gPlatformTheme->Scale));
|
||||
DEBUG((DEBUG_VERBOSE,"Fixed Font\n"));
|
||||
|
|
|
@ -66,13 +66,13 @@ MsUiThemePpiEntry(
|
|||
DEBUG((DEBUG_INFO,"MsUiThemePpi started. Table at %p for %d\n",mPlatformTheme,sizeof(MS_UI_THEME_DESCRIPTION)));
|
||||
|
||||
DEBUG((DEBUG_VERBOSE,"Dumping static font table. Table at %p for %d\n",mPlatformTheme,sizeof(MS_UI_THEME_DESCRIPTION)));
|
||||
DebugDumpMemory (DEBUG_VERBOSE, mPlatformTheme, sizeof(MS_UI_THEME_DESCRIPTION),DEBUG_DM_PRINT_ADDRESS | DEBUG_DM_PRINT_ASCII);
|
||||
DebugDumpMemory (DEBUG_VERBOSE, (FONT_PTR_GET mPlatformTheme->FixedFont), sizeof (MS_UI_FONT_DESCRIPTION),DEBUG_DM_PRINT_ADDRESS | DEBUG_DM_PRINT_ASCII);
|
||||
DebugDumpMemory (DEBUG_VERBOSE, PACKAGE_PTR_GET (FONT_PTR_GET mPlatformTheme->FixedFont)->Package, sizeof(MS_UI_FONT_PACKAGE_HEADER),DEBUG_DM_PRINT_ADDRESS | DEBUG_DM_PRINT_ASCII);
|
||||
DebugDumpMemory (DEBUG_VERBOSE, PACKAGE_PTR_GET (FONT_PTR_GET mPlatformTheme->FixedFont)->Glyphs, 256,DEBUG_DM_PRINT_ADDRESS | DEBUG_DM_PRINT_ASCII);
|
||||
DebugDumpMemory (DEBUG_VERBOSE, (FONT_PTR_GET mPlatformTheme->LargeFont), sizeof (MS_UI_FONT_DESCRIPTION),DEBUG_DM_PRINT_ADDRESS | DEBUG_DM_PRINT_ASCII);
|
||||
DebugDumpMemory (DEBUG_VERBOSE, PACKAGE_PTR_GET (FONT_PTR_GET mPlatformTheme->LargeFont)->Package, sizeof(MS_UI_FONT_PACKAGE_HEADER),DEBUG_DM_PRINT_ADDRESS | DEBUG_DM_PRINT_ASCII);
|
||||
DebugDumpMemory (DEBUG_VERBOSE, PACKAGE_PTR_GET (FONT_PTR_GET mPlatformTheme->LargeFont)->Glyphs, 256,DEBUG_DM_PRINT_ADDRESS | DEBUG_DM_PRINT_ASCII);
|
||||
DUMP_HEX (DEBUG_VERBOSE, 0, mPlatformTheme, sizeof(MS_UI_THEME_DESCRIPTION), "");
|
||||
DUMP_HEX (DEBUG_VERBOSE, 0, (FONT_PTR_GET mPlatformTheme->FixedFont), sizeof (MS_UI_FONT_DESCRIPTION), "");
|
||||
DUMP_HEX (DEBUG_VERBOSE, 0, PACKAGE_PTR_GET (FONT_PTR_GET mPlatformTheme->FixedFont)->Package, sizeof(MS_UI_FONT_PACKAGE_HEADER), "");
|
||||
DUMP_HEX (DEBUG_VERBOSE, 0, PACKAGE_PTR_GET (FONT_PTR_GET mPlatformTheme->FixedFont)->Glyphs, 256, "");
|
||||
DUMP_HEX (DEBUG_VERBOSE, 0, (FONT_PTR_GET mPlatformTheme->LargeFont), sizeof (MS_UI_FONT_DESCRIPTION), "");
|
||||
DUMP_HEX (DEBUG_VERBOSE, 0, PACKAGE_PTR_GET (FONT_PTR_GET mPlatformTheme->LargeFont)->Package, sizeof(MS_UI_FONT_PACKAGE_HEADER), "");
|
||||
DUMP_HEX (DEBUG_VERBOSE, 0, PACKAGE_PTR_GET (FONT_PTR_GET mPlatformTheme->LargeFont)->Glyphs, 256, "");
|
||||
|
||||
FontSize = MsThemeGetSize(mPlatformTheme);
|
||||
|
||||
|
@ -87,13 +87,13 @@ MsUiThemePpiEntry(
|
|||
|
||||
DEBUG((DEBUG_VERBOSE,"Font Stats Fp=%p, size=%d\n",NewFonts,FontSize));
|
||||
DEBUG((DEBUG_VERBOSE,"Dumping new font table. Table at %p for %d\n",&mPlatformTheme,sizeof(MS_UI_THEME_DESCRIPTION)));
|
||||
DebugDumpMemory (DEBUG_VERBOSE, NewFonts, sizeof(MS_UI_THEME_DESCRIPTION),DEBUG_DM_PRINT_ADDRESS | DEBUG_DM_PRINT_ASCII);
|
||||
DebugDumpMemory (DEBUG_VERBOSE, (FONT_PTR_GET NewFonts->FixedFont), sizeof (MS_UI_FONT_DESCRIPTION),DEBUG_DM_PRINT_ADDRESS | DEBUG_DM_PRINT_ASCII);
|
||||
DebugDumpMemory (DEBUG_VERBOSE, PACKAGE_PTR_GET (FONT_PTR_GET NewFonts->FixedFont)->Package, sizeof(MS_UI_FONT_PACKAGE_HEADER),DEBUG_DM_PRINT_ADDRESS | DEBUG_DM_PRINT_ASCII);
|
||||
DebugDumpMemory (DEBUG_VERBOSE, PACKAGE_PTR_GET (FONT_PTR_GET NewFonts->FixedFont)->Glyphs, 256,DEBUG_DM_PRINT_ADDRESS | DEBUG_DM_PRINT_ASCII);
|
||||
DebugDumpMemory (DEBUG_VERBOSE, (FONT_PTR_GET NewFonts->LargeFont), sizeof (MS_UI_FONT_DESCRIPTION),DEBUG_DM_PRINT_ADDRESS | DEBUG_DM_PRINT_ASCII);
|
||||
DebugDumpMemory (DEBUG_VERBOSE, PACKAGE_PTR_GET (FONT_PTR_GET NewFonts->LargeFont)->Package, sizeof(MS_UI_FONT_PACKAGE_HEADER),DEBUG_DM_PRINT_ADDRESS | DEBUG_DM_PRINT_ASCII);
|
||||
DebugDumpMemory (DEBUG_VERBOSE, PACKAGE_PTR_GET (FONT_PTR_GET NewFonts->LargeFont)->Glyphs, 256,DEBUG_DM_PRINT_ADDRESS | DEBUG_DM_PRINT_ASCII);
|
||||
DUMP_HEX (DEBUG_VERBOSE, 0, NewFonts, sizeof(MS_UI_THEME_DESCRIPTION), "");
|
||||
DUMP_HEX (DEBUG_VERBOSE, 0, (FONT_PTR_GET NewFonts->FixedFont), sizeof (MS_UI_FONT_DESCRIPTION), "");
|
||||
DUMP_HEX (DEBUG_VERBOSE, 0, PACKAGE_PTR_GET (FONT_PTR_GET NewFonts->FixedFont)->Package, sizeof(MS_UI_FONT_PACKAGE_HEADER), "");
|
||||
DUMP_HEX (DEBUG_VERBOSE, 0, PACKAGE_PTR_GET (FONT_PTR_GET NewFonts->FixedFont)->Glyphs, 256, "");
|
||||
DUMP_HEX (DEBUG_VERBOSE, 0, (FONT_PTR_GET NewFonts->LargeFont), sizeof (MS_UI_FONT_DESCRIPTION), "");
|
||||
DUMP_HEX (DEBUG_VERBOSE, 0, PACKAGE_PTR_GET (FONT_PTR_GET NewFonts->LargeFont)->Package, sizeof(MS_UI_FONT_PACKAGE_HEADER), "");
|
||||
DUMP_HEX (DEBUG_VERBOSE, 0, PACKAGE_PTR_GET (FONT_PTR_GET NewFonts->LargeFont)->Glyphs, 256, "");
|
||||
|
||||
// Create a HoB for passing the PEI font tables up to the DXE MsUiThemeProtocol
|
||||
//
|
||||
|
@ -114,7 +114,7 @@ MsUiThemePpiEntry(
|
|||
*HobData = (EFI_PHYSICAL_ADDRESS) (UINTN) NewFonts;
|
||||
|
||||
DEBUG((DEBUG_VERBOSE,"Font Hob=%p, HobData=%p NewFonts = *HobData = %p\n",GuidHob,HobData,*HobData));
|
||||
DebugDumpMemory (DEBUG_VERBOSE,GuidHob,sizeof(EFI_HOB_GUID_TYPE)+sizeof(UINT64) + 8 ,DEBUG_DM_PRINT_ADDRESS);
|
||||
DUMP_HEX(DEBUG_VERBOSE, 0, GuidHob, sizeof(EFI_HOB_GUID_TYPE)+sizeof(UINT64) + 8, "");
|
||||
|
||||
// Publish the Ppi for MsEarlyGraphics
|
||||
mMsUiThemePpiList.Ppi = NewFonts;
|
||||
|
|
|
@ -200,7 +200,7 @@ BertErrorBlockAddErrorData (
|
|||
return FALSE;
|
||||
}
|
||||
DEBUG((DEBUG_VERBOSE, "%a - %d: Dumping GenericErrorData contents: \n", __FUNCTION__, __LINE__));
|
||||
DEBUG_BUFFER(DEBUG_VERBOSE, GenericErrorData, SizeOfGenericErrorData, DEBUG_DM_PRINT_ADDRESS | DEBUG_DM_PRINT_ASCII);
|
||||
DUMP_HEX(DEBUG_VERBOSE, 0, GenericErrorData, SizeOfGenericErrorData, "");
|
||||
|
||||
// Setup BERT structures
|
||||
BlockHeader = ErrorBlock;
|
||||
|
|
|
@ -767,7 +767,7 @@ PrintMemoryMap () {
|
|||
if (((1 << MemoryMap->Type) & PcdGet32 (PcdEnableMemMapTypes)) != 0) {
|
||||
DEBUG((DEBUG_INFO,"%a at %p for %d pages\n",mMemoryType[MemoryMap->Type],MemoryMap->PhysicalStart,MemoryMap->NumberOfPages));
|
||||
if (PcdGet8 (PcdEnableMemMapDumpOutput)) {
|
||||
DebugDumpMemory (DEBUG_INFO, (CHAR8 *) MemoryMap->PhysicalStart,48,DEBUG_DM_PRINT_ADDRESS | DEBUG_DM_PRINT_ASCII );
|
||||
DUMP_HEX(DEBUG_INFO, 0, (CHAR8 *) MemoryMap->PhysicalStart, 48, "");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
Загрузка…
Ссылка в новой задаче