mirror of
https://github.com/acidanthera/OpenCorePkg.git
synced 2025-12-08 19:25:01 +00:00
OcDebugLogLib: Fix hex logging issues
This commit is contained in:
parent
598a106c22
commit
a7fc06ddce
@ -18,7 +18,7 @@
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Protocol/OcLog.h>
|
||||
|
||||
#define OC_HEX_LOWER(x) "0123456789ABCDEF"[(UINT32) (x) >> 4U]
|
||||
#define OC_HEX_LOWER(x) "0123456789ABCDEF"[((UINT32) (x) & 0x0FU)]
|
||||
#define OC_HEX_UPPER(x) "0123456789ABCDEF"[((UINT32) (x) & 0xF0U) >> 4U]
|
||||
|
||||
/**
|
||||
|
||||
@ -49,6 +49,7 @@ DebugPrintHexDump (
|
||||
UINTN Index;
|
||||
UINTN Index2;
|
||||
UINTN Count;
|
||||
UINTN SizeLeft;
|
||||
UINTN MaxPerLine;
|
||||
CHAR8 *HexLine;
|
||||
CHAR8 *HexLineCurrent;
|
||||
@ -61,17 +62,19 @@ DebugPrintHexDump (
|
||||
return;
|
||||
}
|
||||
|
||||
SizeLeft = Size;
|
||||
|
||||
for (Index = 0; Index < Count; ++Index) {
|
||||
HexLineCurrent = HexLine;
|
||||
|
||||
for (Index2 = 0; Size > 0 && Index2 < MaxPerLine; ++Index) {
|
||||
for (Index2 = 0; SizeLeft > 0 && Index2 < MaxPerLine; ++Index2) {
|
||||
if (Index2 > 0) {
|
||||
*HexLineCurrent++ = ' ';
|
||||
}
|
||||
|
||||
*HexLineCurrent++ = OC_HEX_UPPER (*Bytes);
|
||||
*HexLineCurrent++ = OC_HEX_LOWER (*Bytes);
|
||||
--Size;
|
||||
--SizeLeft;
|
||||
++Bytes;
|
||||
}
|
||||
|
||||
@ -80,6 +83,7 @@ DebugPrintHexDump (
|
||||
DEBUG ((
|
||||
ErrorLevel,
|
||||
"%a (%u/%u %u) - %a\n",
|
||||
Message,
|
||||
(UINT32) Index + 1,
|
||||
(UINT32) Count,
|
||||
(UINT32) Size,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user