提交 da6ac942 编写于 作者: V vit9696

OcDebugLogLib: Implement OcPrintScreen

上级 e011d903
......@@ -36,4 +36,18 @@ OcConfigureLogProtocol (
IN UINTN HaltLevel
);
/**
Prints via gST->ConOut without any pool allocations.
Otherwise equivalent to Print.
Note: EFIAPI must be present for VA_ARGS forwarding (causes bugs with gcc).
@param[in] Format Formatted string.
**/
VOID
EFIAPI
OcPrintScreen (
IN CONST CHAR16 *Format,
...
);
#endif // OC_DEBUG_LOG_LIB_H
......@@ -18,7 +18,11 @@
#include <Uefi.h>
#include <Library/OcStringLib.h>
// Base64Decode
/**
Convert seconds to microseconds for use in e.g. gBS->Stall.
**/
#define SECONDS_TO_MICROSECONDS(x) ((x)*1000000)
/**
TODO: edk2 now has its implementation in BaseLib, review it and use once it appears in UDK.
......
......@@ -267,3 +267,34 @@ DebugPrintLevelEnabled (
{
return (BOOLEAN) ((ErrorLevel & PcdGet32 (PcdFixedDebugPrintErrorLevel)) != 0);
}
/**
Prints via gST->ConOut without any pool allocations.
Otherwise equivalent to Print.
Note: EFIAPI must be present for VA_ARGS forwarding (causes bugs with gcc).
@param[in] Format Formatted string.
**/
VOID
EFIAPI
OcPrintScreen (
IN CONST CHAR16 *Format,
...
)
{
CHAR16 Buffer[1024];
VA_LIST Marker;
VA_START (Marker, Format);
UnicodeVSPrint (Buffer, sizeof (Buffer), Format, Marker);
VA_END (Marker);
//
// It is safe to call gST->ConOut->OutputString, because in crtitical areas
// AptioMemoryFix is responsible for overriding gBS->AllocatePool with its own
// implementation that uses a custom allocator.
//
if (gST->ConOut) {
gST->ConOut->OutputString (gST->ConOut, Buffer);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册