X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdePkg%2FLibrary%2FUefiDebugLibConOut%2FDebugLib.c;h=80931256ed307f991c8d405c38d38ecf153a1dba;hp=ebe00c7f359684066b374bc1ff93d27630798e0d;hb=19388d2960b2fe0347da23799e93ccc52f540214;hpb=c7d265a94a3ee2517430e4f19f5b24482e5e7132 diff --git a/MdePkg/Library/UefiDebugLibConOut/DebugLib.c b/MdePkg/Library/UefiDebugLibConOut/DebugLib.c index ebe00c7f35..80931256ed 100644 --- a/MdePkg/Library/UefiDebugLibConOut/DebugLib.c +++ b/MdePkg/Library/UefiDebugLibConOut/DebugLib.c @@ -1,8 +1,8 @@ /** @file - UEFI Debug Library that uses PrintLib to send messages to CONOUT. + UEFI Debug Library that sends messages to the Console Output Device in the EFI System Table. - Copyright (c) 2006 - 2007, Intel Corporation
- All rights reserved. This program and the accompanying materials + Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
+ This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php @@ -12,16 +12,8 @@ **/ -// -// The package level header files this module uses -// #include -// -// The protocols, PPI and GUID defintions for this module -// -// -// The Library classes this module consumes -// + #include #include #include @@ -29,15 +21,12 @@ #include #include - // // Define the maximum debug and assert message length that this library supports // #define MAX_DEBUG_MESSAGE_LENGTH 0x100 - /** - Prints a debug message to the debug output device if the specified error level is enabled. If any bit in ErrorLevel is also set in PcdDebugPrintErrorLevel, then print @@ -48,6 +37,8 @@ @param ErrorLevel The error level of the debug message. @param Format Format string for the debug message to print. + @param ... Variable argument list whose contents are accessed + based on the format string specified by Format. **/ VOID @@ -77,9 +68,10 @@ DebugPrint ( // Convert the DEBUG() message to a Unicode String // VA_START (Marker, Format); - UnicodeVSPrintAsciiFormat (Buffer, sizeof (Buffer), Format, Marker); + UnicodeVSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH, Format, Marker); VA_END (Marker); + // // Send the print string to the Console Output device // @@ -90,21 +82,19 @@ DebugPrint ( /** - Prints an assert message containing a filename, line number, and description. This may be followed by a breakpoint or a dead loop. - Print a message of the form "ASSERT (): \n" + Print a message of the form "ASSERT (): \n" to the debug output device. If DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED bit of PcdDebugProperyMask is set then CpuBreakpoint() is called. Otherwise, if DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED bit of PcdDebugProperyMask is set then CpuDeadLoop() is called. If neither of these bits are set, then this function returns immediately after the message is printed to the debug output device. - DebugAssert() must actively prevent recusrsion. If DebugAssert() is called while + DebugAssert() must actively prevent recursion. If DebugAssert() is called while processing another DebugAssert(), then DebugAssert() must return immediately. If FileName is NULL, then a string of "(NULL) Filename" is printed. - If Description is NULL, then a string of "(NULL) Description" is printed. @param FileName Pointer to the name of the source file that generated the assert condition. @@ -125,8 +115,15 @@ DebugAssert ( // // Generate the ASSERT() message in Unicode format // - UnicodeSPrintAsciiFormat (Buffer, sizeof (Buffer), "ASSERT %s(%d): %s\n", FileName, LineNumber, Description); - + UnicodeSPrintAsciiFormat ( + Buffer, + MAX_DEBUG_MESSAGE_LENGTH, + "ASSERT %a(%d): %a\n", + FileName, + LineNumber, + Description + ); + // // Send the print string to the Console Output device // @@ -146,20 +143,18 @@ DebugAssert ( /** - Fills a target buffer with PcdDebugClearMemoryValue, and returns the target buffer. This function fills Length bytes of Buffer with the value specified by PcdDebugClearMemoryValue, and returns Buffer. If Buffer is NULL, then ASSERT(). + If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). - If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). - - @param Buffer Pointer to the target buffer to fill with PcdDebugClearMemoryValue. + @param Buffer Pointer to the target buffer to be filled with PcdDebugClearMemoryValue. @param Length Number of bytes in Buffer to fill with zeros PcdDebugClearMemoryValue. - @return Buffer + @return Buffer Pointer to the target buffer filled with PcdDebugClearMemoryValue. **/ VOID * @@ -182,7 +177,6 @@ DebugClearMemory ( /** - Returns TRUE if ASSERT() macros are enabled. This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of @@ -202,9 +196,8 @@ DebugAssertEnabled ( } -/** - - Returns TRUE if DEBUG()macros are enabled. +/** + Returns TRUE if DEBUG() macros are enabled. This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set. Otherwise FALSE is returned. @@ -223,9 +216,8 @@ DebugPrintEnabled ( } -/** - - Returns TRUE if DEBUG_CODE()macros are enabled. +/** + Returns TRUE if DEBUG_CODE() macros are enabled. This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set. Otherwise FALSE is returned. @@ -244,15 +236,14 @@ DebugCodeEnabled ( } -/** - - Returns TRUE if DEBUG_CLEAR_MEMORY()macro is enabled. +/** + Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled. - This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of + This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set. Otherwise FALSE is returned. - @retval TRUE The DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set. - @retval FALSE The DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear. + @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set. + @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear. **/ BOOLEAN