summaryrefslogtreecommitdiff
path: root/EdkCompatibilityPkg/Foundation/Library/Dxe/Print
diff options
context:
space:
mode:
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2008-07-23 07:07:07 +0000
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2008-07-23 07:07:07 +0000
commit0f77dfb62292f27e1bf07427ae4e885401a96352 (patch)
tree280937306c1567279828b9e1eb0702aedc16d13c /EdkCompatibilityPkg/Foundation/Library/Dxe/Print
parent34a0bac4750ad7b18d72e67fbfb670bb892796af (diff)
downloadedk2-platforms-0f77dfb62292f27e1bf07427ae4e885401a96352.tar.xz
Enhance the string formatting function to take "%p" to print pointer.
'p' - arugment is VOID *; printed as hex number Example is : ASPrint (Buffer, 1024, "This is a %p\n", SystemTable); ASPrint (Buffer, 1024, "This is a %10p\n", SystemTable); git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5554 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkCompatibilityPkg/Foundation/Library/Dxe/Print')
-rw-r--r--EdkCompatibilityPkg/Foundation/Library/Dxe/Print/Print.c22
1 files changed, 22 insertions, 0 deletions
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;