MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / LogPrint

Function LogPrint

Protocols/DumpUefiCalls/Log.c:35–105  ·  view source on GitHub ↗

Prints log messages to outputs defined by PRINT_TO_* defs in Common.h. */

Source from the content-addressed store, hash-verified

33
34/** Prints log messages to outputs defined by PRINT_TO_* defs in Common.h. */
35VOID
36EFIAPI
37LogPrint(CHAR8 *Format, ...)
38{
39 VA_LIST Marker;
40 UINTN DataWritten;
41
42 if (gLogLineBuffer == NULL) {
43 gLogLineBuffer = AllocateRuntimePool(LOG_LINE_BUFFER_SIZE);
44 if (gLogLineBuffer == NULL) {
45 return;
46 }
47 *gLogLineBuffer='\0';
48 }
49
50 // Safety check to avoid some cases where LogPrint may be run recursively
51 if (*gLogLineBuffer != '\0') {
52 return;
53 }
54 *gLogLineBuffer = '!'; // Make buffer "dirty" to indicate we are using it
55
56 //
57 // Print log to buffer
58 //
59 VA_START (Marker, Format);
60 DataWritten = AsciiVSPrint(
61 gLogLineBuffer,
62 LOG_LINE_BUFFER_SIZE,
63 Format,
64 Marker);
65 VA_END (Marker);
66
67 if (DataWritten > 0) {
68 //
69 // Dispatch to various loggers
70 //
71 #if LOG_TO_SCREEN == 1
72 #if CAPTURE_CONSOLE_OUTPUT >= 1
73 // Print to screen only if not invoked from our OutputString() override
74 if (InBootServices && !InConsolePrint) {
75 InConsolePrint = TRUE;
76 AsciiPrint(gLogLineBuffer);
77 InConsolePrint = FALSE;
78 }
79 #else
80 if (InBootServices) {
81 AsciiPrint(gLogLineBuffer);
82 }
83 #endif
84 #endif
85
86 #if LOG_TO_SERIAL >= 1
87 #if (CAPTURE_CONSOLE_OUTPUT >= 1) && (LOG_TO_SERIAL == 1)
88 // Print to serial only if not invoked from our OutputString() override
89 if (!InBootServices || !InConsolePrint) {
90 DebugPrint(1, gLogLineBuffer);
91 }
92 #else

Callers

nothing calls this directly

Calls 4

AsciiPrintFunction · 0.85
MemLogPrintFunction · 0.85
AsciiVSPrintFunction · 0.50
DebugPrintFunction · 0.50

Tested by

no test coverage detected