diff options
author | mdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-05-30 23:49:35 +0000 |
---|---|---|
committer | mdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-05-30 23:49:35 +0000 |
commit | 504dcb0a4e04dd76db230cc55c4f95f7a911d127 (patch) | |
tree | a69b849656d6d5ef1ba907c423f735af562f5ed7 | |
parent | 2075236eefe532097caa04aa2606e2b7cda4e420 (diff) | |
download | edk2-504dcb0a4e04dd76db230cc55c4f95f7a911d127.tar.gz edk2-504dcb0a4e04dd76db230cc55c4f95f7a911d127.tar.bz2 edk2-504dcb0a4e04dd76db230cc55c4f95f7a911d127.zip |
This checkin addresses the compatibility issue of passing arguments of type VA_LIST between components. The type VA_LIST is mapped onto the compiler specific implementation of varargs. As a result, modules build with different compilers may not use the same VA_LIST structure. The solution to this issue is to define a new type called BASE_LIST that is a compiler independent method of passing varargs between modules.
1) Update the Print2 Protocol to only use arguments of type BASE_LIST. Since this is a change to the protocol definition, the GUID has also been updated.
2) Update the implementation of DxePrintLibPrint2Protocol for the update definition of the Print2 Protocol. Since the PrintLib does contain APIs that use VA_LIST, this library must convert arguments of type VA_LIST to arguments of type BASE_LIST prior to calling the Print2 Protocol services.
3) Update the implementation of PrintDxe to match the updated Print2 Prootocol
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8405 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r-- | MdeModulePkg/Include/Protocol/Print2.h | 54 | ||||
-rw-r--r-- | MdeModulePkg/Library/DxePrintLibPrint2Protocol/DxePrintLibPrint2Protocol.inf | 1 | ||||
-rw-r--r-- | MdeModulePkg/Library/DxePrintLibPrint2Protocol/PrintLib.c | 393 | ||||
-rw-r--r-- | MdeModulePkg/MdeModulePkg.dec | 4 | ||||
-rw-r--r-- | MdeModulePkg/Universal/PrintDxe/Print.c | 9 |
5 files changed, 423 insertions, 38 deletions
diff --git a/MdeModulePkg/Include/Protocol/Print2.h b/MdeModulePkg/Include/Protocol/Print2.h index 30c01dc499..ac544f1c76 100644 --- a/MdeModulePkg/Include/Protocol/Print2.h +++ b/MdeModulePkg/Include/Protocol/Print2.h @@ -18,7 +18,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #define __PPRINT2_H__
#define EFI_PRINT2_PROTOCOL_GUID \
- { 0x5bcc3dbc, 0x8c57, 0x450a, { 0xbb, 0xc, 0xa1, 0xc0, 0xbd, 0xde, 0x48, 0xc } }
+ { 0xf05976ef, 0x83f1, 0x4f3d, { 0x86, 0x19, 0xf7, 0x59, 0x5d, 0x41, 0xe5, 0x38 } }
//
// Forward reference for pure ANSI compatability
@@ -27,7 +27,7 @@ typedef struct _EFI_PRINT2_PROTOCOL EFI_PRINT2_PROTOCOL; /**
Produces a Null-terminated Unicode string in an output buffer based on
- a Null-terminated Unicode format string and a VA_LIST argument list
+ a Null-terminated Unicode format string and a BASE_LIST argument list
Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
and BufferSize.
@@ -53,7 +53,7 @@ typedef struct _EFI_PRINT2_PROTOCOL EFI_PRINT2_PROTOCOL; Unicode string.
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
@param FormatString Null-terminated Unicode format string.
- @param Marker VA_LIST marker for the variable argument list.
+ @param Marker BASE_LIST marker for the variable argument list.
@return The number of Unicode characters in the produced output buffer not including the
Null-terminator.
@@ -61,11 +61,11 @@ typedef struct _EFI_PRINT2_PROTOCOL EFI_PRINT2_PROTOCOL; **/
typedef
UINTN
-(EFIAPI *UNICODE_VS_PRINT) (
+(EFIAPI *UNICODE_BS_PRINT) (
OUT CHAR16 *StartOfBuffer,
IN UINTN BufferSize,
IN CONST CHAR16 *FormatString,
- IN VA_LIST Marker
+ IN BASE_LIST Marker
);
/**
@@ -113,7 +113,7 @@ UINTN /**
Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
- ASCII format string and a VA_LIST argument list
+ ASCII format string and a BASE_LIST argument list
Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
and BufferSize.
@@ -138,7 +138,7 @@ UINTN Unicode string.
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
@param FormatString Null-terminated ASCII format string.
- @param Marker VA_LIST marker for the variable argument list.
+ @param Marker BASE_LIST marker for the variable argument list.
@return The number of Unicode characters in the produced output buffer not including the
Null-terminator.
@@ -146,11 +146,11 @@ UINTN **/
typedef
UINTN
-(EFIAPI *UNICODE_VS_PRINT_ASCII_FORMAT) (
+(EFIAPI *UNICODE_BS_PRINT_ASCII_FORMAT) (
OUT CHAR16 *StartOfBuffer,
IN UINTN BufferSize,
IN CONST CHAR8 *FormatString,
- IN VA_LIST Marker
+ IN BASE_LIST Marker
);
/**
@@ -248,7 +248,7 @@ UINTN /**
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
- ASCII format string and a VA_LIST argument list.
+ ASCII format string and a BASE_LIST argument list.
Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
and BufferSize.
@@ -272,7 +272,7 @@ UINTN ASCII string.
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
@param FormatString Null-terminated ASCII format string.
- @param Marker VA_LIST marker for the variable argument list.
+ @param Marker BASE_LIST marker for the variable argument list.
@return The number of ASCII characters in the produced output buffer not including the
Null-terminator.
@@ -280,11 +280,11 @@ UINTN **/
typedef
UINTN
-(EFIAPI *ASCII_VS_PRINT) (
+(EFIAPI *ASCII_BS_PRINT) (
OUT CHAR8 *StartOfBuffer,
IN UINTN BufferSize,
IN CONST CHAR8 *FormatString,
- IN VA_LIST Marker
+ IN BASE_LIST Marker
);
/**
@@ -331,7 +331,7 @@ UINTN /**
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
- Unicode format string and a VA_LIST argument list.
+ Unicode format string and a BASE_LIST argument list.
Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
and BufferSize.
@@ -356,7 +356,7 @@ UINTN ASCII string.
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
@param FormatString Null-terminated Unicode format string.
- @param Marker VA_LIST marker for the variable argument list.
+ @param Marker BASE_LIST marker for the variable argument list.
@return The number of ASCII characters in the produced output buffer not including the
Null-terminator.
@@ -364,11 +364,11 @@ UINTN **/
typedef
UINTN
-(EFIAPI *ASCII_VS_PRINT_UNICODE_FORMAT) (
+(EFIAPI *ASCII_BS_PRINT_UNICODE_FORMAT) (
OUT CHAR8 *StartOfBuffer,
IN UINTN BufferSize,
IN CONST CHAR16 *FormatString,
- IN VA_LIST Marker
+ IN BASE_LIST Marker
);
/**
@@ -464,16 +464,16 @@ UINTN );
struct _EFI_PRINT2_PROTOCOL {
- UNICODE_VS_PRINT UnicodeVSPrint;
- UNICODE_S_PRINT UnicodeSPrint;
- UNICODE_VS_PRINT_ASCII_FORMAT UnicodeVSPrintAsciiFormat;
- UNICODE_S_PRINT_ASCII_FORMAT UnicodeSPrintAsciiFormat;
- UNICODE_VALUE_TO_STRING UnicodeValueToString;
- ASCII_VS_PRINT AsciiVSPrint;
- ASCII_S_PRINT AsciiSPrint;
- ASCII_VS_PRINT_UNICODE_FORMAT AsciiVSPrintUnicodeFormat;
- ASCII_S_PRINT_UNICODE_FORMAT AsciiSPrintUnicodeFormat;
- ASCII_VALUE_TO_STRING AsciiValueToString;
+ UNICODE_BS_PRINT UnicodeBSPrint;
+ UNICODE_S_PRINT UnicodeSPrint;
+ UNICODE_BS_PRINT_ASCII_FORMAT UnicodeBSPrintAsciiFormat;
+ UNICODE_S_PRINT_ASCII_FORMAT UnicodeSPrintAsciiFormat;
+ UNICODE_VALUE_TO_STRING UnicodeValueToString;
+ ASCII_BS_PRINT AsciiBSPrint;
+ ASCII_S_PRINT AsciiSPrint;
+ ASCII_BS_PRINT_UNICODE_FORMAT AsciiBSPrintUnicodeFormat;
+ ASCII_S_PRINT_UNICODE_FORMAT AsciiSPrintUnicodeFormat;
+ ASCII_VALUE_TO_STRING AsciiValueToString;
};
extern EFI_GUID gEfiPrint2ProtocolGuid;
diff --git a/MdeModulePkg/Library/DxePrintLibPrint2Protocol/DxePrintLibPrint2Protocol.inf b/MdeModulePkg/Library/DxePrintLibPrint2Protocol/DxePrintLibPrint2Protocol.inf index 6f5d6e3e36..20c482c601 100644 --- a/MdeModulePkg/Library/DxePrintLibPrint2Protocol/DxePrintLibPrint2Protocol.inf +++ b/MdeModulePkg/Library/DxePrintLibPrint2Protocol/DxePrintLibPrint2Protocol.inf @@ -40,6 +40,7 @@ [LibraryClasses]
+ BaseLib
UefiBootServicesTableLib
DebugLib
diff --git a/MdeModulePkg/Library/DxePrintLibPrint2Protocol/PrintLib.c b/MdeModulePkg/Library/DxePrintLibPrint2Protocol/PrintLib.c index 3923f956cb..d22d4d5566 100644 --- a/MdeModulePkg/Library/DxePrintLibPrint2Protocol/PrintLib.c +++ b/MdeModulePkg/Library/DxePrintLibPrint2Protocol/PrintLib.c @@ -18,7 +18,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/
#include <Uefi.h>
+
#include <Protocol/Print2.h>
+
+#include <Library/PrintLib.h>
+
+#include <Library/BaseLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/DebugLib.h>
@@ -58,6 +63,166 @@ PrintLibConstructor ( /**
+ Worker function that converts a VA_LIST to a BASE_LIST based on a Null-terminated
+ format string.
+
+ @param AsciiFormat TRUE if Format is an ASCII string. FALSE if Format is a Unicode string.
+ @param Format Null-terminated format string.
+ @param VaListMarker VA_LIST style variable argument list consumed by processing Format.
+ @param BaseListMarker BASE_LIST style variable argument list consumed by processing Format.
+ @param Size The size, in bytes, of the BaseListMarker buffer.
+
+ @return The number of bytes in BaseListMarker. 0 if BaseListMarker is too small.
+
+**/
+BOOLEAN
+DxePrintLibPrint2ProtocolVaListToBaseList (
+ IN BOOLEAN AsciiFormat,
+ IN CONST CHAR8 *Format,
+ IN VA_LIST VaListMarker,
+ OUT BASE_LIST BaseListMarker,
+ IN UINTN Size
+ )
+{
+ BASE_LIST BaseListStart;
+ UINTN BytesPerFormatCharacter;
+ UINTN FormatMask;
+ UINTN FormatCharacter;
+ BOOLEAN Long;
+ BOOLEAN Done;
+
+ ASSERT (Format != NULL);
+ ASSERT (VaListMarker != NULL);
+ ASSERT (BaseListMarker != NULL);
+
+ BaseListStart = BaseListMarker;
+
+ if (AsciiFormat) {
+ ASSERT (AsciiStrSize (Format) != 0);
+ BytesPerFormatCharacter = 1;
+ FormatMask = 0xff;
+ } else {
+ ASSERT (StrSize ((CHAR16 *) Format) != 0);
+ BytesPerFormatCharacter = 2;
+ FormatMask = 0xffff;
+ }
+
+ //
+ // Get the first character from the format string
+ //
+ FormatCharacter = ((*Format & 0xff) | (*(Format + 1) << 8)) & FormatMask;
+
+ while (FormatCharacter != 0) {
+ if (FormatCharacter == '%') {
+ Long = FALSE;
+
+ //
+ // Parse Flags and Width
+ //
+ for (Done = FALSE; !Done; ) {
+ //
+ // Get the next character from the format string
+ //
+ Format += BytesPerFormatCharacter;
+
+ //
+ // Get the next character from the format string
+ //
+ FormatCharacter = ((*Format & 0xff) | (*(Format + 1) << 8)) & FormatMask;
+
+ switch (FormatCharacter) {
+ case '.':
+ case '-':
+ case '+':
+ case ' ':
+ case ',':
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ break;
+ case 'L':
+ case 'l':
+ Long = TRUE;
+ break;
+ case '*':
+ BASE_ARG (BaseListMarker, UINTN) = VA_ARG (VaListMarker, UINTN);
+ break;
+ case '\0':
+ //
+ // Make no output if Format string terminates unexpectedly when
+ // looking up for flag, width, precision and type.
+ //
+ Format -= BytesPerFormatCharacter;
+ //
+ // break skipped on purpose.
+ //
+ default:
+ Done = TRUE;
+ break;
+ }
+ }
+
+ //
+ // Handle each argument type
+ //
+ switch (FormatCharacter) {
+ case 'p':
+ if (sizeof (VOID *) > 4) {
+ Long = TRUE;
+ }
+ case 'X':
+ case 'x':
+ case 'd':
+ if (Long) {
+ BASE_ARG (BaseListMarker, INT64) = VA_ARG (VaListMarker, INT64);
+ } else {
+ BASE_ARG (BaseListMarker, int) = VA_ARG (VaListMarker, int);
+ }
+ break;
+ case 's':
+ case 'S':
+ case 'a':
+ case 'g':
+ case 't':
+ BASE_ARG (BaseListMarker, VOID *) = VA_ARG (VaListMarker, VOID *);
+ break;
+ case 'c':
+ BASE_ARG (BaseListMarker, UINTN) = VA_ARG (VaListMarker, UINTN);
+ break;
+ case 'r':
+ BASE_ARG (BaseListMarker, RETURN_STATUS) = VA_ARG (VaListMarker, RETURN_STATUS);
+ break;
+ }
+ }
+
+ //
+ // If BASE_LIST is larger than Size, then return FALSE
+ //
+ if ((UINTN)((UINT8 *)BaseListMarker - (UINT8 *)BaseListStart) > Size) {
+ return FALSE;
+ }
+
+ //
+ // Get the next character from the format string
+ //
+ Format += BytesPerFormatCharacter;
+
+ //
+ // Get the next character from the format string
+ //
+ FormatCharacter = ((*Format & 0xff) | (*(Format + 1) << 8)) & FormatMask;
+ }
+ return TRUE;
+}
+
+/**
Produces a Null-terminated Unicode string in an output buffer based on
a Null-terminated Unicode format string and a VA_LIST argument list
@@ -100,7 +265,63 @@ UnicodeVSPrint ( IN VA_LIST Marker
)
{
- return mPrint2Protocol->UnicodeVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);
+ UINT8 BaseListMarker[256];
+
+ DxePrintLibPrint2ProtocolVaListToBaseList (
+ FALSE,
+ (CHAR8 *)FormatString,
+ Marker,
+ (BASE_LIST)BaseListMarker,
+ sizeof (BaseListMarker) - 8
+ );
+
+ return UnicodeBSPrint (StartOfBuffer, BufferSize, FormatString, (BASE_LIST)BaseListMarker);
+}
+
+/**
+ Produces a Null-terminated Unicode string in an output buffer based on
+ a Null-terminated Unicode format string and a BASE_LIST argument list
+
+ Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
+ and BufferSize.
+ The Unicode string is produced by parsing the format string specified by FormatString.
+ Arguments are pulled from the variable argument list specified by Marker based on the
+ contents of the format string.
+ The number of Unicode characters in the produced output buffer is returned not including
+ the Null-terminator.
+ If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
+
+ If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
+ If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
+ If BufferSize > 1 and FormatString is NULL, then ASSERT().
+ If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
+ If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
+ PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
+ ASSERT().
+ If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
+ contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
+ Null-terminator, then ASSERT().
+
+ @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
+ Unicode string.
+ @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
+ @param FormatString Null-terminated Unicode format string.
+ @param Marker BASE_LIST marker for the variable argument list.
+
+ @return The number of Unicode characters in the produced output buffer not including the
+ Null-terminator.
+
+**/
+UINTN
+EFIAPI
+UnicodeBSPrint (
+ OUT CHAR16 *StartOfBuffer,
+ IN UINTN BufferSize,
+ IN CONST CHAR16 *FormatString,
+ IN BASE_LIST Marker
+ )
+{
+ return mPrint2Protocol->UnicodeBSPrint (StartOfBuffer, BufferSize, FormatString, Marker);
}
/**
@@ -194,7 +415,62 @@ UnicodeVSPrintAsciiFormat ( IN VA_LIST Marker
)
{
- return mPrint2Protocol->UnicodeSPrintAsciiFormat (StartOfBuffer, BufferSize, FormatString, Marker);
+ UINT8 BaseListMarker[256];
+
+ DxePrintLibPrint2ProtocolVaListToBaseList (
+ TRUE,
+ FormatString,
+ Marker,
+ (BASE_LIST)BaseListMarker,
+ sizeof (BaseListMarker) - 8
+ );
+
+ return UnicodeBSPrintAsciiFormat (StartOfBuffer, BufferSize, FormatString, (BASE_LIST)BaseListMarker);
+}
+
+/**
+ Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
+ ASCII format string and a BASE_LIST argument list
+
+ Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
+ and BufferSize.
+ The Unicode string is produced by parsing the format string specified by FormatString.
+ Arguments are pulled from the variable argument list specified by Marker based on the
+ contents of the format string.
+ The number of Unicode characters in the produced output buffer is returned not including
+ the Null-terminator.
+ If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
+
+ If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
+ If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
+ If BufferSize > 1 and FormatString is NULL, then ASSERT().
+ If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
+ PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
+ ASSERT().
+ If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
+ contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
+ Null-terminator, then ASSERT().
+
+ @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
+ Unicode string.
+ @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
+ @param FormatString Null-terminated Unicode format string.
+ @param Marker BASE_LIST marker for the variable argument list.
+
+ @return The number of Unicode characters in the produced output buffer not including the
+ Null-terminator.
+
+**/
+UINTN
+EFIAPI
+UnicodeBSPrintAsciiFormat (
+ OUT CHAR16 *StartOfBuffer,
+ IN UINTN BufferSize,
+ IN CONST CHAR8 *FormatString,
+ IN BASE_LIST Marker
+ )
+{
+ return mPrint2Protocol->UnicodeBSPrintAsciiFormat (StartOfBuffer, BufferSize, FormatString, Marker);
}
/**
@@ -340,7 +616,61 @@ AsciiVSPrint ( IN VA_LIST Marker
)
{
- return mPrint2Protocol->AsciiVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);
+ UINT8 BaseListMarker[256];
+
+ DxePrintLibPrint2ProtocolVaListToBaseList (
+ TRUE,
+ FormatString,
+ Marker,
+ (BASE_LIST)BaseListMarker,
+ sizeof (BaseListMarker) - 8
+ );
+
+ return AsciiBSPrint (StartOfBuffer, BufferSize, FormatString, (BASE_LIST)BaseListMarker);
+}
+
+/**
+ Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
+ ASCII format string and a BASE_LIST argument list.
+
+ Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
+ and BufferSize.
+ The ASCII string is produced by parsing the format string specified by FormatString.
+ Arguments are pulled from the variable argument list specified by Marker based on
+ the contents of the format string.
+ The number of ASCII characters in the produced output buffer is returned not including
+ the Null-terminator.
+ If BufferSize is 0, then no output buffer is produced and 0 is returned.
+
+ If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
+ If BufferSize > 0 and FormatString is NULL, then ASSERT().
+ If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
+ PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
+ ASSERT().
+ If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
+ contains more than PcdMaximumAsciiStringLength ASCII characters not including the
+ Null-terminator, then ASSERT().
+
+ @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
+ ASCII string.
+ @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
+ @param FormatString Null-terminated Unicode format string.
+ @param Marker BASE_LIST marker for the variable argument list.
+
+ @return The number of ASCII characters in the produced output buffer not including the
+ Null-terminator.
+
+**/
+UINTN
+EFIAPI
+AsciiBSPrint (
+ OUT CHAR8 *StartOfBuffer,
+ IN UINTN BufferSize,
+ IN CONST CHAR8 *FormatString,
+ IN BASE_LIST Marker
+ )
+{
+ return mPrint2Protocol->AsciiBSPrint (StartOfBuffer, BufferSize, FormatString, Marker);
}
/**
@@ -433,7 +763,62 @@ AsciiVSPrintUnicodeFormat ( IN VA_LIST Marker
)
{
- return mPrint2Protocol->AsciiVSPrintUnicodeFormat (StartOfBuffer, BufferSize, FormatString, Marker);
+ UINT8 BaseListMarker[256];
+
+ DxePrintLibPrint2ProtocolVaListToBaseList (
+ FALSE,
+ (CHAR8 *)FormatString,
+ Marker,
+ (BASE_LIST)BaseListMarker,
+ sizeof (BaseListMarker) - 8
+ );
+
+ return AsciiBSPrintUnicodeFormat (StartOfBuffer, BufferSize, FormatString, (BASE_LIST)BaseListMarker);
+}
+
+/**
+ Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
+ ASCII format string and a BASE_LIST argument list.
+
+ Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
+ and BufferSize.
+ The ASCII string is produced by parsing the format string specified by FormatString.
+ Arguments are pulled from the variable argument list specified by Marker based on
+ the contents of the format string.
+ The number of ASCII characters in the produced output buffer is returned not including
+ the Null-terminator.
+ If BufferSize is 0, then no output buffer is produced and 0 is returned.
+
+ If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
+ If BufferSize > 0 and FormatString is NULL, then ASSERT().
+ If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
+ If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
+ PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
+ ASSERT().
+ If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
+ contains more than PcdMaximumAsciiStringLength ASCII characters not including the
+ Null-terminator, then ASSERT().
+
+ @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
+ ASCII string.
+ @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
+ @param FormatString Null-terminated Unicode format string.
+ @param Marker BASE_LIST marker for the variable argument list.
+
+ @return The number of ASCII characters in the produced output buffer not including the
+ Null-terminator.
+
+**/
+UINTN
+EFIAPI
+AsciiBSPrintUnicodeFormat (
+ OUT CHAR8 *StartOfBuffer,
+ IN UINTN BufferSize,
+ IN CONST CHAR16 *FormatString,
+ IN BASE_LIST Marker
+ )
+{
+ return mPrint2Protocol->AsciiBSPrintUnicodeFormat (StartOfBuffer, BufferSize, FormatString, Marker);
}
/**
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index d4905a8c9a..0c8de2b5ca 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -131,9 +131,9 @@ ## If developer need implement such functionality, they should use BasePeCoffLib.
gEfiLoadPeImageProtocolGuid = { 0x5CB5C776, 0x60D5, 0x45EE, { 0x88, 0x3C, 0x45, 0x27, 0x08, 0xCD, 0x74, 0x3F }}
- ## Print protocol defines six basic print functions to print the format unicode and ascii string.
+ ## Print protocol defines basic print functions to print the format unicode and ascii string.
## Include/Protocol/Print2.h
- gEfiPrint2ProtocolGuid = { 0x5bcc3dbc, 0x8c57, 0x450a, { 0xbb, 0x0c, 0xa1, 0xc0, 0xbd, 0xde, 0x48, 0x0c }}
+ gEfiPrint2ProtocolGuid = { 0xf05976ef, 0x83f1, 0x4f3d, { 0x86, 0x19, 0xf7, 0x59, 0x5d, 0x41, 0xe5, 0x38 } }
## This protocol defines the generic memory test interfaces in Dxe phase.
## Include/Protocol/GenericMemoryTest.h
diff --git a/MdeModulePkg/Universal/PrintDxe/Print.c b/MdeModulePkg/Universal/PrintDxe/Print.c index 2a617b917e..b97b1de84a 100644 --- a/MdeModulePkg/Universal/PrintDxe/Print.c +++ b/MdeModulePkg/Universal/PrintDxe/Print.c @@ -23,19 +23,18 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. EFI_HANDLE mPrintThunkHandle = NULL;
CONST EFI_PRINT2_PROTOCOL mPrint2Protocol = {
- UnicodeVSPrint,
+ UnicodeBSPrint,
UnicodeSPrint,
- UnicodeVSPrintAsciiFormat,
+ UnicodeBSPrintAsciiFormat,
UnicodeSPrintAsciiFormat,
UnicodeValueToString,
- AsciiVSPrint,
+ AsciiBSPrint,
AsciiSPrint,
- AsciiVSPrintUnicodeFormat,
+ AsciiBSPrintUnicodeFormat,
AsciiSPrintUnicodeFormat,
AsciiValueToString
};
-
/**
The user Entry Point for Print module.
|