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:
@@ -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.
|
||||
|
||||
|
@@ -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.
|
||||
|
@@ -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
|
||||
);
|
||||
|
||||
|
Reference in New Issue
Block a user