diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/Graphics/Print.c b/EdkCompatibilityPkg/Foundation/Library/Dxe/Graphics/Print.c index 4e0980a1fc..2ed4eeca23 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Dxe/Graphics/Print.c +++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/Graphics/Print.c @@ -573,6 +573,27 @@ Returns: // Format = GetFlagsAndWidth (Format, &Flags, &Width, &Marker); switch (*Format) { + case 'p': + // + // Flag space, +, 0, L & l are invalid for type p. + // + Flags &= ~(PREFIX_BLANK| PREFIX_SIGN | LONG_TYPE); + if (sizeof (VOID *) > 4) { + Flags |= LONG_TYPE; + Value = VA_ARG (Marker, UINT64); + } else { + Value = VA_ARG (Marker, UINTN); + } + Flags |= PREFIX_ZERO; + + EfiValueToHexStr (TempBuffer, Value, Flags, Width); + UnicodeStr = TempBuffer; + + for ( ;(*UnicodeStr != '\0') && (Index < NumberOfCharacters - 1); UnicodeStr++) { + Buffer[Index++] = *UnicodeStr; + } + break; + case 'X': Flags |= PREFIX_ZERO; Width = sizeof (UINT64) * 2; diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/Print/Print.c b/EdkCompatibilityPkg/Foundation/Library/Dxe/Print/Print.c index b4f9a740ce..f72cac41ca 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Dxe/Print/Print.c +++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/Print/Print.c @@ -39,6 +39,7 @@ Abstract: Decimal number that represents width of print type: + 'p' - arugment is VOID *; printed as hex number 'X' - argument is a UINTN hex number, prefix '0' 'x' - argument is a hex number 'd' - argument is a decimal number @@ -206,6 +207,27 @@ Returns: // Format = GetFlagsAndWidth (Format, &Flags, &Width, &Marker); switch (*Format) { + case 'p': + // + // Flag space, +, 0, L & l are invalid for type p. + // + Flags &= ~(PREFIX_BLANK| PREFIX_SIGN | LONG_TYPE); + if (sizeof (VOID *) > 4) { + Flags |= LONG_TYPE; + Value = VA_ARG (Marker, UINT64); + } else { + Value = VA_ARG (Marker, UINTN); + } + Flags |= PREFIX_ZERO; + + EfiValueToHexStr (TempBuffer, Value, Flags, Width); + UnicodeStr = TempBuffer; + + for ( ;(*UnicodeStr != '\0') && (Index < NumberOfCharacters - 1); UnicodeStr++) { + Buffer[Index++] = *UnicodeStr; + } + break; + case 'X': Flags |= PREFIX_ZERO; Width = sizeof (UINT64) * 2; diff --git a/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/Print/Print.c b/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/Print/Print.c index 458bb9ce4a..c35b830b51 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/Print/Print.c +++ b/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/Print/Print.c @@ -39,6 +39,7 @@ Abstract: Decimal number that represents width of print type: + 'p' - arugment is VOID *; printed as hex number 'X' - argument is a UINTN hex number, prefix '0' 'x' - argument is a hex number 'd' - argument is a decimal number @@ -220,6 +221,26 @@ Returns: // Format = GetFlagsAndWidth (Format, &Flags, &Width, &Marker); switch (*Format) { + case 'p': + // + // Flag space, +, 0, L & l are invalid for type p. + // + Flags &= ~(PREFIX_BLANK| PREFIX_SIGN | LONG_TYPE); + if (sizeof (VOID *) > 4) { + Flags |= LONG_TYPE; + Value = VA_ARG (Marker, UINT64); + } else { + Value = VA_ARG (Marker, UINTN); + } + Flags |= PREFIX_ZERO; + + ValueTomHexStr (TempBuffer, Value, Flags, Width); + AsciiStr = TempBuffer; + + for (; (*AsciiStr != '\0') && (Index < BufferSize - 1); AsciiStr++) { + Buffer[Index++] = *AsciiStr; + } + break; case 'X': Flags |= PREFIX_ZERO; Width = sizeof (UINT64) * 2;