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.

Add BASE_LIST type to Base.h
Add BAS_ARG() macro to Base.h
Add 4 functions to PrintLib.h that use BASE_LIST.
Change ReportStatsuCodeExtractDebugInfo() from ReportStatusCodeLib.h to take a BASE_LIST argument instead of a VA_LIST argument
Add the 4 new functions to BasePrintLib implementation that use BASE_LIST
Update BaseReportStatusCodeLib implementation of ReportStatsuCodeExtractDebugInfo() to use a BASE_LIST argument instead of a VA_LIST argument



git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8404 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
mdkinney 2009-05-30 23:45:50 +00:00
parent 37e97c51dd
commit 2075236eef
7 changed files with 492 additions and 73 deletions

View File

@ -333,6 +333,15 @@ struct _LIST_ENTRY {
// }
//
/**
Return the size of argument that has been aligned to sizeof (UINTN).
@param n The parameter size is to be aligned.
@return The aligned size
**/
#define _INT_SIZE_OF(n) ((sizeof (n) + sizeof (UINTN) - 1) &~(sizeof (UINTN) - 1))
#if defined(__GNUC__)
//
// Use GCC builtin macros for variable argument lists.
@ -346,15 +355,6 @@ typedef __builtin_va_list VA_LIST;
#define VA_END(Marker) __builtin_va_end (Marker)
#else
/**
Return the size of argument that has been aligned to sizeof (UINTN).
@param n The parameter size is to be aligned.
@return The aligned size
**/
#define _INT_SIZE_OF(n) ((sizeof (n) + sizeof (UINTN) - 1) &~(sizeof (UINTN) - 1))
///
/// Pointer to the start of a variable argument list. Same as CHAR8 *.
///
@ -409,6 +409,29 @@ typedef CHAR8 *VA_LIST;
#endif
///
/// Pointer to the start of a variable argument list stored in a memory buffer. Same as UINT8 *.
///
typedef UINTN *BASE_LIST;
/**
Returns an argument of a specified type from a variable argument list and updates
the pointer to the variable argument list to point to the next argument.
This function returns an argument of the type specified by TYPE from the beginning
of the variable argument list specified by Marker. Marker is then updated to point
to the next argument in the variable argument list. The method for computing the
pointer to the next argument in the argument list is CPU specific following the EFIAPI ABI.
@param Marker Pointer to the beginning of a variable argument list.
@param TYPE The type of argument to retrieve from the beginning
of the variable argument list.
@return An argument of the type specified by TYPE.
**/
#define BASE_ARG(Marker, TYPE) (*(TYPE *)((UINT8 *)(Marker = (BASE_LIST)((UINT8 *)Marker + _INT_SIZE_OF (TYPE))) - _INT_SIZE_OF (TYPE)))
/**
Macro that returns the byte offset of a field in a data structure.

View File

@ -236,6 +236,49 @@ UnicodeVSPrint (
IN VA_LIST Marker
);
/**
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
);
/**
Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
Unicode format string and variable argument list.
@ -321,6 +364,48 @@ UnicodeVSPrintAsciiFormat (
IN VA_LIST Marker
);
/**
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 ASCII 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
);
/**
Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
ASCII format string and variable argument list.
@ -455,6 +540,47 @@ AsciiVSPrint (
IN VA_LIST Marker
);
/**
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 ASCII 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
);
/**
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
ASCII format string and variable argument list.
@ -539,6 +665,48 @@ AsciiVSPrintUnicodeFormat (
IN VA_LIST Marker
);
/**
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
Unicode 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
);
/**
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
Unicode format string and variable argument list.

View File

@ -135,7 +135,7 @@ EFIAPI
ReportStatusCodeExtractDebugInfo (
IN CONST EFI_STATUS_CODE_DATA *Data,
OUT UINT32 *ErrorLevel,
OUT VA_LIST *Marker,
OUT BASE_LIST *Marker,
OUT CHAR8 **Format
);

View File

@ -59,9 +59,57 @@ UnicodeVSPrint (
IN VA_LIST Marker
)
{
ASSERT_UNICODE_BUFFER(StartOfBuffer);
ASSERT_UNICODE_BUFFER(FormatString);
return BasePrintLibVSPrint ((CHAR8 *)StartOfBuffer, BufferSize >> 1, FORMAT_UNICODE | OUTPUT_UNICODE, (CHAR8 *)FormatString, Marker);
ASSERT_UNICODE_BUFFER (StartOfBuffer);
ASSERT_UNICODE_BUFFER (FormatString);
return BasePrintLibSPrintMarker ((CHAR8 *)StartOfBuffer, BufferSize >> 1, FORMAT_UNICODE | OUTPUT_UNICODE, (CHAR8 *)FormatString, Marker, NULL);
}
/**
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
)
{
ASSERT_UNICODE_BUFFER (StartOfBuffer);
ASSERT_UNICODE_BUFFER (FormatString);
return BasePrintLibSPrintMarker ((CHAR8 *)StartOfBuffer, BufferSize >> 1, FORMAT_UNICODE | OUTPUT_UNICODE, (CHAR8 *)FormatString, NULL, Marker);
}
/**
@ -155,8 +203,54 @@ UnicodeVSPrintAsciiFormat (
IN VA_LIST Marker
)
{
ASSERT_UNICODE_BUFFER(StartOfBuffer);
return BasePrintLibVSPrint ((CHAR8 *)StartOfBuffer, BufferSize >> 1, OUTPUT_UNICODE,FormatString, Marker);
ASSERT_UNICODE_BUFFER (StartOfBuffer);
return BasePrintLibSPrintMarker ((CHAR8 *)StartOfBuffer, BufferSize >> 1, OUTPUT_UNICODE, FormatString, Marker, NULL);
}
/**
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 ASCII 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
)
{
ASSERT_UNICODE_BUFFER (StartOfBuffer);
return BasePrintLibSPrintMarker ((CHAR8 *)StartOfBuffer, BufferSize >> 1, OUTPUT_UNICODE, FormatString, NULL, Marker);
}
/**
@ -303,7 +397,51 @@ AsciiVSPrint (
IN VA_LIST Marker
)
{
return BasePrintLibVSPrint (StartOfBuffer, BufferSize, 0, FormatString, Marker);
return BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, 0, FormatString, Marker, NULL);
}
/**
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 ASCII 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 BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, 0, FormatString, NULL, Marker);
}
/**
@ -397,7 +535,53 @@ AsciiVSPrintUnicodeFormat (
)
{
ASSERT_UNICODE_BUFFER (FormatString);
return BasePrintLibVSPrint (StartOfBuffer, BufferSize, FORMAT_UNICODE, (CHAR8 *)FormatString, Marker);
return BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, FORMAT_UNICODE, (CHAR8 *)FormatString, Marker, NULL);
}
/**
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
Unicode 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
)
{
ASSERT_UNICODE_BUFFER (FormatString);
return BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, FORMAT_UNICODE, (CHAR8 *)FormatString, NULL, Marker);
}
/**
@ -501,4 +685,3 @@ AsciiValueToString (
{
return BasePrintLibConvertValueToString (Buffer, Flags, Value, Width, 1);
}

View File

@ -275,52 +275,54 @@ BasePrintLibConvertValueToString (
VA_LIST is used this routine allows the nesting of Vararg routines. Thus
this is the main print working routine.
@param Buffer Character buffer to print the results of the parsing
of Format into.
@param BufferSize Maximum number of characters to put into buffer.
@param Flags Initial flags value.
Can only have FORMAT_UNICODE and OUTPUT_UNICODE set.
@param Format Null-terminated format string.
@param Marker Vararg list consumed by processing Format.
@param Buffer Character buffer to print the results of the parsing
of Format into.
@param BufferSize Maximum number of characters to put into buffer.
@param Flags Initial flags value.
Can only have FORMAT_UNICODE and OUTPUT_UNICODE set.
@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.
@return Number of characters printed not including the Null-terminator.
**/
UINTN
BasePrintLibVSPrint (
BasePrintLibSPrintMarker (
OUT CHAR8 *Buffer,
IN UINTN BufferSize,
IN UINTN Flags,
IN CONST CHAR8 *Format,
IN VA_LIST Marker
IN VA_LIST VaListMarker, OPTIONAL
IN BASE_LIST BaseListMarker OPTIONAL
)
{
CHAR8 *OriginalBuffer;
CHAR8 *EndBuffer;
CHAR8 ValueBuffer[MAXIMUM_VALUE_CHARACTERS];
UINTN BytesPerOutputCharacter;
UINTN BytesPerFormatCharacter;
UINTN FormatMask;
UINTN FormatCharacter;
UINTN Width;
UINTN Precision;
INT64 Value;
CONST CHAR8 *ArgumentString;
UINTN Character;
GUID *TmpGuid;
TIME *TmpTime;
UINTN Count;
UINTN ArgumentMask;
INTN BytesPerArgumentCharacter;
UINTN ArgumentCharacter;
BOOLEAN Done;
UINTN Index;
CHAR8 Prefix;
BOOLEAN ZeroPad;
BOOLEAN Comma;
UINTN Digits;
UINTN Radix;
RETURN_STATUS Status;
CHAR8 *OriginalBuffer;
CHAR8 *EndBuffer;
CHAR8 ValueBuffer[MAXIMUM_VALUE_CHARACTERS];
UINTN BytesPerOutputCharacter;
UINTN BytesPerFormatCharacter;
UINTN FormatMask;
UINTN FormatCharacter;
UINTN Width;
UINTN Precision;
INT64 Value;
CONST CHAR8 *ArgumentString;
UINTN Character;
GUID *TmpGuid;
TIME *TmpTime;
UINTN Count;
UINTN ArgumentMask;
INTN BytesPerArgumentCharacter;
UINTN ArgumentCharacter;
BOOLEAN Done;
UINTN Index;
CHAR8 Prefix;
BOOLEAN ZeroPad;
BOOLEAN Comma;
UINTN Digits;
UINTN Radix;
RETURN_STATUS Status;
if (BufferSize == 0) {
return 0;
@ -338,6 +340,7 @@ BasePrintLibVSPrint (
//
BufferSize--;
OriginalBuffer = Buffer;
//
// Set the tag for the end of the input Buffer.
//
@ -417,9 +420,17 @@ BasePrintLibVSPrint (
case '*':
if ((Flags & PRECISION) == 0) {
Flags |= PAD_TO_WIDTH;
Width = VA_ARG (Marker, UINTN);
if (BaseListMarker == NULL) {
Width = VA_ARG (VaListMarker, UINTN);
} else {
Width = BASE_ARG (BaseListMarker, UINTN);
}
} else {
Precision = VA_ARG (Marker, UINTN);
if (BaseListMarker == NULL) {
Precision = VA_ARG (VaListMarker, UINTN);
} else {
Precision = BASE_ARG (BaseListMarker, UINTN);
}
}
break;
case '0':
@ -497,9 +508,17 @@ BasePrintLibVSPrint (
// provides an implementation that is compatible with that largest possible set of CPU
// architectures. This is why the type "int" is used in this one case.
//
Value = (VA_ARG (Marker, int));
if (BaseListMarker == NULL) {
Value = VA_ARG (VaListMarker, int);
} else {
Value = BASE_ARG (BaseListMarker, int);
}
} else {
Value = VA_ARG (Marker, INT64);
if (BaseListMarker == NULL) {
Value = VA_ARG (VaListMarker, INT64);
} else {
Value = BASE_ARG (BaseListMarker, INT64);
}
}
if ((Flags & PREFIX_BLANK) != 0) {
Prefix = ' ';
@ -576,7 +595,11 @@ BasePrintLibVSPrint (
// break skipped on purpose
//
case 'a':
ArgumentString = (CHAR8 *)VA_ARG (Marker, CHAR8 *);
if (BaseListMarker == NULL) {
ArgumentString = VA_ARG (VaListMarker, CHAR8 *);
} else {
ArgumentString = BASE_ARG (BaseListMarker, CHAR8 *);
}
if (ArgumentString == NULL) {
Flags &= (~ARGUMENT_UNICODE);
ArgumentString = "<null string>";
@ -590,13 +613,21 @@ BasePrintLibVSPrint (
break;
case 'c':
Character = VA_ARG (Marker, UINTN) & 0xffff;
if (BaseListMarker == NULL) {
Character = VA_ARG (VaListMarker, UINTN) & 0xffff;
} else {
Character = BASE_ARG (BaseListMarker, UINTN) & 0xffff;
}
ArgumentString = (CHAR8 *)&Character;
Flags |= ARGUMENT_UNICODE;
break;
case 'g':
TmpGuid = VA_ARG (Marker, GUID *);
if (BaseListMarker == NULL) {
TmpGuid = VA_ARG (VaListMarker, GUID *);
} else {
TmpGuid = BASE_ARG (BaseListMarker, GUID *);
}
if (TmpGuid == NULL) {
ArgumentString = "<null guid>";
} else {
@ -622,7 +653,11 @@ BasePrintLibVSPrint (
break;
case 't':
TmpTime = VA_ARG (Marker, TIME *);
if (BaseListMarker == NULL) {
TmpTime = VA_ARG (VaListMarker, TIME *);
} else {
TmpTime = BASE_ARG (BaseListMarker, TIME *);
}
if (TmpTime == NULL) {
ArgumentString = "<null time>";
} else {
@ -642,7 +677,11 @@ BasePrintLibVSPrint (
break;
case 'r':
Status = VA_ARG (Marker, RETURN_STATUS);
if (BaseListMarker == NULL) {
Status = VA_ARG (VaListMarker, RETURN_STATUS);
} else {
Status = BASE_ARG (BaseListMarker, RETURN_STATUS);
}
ArgumentString = ValueBuffer;
if (RETURN_ERROR (Status)) {
//
@ -833,5 +872,5 @@ BasePrintLibSPrint (
VA_LIST Marker;
VA_START (Marker, FormatString);
return BasePrintLibVSPrint (StartOfBuffer, BufferSize, Flags, FormatString, Marker);
return BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, Flags, FormatString, Marker, NULL);
}

View File

@ -59,24 +59,26 @@ typedef struct {
VA_LIST is used this routine allows the nesting of Vararg routines. Thus
this is the main print working routine.
@param Buffer Character buffer to print the results of the parsing
of Format into.
@param BufferSize Maximum number of characters to put into buffer.
@param Flags Initial flags value.
Can only have FORMAT_UNICODE and OUTPUT_UNICODE set.
@param Format Null-terminated format string.
@param Marker Vararg list consumed by processing Format.
@param Buffer Character buffer to print the results of the parsing
of Format into.
@param BufferSize Maximum number of characters to put into buffer.
@param Flags Initial flags value.
Can only have FORMAT_UNICODE and OUTPUT_UNICODE set.
@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.
@return Number of characters printed not including the Null-terminator.
**/
UINTN
BasePrintLibVSPrint (
BasePrintLibSPrintMarker (
OUT CHAR8 *Buffer,
IN UINTN BufferSize,
IN UINTN Flags,
IN CONST CHAR8 *Format,
IN VA_LIST Marker
IN VA_LIST VaListMarker, OPTIONAL
IN BASE_LIST BaseListMarker OPTIONAL
);
/**

View File

@ -133,10 +133,14 @@ EFIAPI
ReportStatusCodeExtractDebugInfo (
IN CONST EFI_STATUS_CODE_DATA *Data,
OUT UINT32 *ErrorLevel,
OUT VA_LIST *Marker,
OUT BASE_LIST *Marker,
OUT CHAR8 **Format
)
{
ASSERT (Data != NULL);
ASSERT (ErrorLevel != NULL);
ASSERT (StartOfBuffer != NULL);
return FALSE;
}