- EarlyPrint -> EfiPrintf, as it seems BL actually has this after all :) Change all callers to conform to it.
- Add common exit/failure path in BmMain. Now the fun begins.
svn path=/trunk/; revision=69103
/* FUNCTIONS *****************************************************************/
-/* HACKKKYYY */
-EFI_SYSTEM_TABLE* g_SystemTable;
-
-VOID
-EarlyPrint(_In_ PWCHAR Format, ...)
-{
- WCHAR buffer[1024];
- va_list args;
-
- va_start(args, Format);
-
- vswprintf(buffer, Format, args);
-
- g_SystemTable->ConOut->OutputString(g_SystemTable->ConOut, L"\r");
- g_SystemTable->ConOut->OutputString(g_SystemTable->ConOut, buffer);
-
- g_SystemTable->BootServices->Stall(200000);
-
- va_end(args);
-}
-/* END HACKKKYYY */
-
/*++
* @name InitializeLibrary
*
LibraryParameters);
if (!NT_SUCCESS(Status))
{
- EarlyPrint(L"MM init failed!\n");
+ EfiPrintf(L"MM init failed!\r\n");
goto Quickie;
}
{
/* Destroy memory manager in phase 1 */
//BlpMmDestroy(1);
- EarlyPrint(L"Firmware2 init failed!\n");
+ EfiPrintf(L"Firmware2 init failed!\r\n");
return Status;
}
if (!NT_SUCCESS(Status))
{
/* Destroy memory manager in phase 1 */
- EarlyPrint(L"TSC calibration failed\n");
+ EfiPrintf(L"TSC calibration failed\r\n");
//BlpMmDestroy(1);
return Status;
}
if (!NT_SUCCESS(Status))
{
/* Destroy memory manager in phase 1 */
- EarlyPrint(L"Arch2 init failed\n");
+ EfiPrintf(L"Arch2 init failed\r\n");
//BlpMmDestroy(1);
return Status;
}
if (!NT_SUCCESS(Status))
{
/* Destroy memory manager in phase 1 and the event manager */
- EarlyPrint(L"IO init failed\n");
+ EfiPrintf(L"IO init failed\r\n");
#ifdef BL_TPM_SUPPORT
if (EnSubsystemInitialized)
{
}
#endif
//BlpMmDestroy(1);
- EarlyPrint(L"Util init failed\n");
+ EfiPrintf(L"Util init failed\r\n");
return Status;
}
return Status;
}
+VOID
+BlDestroyLibrary (
+ VOID
+ )
+{
+ EfiPrintf(L"Destroy not yet implemented\r\n");
+ return;
+}
EFI_GUID EfiDevicePathProtocol = EFI_DEVICE_PATH_PROTOCOL_GUID;
EFI_GUID EfiSimpleTextInputExProtocol = EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID;
+WCHAR BlScratchBuffer[8192];
+
/* FUNCTIONS *****************************************************************/
+VOID
+EfiPrintf (
+ _In_ PWCHAR Format,
+ ...
+ )
+{
+ va_list args;
+ va_start(args, Format);
+
+ /* Capture the buffer in our scratch pad, and NULL-terminate */
+ vsnwprintf(BlScratchBuffer, RTL_NUMBER_OF(BlScratchBuffer) - 1, Format, args);
+ BlScratchBuffer[RTL_NUMBER_OF(BlScratchBuffer) - 1] = UNICODE_NULL;
+
+ /* Check which mode we're in */
+ if (CurrentExecutionContext->Mode == BlRealMode)
+ {
+ /* Call EFI directly */
+ EfiConOut->OutputString(EfiConOut, BlScratchBuffer);
+ }
+ else
+ {
+ /* FIXME: @TODO: Not yet supported */
+ }
+
+ /* All done */
+ va_end(args);
+}
+
NTSTATUS
EfiOpenProtocol (
_In_ EFI_HANDLE Handle,
if ((ModeChanged) && (NT_SUCCESS(Status)))
{
/* FIXME @TODO: Should be BlStatusPrint */
- EarlyPrint(L"Console video mode set to 0x%x\r\n", Mode);
+ EfiPrintf(L"Console video mode set to 0x%x\r\r\n", Mode);
}
/* Convert the error to an NTSTATUS */
return EfiGetNtStatusCode(EfiStatus);
}
+VOID
+EfiResetSystem (
+ _In_ EFI_RESET_TYPE ResetType
+ )
+{
+ BL_ARCH_MODE OldMode;
+
+ /* Are we in protected mode? */
+ OldMode = CurrentExecutionContext->Mode;
+ if (OldMode != BlRealMode)
+ {
+ /* FIXME: Not yet implemented */
+ return;
+ }
+
+ /* Call the EFI runtime */
+ EfiRT->ResetSystem(ResetType, EFI_SUCCESS, 0, NULL);
+}
+
NTSTATUS
EfiAllocatePages (
_In_ ULONG Type,
if (Status != STATUS_BUFFER_TOO_SMALL)
{
/* This should've failed because our buffer was too small, nothing else */
- EarlyPrint(L"Got strange EFI status for memory map: %lx\n", Status);
+ EfiPrintf(L"Got strange EFI status for memory map: %lx\r\n", Status);
if (NT_SUCCESS(Status))
{
Status = STATUS_UNSUCCESSFUL;
/* Add 4 more descriptors just in case things changed */
EfiMemoryMapSize += (4 * DescriptorSize);
Pages = BYTES_TO_PAGES(EfiMemoryMapSize);
- EarlyPrint(L"Memory map size: %lx bytes, %d pages\n", EfiMemoryMapSize, Pages);
+ EfiPrintf(L"Memory map size: %lx bytes, %d pages\r\n", EfiMemoryMapSize, Pages);
/* Should we use EFI to grab memory? */
if (UseEfiBuffer)
&EfiBuffer);
if (!NT_SUCCESS(Status))
{
- EarlyPrint(L"EFI allocation failed: %lx\n", Status);
+ EfiPrintf(L"EFI allocation failed: %lx\r\n", Status);
goto Quickie;
}
/* So far so good? */
if (!NT_SUCCESS(Status))
{
- EarlyPrint(L"Failed to get EFI memory map: %lx\n", Status);
+ EfiPrintf(L"Failed to get EFI memory map: %lx\r\n", Status);
goto Quickie;
}
if (((EfiMemoryMapSize % DescriptorSize)) ||
(DescriptorSize < sizeof(EFI_MEMORY_DESCRIPTOR)))
{
- EarlyPrint(L"Incorrect descriptor size\n");
+ EfiPrintf(L"Incorrect descriptor size\r\n");
Status = STATUS_UNSUCCESSFUL;
goto Quickie;
}
(BlpBootDevice->Local.Type == RamDiskDevice))
{
/* We don't handle this yet */
- EarlyPrint(L"RAM boot not supported\n");
+ EfiPrintf(L"RAM boot not supported\r\n");
Status = STATUS_NOT_IMPLEMENTED;
goto Quickie;
}
/* Loop the EFI memory map */
#if 0
- EarlyPrint(L"UEFI MEMORY MAP\n\n");
- EarlyPrint(L"TYPE START END ATTRIBUTES\n");
- EarlyPrint(L"===============================================================\n");
+ EfiPrintf(L"UEFI MEMORY MAP\n\r\n");
+ EfiPrintf(L"TYPE START END ATTRIBUTES\r\n");
+ EfiPrintf(L"===============================================================\r\n");
#endif
while (EfiMemoryMapSize != 0)
{
goto LoopAgain;
}
#if 0
- EarlyPrint(L"%08X 0x%016I64X-0x%016I64X 0x%I64X\n",
+ EfiPrintf(L"%08X 0x%016I64X-0x%016I64X 0x%I64X\r\n",
MemoryType,
StartPage << PAGE_SHIFT,
EndPage << PAGE_SHIFT,
BL_MM_ADD_DESCRIPTOR_TRUNCATE_FLAG);
if (!NT_SUCCESS(Status))
{
- EarlyPrint(L"Failed to add zero page descriptor: %lx\n", Status);
+ EfiPrintf(L"Failed to add zero page descriptor: %lx\r\n", Status);
break;
}
BL_MM_ADD_DESCRIPTOR_TRUNCATE_FLAG);
if (!NT_SUCCESS(Status))
{
- EarlyPrint(L"Failed to add 1MB descriptor: %lx\n", Status);
+ EfiPrintf(L"Failed to add 1MB descriptor: %lx\r\n", Status);
break;
}
if (HaveRamDisk)
{
/* We don't handle this yet */
- EarlyPrint(L"RAM boot not supported\n");
+ EfiPrintf(L"RAM boot not supported\r\n");
Status = STATUS_NOT_IMPLEMENTED;
goto Quickie;
}
BL_MM_ADD_DESCRIPTOR_COALESCE_FLAG : 0);
if (!NT_SUCCESS(Status))
{
- EarlyPrint(L"Failed to add full descriptor: %lx\n", Status);
+ EfiPrintf(L"Failed to add full descriptor: %lx\r\n", Status);
break;
}
VOID
)
{
- //EarlyPrint(L"Disabling graphics\n");
+ //EarlyPrint(L"Disabling graphics\r\n");
return FALSE;
}
/* Display re-initialization not yet handled */
if (LibraryParameters.LibraryFlags & BL_LIBRARY_FLAG_REINITIALIZE_ALL)
{
- EarlyPrint(L"Display path not handled\n");
+ EfiPrintf(L"Display path not handled\r\n");
return STATUS_NOT_SUPPORTED;
}
if (NT_SUCCESS(Status))
{
ConsoleGraphicalResolutionListFlags |= BL_DISPLAY_GRAPHICS_FORCED_VIDEO_MODE_FLAG;
- EarlyPrint(L"Display selection not yet handled\n");
+ EfiPrintf(L"Display selection not yet handled\r\n");
return STATUS_NOT_IMPLEMENTED;
}
if (NT_SUCCESS(Status))
{
ConsoleGraphicalResolutionListFlags |= BL_DISPLAY_GRAPHICS_FORCED_HIGH_RES_MODE_FLAG;
- EarlyPrint(L"High res mode not yet handled\n");
+ EfiPrintf(L"High res mode not yet handled\r\n");
return STATUS_NOT_IMPLEMENTED;
}
Status = ConsoleGraphicalConstruct(GraphicsConsole);
if (!NT_SUCCESS(Status))
{
- EarlyPrint(L"GFX FAILED: %lx\n", Status);
+ EfiPrintf(L"GFX FAILED: %lx\r\n", Status);
BlMmFreeHeap(GraphicsConsole);
GraphicsConsole = NULL;
}
/* Are we using something else than the default mode? */
if (DisplayMode != &ConsoleGraphicalResolutionList[0])
{
- EarlyPrint(L"Display path not handled\n");
+ EfiPrintf(L"Display path not handled\r\n");
return STATUS_NOT_SUPPORTED;
}
}
/* We have a remote console -- have to figure out how to use it*/
- EarlyPrint(L"Display path not handled\n");
+ EfiPrintf(L"Display path not handled\r\n");
return STATUS_NOT_SUPPORTED;
}
if (DspGraphicalConsole)
{
/* Yep -- query it */
- EarlyPrint(L"Not supported\n");
+ EfiPrintf(L"Not supported\r\n");
Status = STATUS_NOT_IMPLEMENTED;
}
}
(PVOID*)&GopProtocol);
if (!NT_SUCCESS(Status))
{
- EarlyPrint(L"GOP OPEN failed: %lx\n", Status);
+ EfiPrintf(L"GOP OPEN failed: %lx\r\n", Status);
return STATUS_NOT_SUPPORTED;
}
Status = EfiGopGetCurrentMode(GopProtocol, &CurrentMode, &ModeInformation);
if (!NT_SUCCESS(Status))
{
- EarlyPrint(L"GOP mode failed: %lx\n", Status);
+ EfiPrintf(L"GOP mode failed: %lx\r\n", Status);
goto Quickie;
}
Quickie:
/* We failed, close the protocol and return the failure code */
- EarlyPrint(L"Get format failed: %lx\n", Status);
+ EfiPrintf(L"Get format failed: %lx\r\n", Status);
EfiCloseProtocol(GraphicsConsole->Handle, &EfiGraphicsOutputProtocol);
return Status;
}
if (!NT_SUCCESS(Status))
{
/* Nothing supports this (no video card?) */
- EarlyPrint(L"Status: %lx Count: %d\n", Status, HandleCount);
+ EfiPrintf(L"Status: %lx Count: %d\r\n", Status, HandleCount);
return STATUS_UNSUCCESSFUL;
}
}
/* Scan all the EFI modes */
- EarlyPrint(L"Scanning through %d modes\n", MaxMode);
+ EfiPrintf(L"Scanning through %d modes\r\n", MaxMode);
for (MaxQueriedMode = 0, Mode = 0; Mode < MaxMode; Mode++)
{
/* Query information on this mode */
&VRes)))
{
/* This mode was succesfully queried. Save the data */
- EarlyPrint(L"EFI Firmware Supported Mode %d is H: %d V: %d\n", Mode, HRes, VRes);
+ EfiPrintf(L"EFI Firmware Supported Mode %d is H: %d V: %d\r\n", Mode, HRes, VRes);
ModeEntry->HRes = HRes;
ModeEntry->VRes = VRes;
ModeEntry->HRes2 = HRes;
{
/* Check if the UEFI mode is compatible with our supported mode */
ModeEntry = &ModeList[MatchingMode];
- EarlyPrint(L"H1: %d V1: %d - H2: %d - V2: %d\n", ModeEntry->HRes, ModeEntry->VRes, SupportedModeEntry->HRes, SupportedModeEntry->VRes);
+ EfiPrintf(L"H1: %d V1: %d - H2: %d - V2: %d\r\n", ModeEntry->HRes, ModeEntry->VRes, SupportedModeEntry->HRes, SupportedModeEntry->VRes);
if ((ModeEntry->HRes == SupportedModeEntry->HRes) &&
(ModeEntry->VRes == SupportedModeEntry->VRes))
{
if (!ConsolepFindResolution(&DisplayMode, ConsoleTextResolutionList, 1))
{
/* It isn't -- find a matching EFI mode for what we need */
- EarlyPrint(L"In incorrect mode, scanning for right one\n");
+ EfiPrintf(L"In incorrect mode, scanning for right one\r\n");
Status = ConsoleEfiTextFindModeFromAllowed(EfiConOut,
ConsoleTextResolutionList,
1,
&Mode);
if (!NT_SUCCESS(Status))
{
- EarlyPrint(L"Failed to find mode: %lx\n", Status);
+ EfiPrintf(L"Failed to find mode: %lx\r\n", Status);
return Status;
}
/* Set the new EFI mode */
- EarlyPrint(L"Setting new mode: %d\n", Mode);
+ EfiPrintf(L"Setting new mode: %d\r\n", Mode);
Status = EfiConOutSetMode(EfiConOut, Mode);
if (!NT_SUCCESS(Status))
{
_In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
)
{
- EarlyPrint(L"UGA not implemented\n");
+ EfiPrintf(L"UGA not implemented\r\n");
return STATUS_NOT_IMPLEMENTED;
}
Status = ConsoleTextLocalConstruct(&GraphicsConsole->TextConsole, FALSE);
if (!NT_SUCCESS(Status))
{
- EarlyPrint(L"Text failed: %lx\n", Status);
+ EfiPrintf(L"Text failed: %lx\r\n", Status);
return Status;
}
if (!NT_SUCCESS(Status))
{
/* That failed, try an older EFI 1.02 UGA console */
- EarlyPrint(L"GOP open failed!\n", Status);
+ EfiPrintf(L"GOP open failed!\r\n", Status);
Status = ConsoleEfiGraphicalOpenProtocol(GraphicsConsole, BlUgaConsole);
if (!NT_SUCCESS(Status))
{
/* That failed too, give up */
- EarlyPrint(L"UGA failed!\n", Status);
+ EfiPrintf(L"UGA failed!\r\n", Status);
ConsoleTextLocalDestruct(&GraphicsConsole->TextConsole);
return STATUS_UNSUCCESSFUL;
}
if (!NT_SUCCESS(Status))
{
/* Failed to enable it, undo everything */
- EarlyPrint(L"Enable failed\n");
+ EfiPrintf(L"Enable failed\r\n");
ConsoleFirmwareGraphicalClose(GraphicsConsole);
ConsoleTextLocalDestruct(&GraphicsConsole->TextConsole);
return STATUS_UNSUCCESSFUL;
Status = ConsoleFirmwareTextOpen(TextConsole);
if (!NT_SUCCESS(Status))
{
- EarlyPrint(L"Failed to activate console: %lx\n", Status);
+ EfiPrintf(L"Failed to activate console: %lx\r\n", Status);
return Status;
}
}
if (!NT_SUCCESS(Status))
{
/* We failed, back down */
- EarlyPrint(L"Failed to set console state: %lx\n", Status);
+ EfiPrintf(L"Failed to set console state: %lx\r\n", Status);
ConsoleFirmwareTextClose(TextConsole);
return Status;
}
UtlProgressInfo = 0;
return STATUS_SUCCESS;
-}
\ No newline at end of file
+}
+
+VOID
+BlFwReboot (
+ VOID
+ )
+{
+#ifdef BL_KD_SUPPORTED
+ /* Stop the boot debugger*/
+ BlBdStop();
+#endif
+
+ /* Reset the machine */
+ EfiResetSystem(EfiResetCold);
+}
_In_ ULONG Count
)
{
- EarlyPrint(L"NOT SUPPORTED!!!\n");
+ EfiPrintf(L"NOT SUPPORTED!!!\r\n");
while (1);
}
else
{
/* It's a dynamic descriptor, so free it */
- EarlyPrint(L"Dynamic descriptors not yet supported\n");
+ EfiPrintf(L"Dynamic descriptors not yet supported\r\n");
Status = STATUS_NOT_IMPLEMENTED;
}
/* If we're out of descriptors, bail out */
if (MmGlobalMemoryDescriptorsUsed >= MmGlobalMemoryDescriptorCount)
{
- EarlyPrint(L"Out of descriptors!\n");
+ EfiPrintf(L"Out of descriptors!\r\n");
return NULL;
}
/* Check for backward overlap */
if ((PreviousEntry != MdList->First) && (MemoryDescriptor->BasePage < PreviousEndPage))
{
- EarlyPrint(L"Overlap detected -- this is unexpected on x86/x64 platforms\n");
+ EfiPrintf(L"Overlap detected -- this is unexpected on x86/x64 platforms\r\n");
}
/* Check for forward overlap */
if ((NextEntry != MdList->First) && (NextDescriptor->BasePage < EndPage))
{
- EarlyPrint(L"Overlap detected -- this is unexpected on x86/x64 platforms\n");
+ EfiPrintf(L"Overlap detected -- this is unexpected on x86/x64 platforms\r\n");
}
/* Nothing to do */
((MemoryDescriptor->VirtualPage) && (PreviousDescriptor->VirtualPage) &&
(PreviousMappedEndPage == MemoryDescriptor->VirtualPage))))
{
- EarlyPrint(L"Previous descriptor coalescible!\n");
+ EfiPrintf(L"Previous descriptor coalescible!\r\n");
}
/* CHeck if the current entry touches the next entry, and is compatible */
((MemoryDescriptor->VirtualPage) && (PreviousDescriptor->VirtualPage) &&
(MappedEndPage == NextDescriptor->VirtualPage))))
{
- EarlyPrint(L"Next descriptor coalescible!\n");
+ EfiPrintf(L"Next descriptor coalescible!\r\n");
}
/* Nothing to do */
FoundPageCount = Descriptor->PageCount;
FoundEndPage = FoundBasePage + FoundPageCount;
EndPage = PageCount + BasePage;
- //EarlyPrint(L"Looking for Region 0x%08I64X-0x%08I64X in 0x%08I64X-0x%08I64X\n", BasePage, EndPage, FoundBasePage, FoundEndPage);
+ //EarlyPrint(L"Looking for Region 0x%08I64X-0x%08I64X in 0x%08I64X-0x%08I64X\r\n", BasePage, EndPage, FoundBasePage, FoundEndPage);
/* Make a copy of the original descriptor */
RtlCopyMemory(&NewDescriptor, NextEntry, sizeof(NewDescriptor));
if ((FoundBasePage >= BasePage) || (EndPage >= FoundEndPage))
{
/* This descriptor doesn't cover any part of the range */
- //EarlyPrint(L"No part of this descriptor contains the region\n");
+ //EarlyPrint(L"No part of this descriptor contains the region\r\n");
}
else
{
/* This descriptor covers the head of the allocation */
- //EarlyPrint(L"Descriptor covers the head of the region\n");
+ //EarlyPrint(L"Descriptor covers the head of the region\r\n");
}
}
else
{
/* This descriptor contains the entire allocation */
- //EarlyPrint(L"Descriptor contains the entire region\n");
+ //EarlyPrint(L"Descriptor contains the entire region\r\n");
}
/* Keep going */
if (!Descriptor->PageCount)
{
/* Remove it */
- //EarlyPrint(L"Entire descriptor consumed\n");
+ //EarlyPrint(L"Entire descriptor consumed\r\n");
MmMdRemoveDescriptorFromList(MdList, Descriptor);
MmMdFreeDescriptor(Descriptor);
/* Check if we're supposed to insert it into a new list */
if (HaveNewList)
{
- EarlyPrint(L"Not yet implemented\n");
+ EfiPrintf(L"Not yet implemented\r\n");
Status = STATUS_NOT_IMPLEMENTED;
goto Quickie;
}
/* Check for start overflow */
if (BaseMin > BaseMax)
{
- EarlyPrint(L"Descriptor overflow\n");
+ EfiPrintf(L"Descriptor overflow\r\n");
return FALSE;
}
/* Any mapped page already? */
if (Descriptor->VirtualPage)
{
- EarlyPrint(L"Virtual memory not yet supported\n");
+ EfiPrintf(L"Virtual memory not yet supported\r\n");
return FALSE;
}
else
if ((((Flags & 0xFF) & (Descriptor->Flags & 0xFF)) != (Flags & 0xFF)) ||
(((Flags & 0xFF00) & (Descriptor->Flags & 0xFF00)) != (Flags & 0xFF00)))
{
- EarlyPrint(L"Incorrect memory attributes\n");
+ EfiPrintf(L"Incorrect memory attributes\r\n");
return FALSE;
}
/* Bail out if the allocation flags don't match */
if (((Flags ^ Descriptor->Flags) & 0x190000))
{
- EarlyPrint(L"Incorrect memory allocation flags\n");
+ EfiPrintf(L"Incorrect memory allocation flags\r\n");
return FALSE;
}
/* Bail out if the type doesn't match */
if (Descriptor->Type != MemoryType)
{
- //EarlyPrint(L"Incorrect descriptor type\n");
+ //EarlyPrint(L"Incorrect descriptor type\r\n");
return FALSE;
}
NewDescriptor->Type = Descriptor->Type;
NewDescriptor->VirtualPage = VirtualPage;
NewDescriptor->Flags = Descriptor->Flags;
- //EarlyPrint(L"Found a matching descriptor: %08I64X with %08I64X pages\n", BasePage, Pages);
+ //EarlyPrint(L"Found a matching descriptor: %08I64X with %08I64X pages\r\n", BasePage, Pages);
return TRUE;
}
PLIST_ENTRY OldFlink, OldBlink;
/* Make sure we're not int middle of a call using a descriptor */
- EarlyPrint(L"Call depth is %d\n", MmDescriptorCallTreeCount);
if (MmDescriptorCallTreeCount != 1)
{
return;
}
/* Loop every current global descriptor */
- EarlyPrint(L"MmGlobalMemoryDescriptorsUsed: %d\n", MmGlobalMemoryDescriptorsUsed);
while (Index < MmGlobalMemoryDescriptorsUsed)
{
/* Does it have any valid pageS? */
HeapLimit = Heap->HeapLimit + PAGE_SIZE;
if (HeapLimit <= Heap->HeapEnd)
{
- EarlyPrint(L"Heap extension TODO\n");
+ EfiPrintf(L"Heap extension TODO\r\n");
return STATUS_INSUFFICIENT_RESOURCES;
}
}
#if 0
BOOLEAN DebuggerEnabled;
- BlStatusPrint(L"Heap corruption in the links surrounding %p!\n", BufferEntry);
+ BlStatusPrint(L"Heap corruption in the links surrounding %p!\r\n", BufferEntry);
DebuggerEnabled = BlBdDebuggerEnabled();
if (DebuggerEnabled)
{
- BlStatusPrint(L"\n*** Fatal Error 0x%08x :\n (0x%p, 0x%p, 0x%p, 0x%p)\n\n", 2, BufferEntry, NULL, NULL, NULL);
+ BlStatusPrint(L"\n*** Fatal Error 0x%08x :\n (0x%p, 0x%p, 0x%p, 0x%p)\n\r\n", 2, BufferEntry, NULL, NULL, NULL);
__debugbreak();
}
#else
- EarlyPrint(L"Heap corruption in the links surrounding %p!\n", BufferEntry);
+ EfiPrintf(L"Heap corruption in the links surrounding %p!\r\n", BufferEntry);
#endif
}
/* We have no heaps or space on any heap -- extend the heap and retry */
if (!NT_SUCCESS(MmHapHeapAllocatorExtend(BufferSize)))
{
- EarlyPrint(L"Heap extension failed!\n");
+ EfiPrintf(L"Heap extension failed!\r\n");
return NULL;
}
- EarlyPrint(L"Heap extended -- trying again\n");
+ EfiPrintf(L"Heap extended -- trying again\r\n");
}
/* Clear all the bits, marking this entry as allocated */
BusyEntry->BufferNext.P = MmHapDecodeLink(BusyEntry->BufferNext);
/* Return the entry's data buffer */
- EarlyPrint(L"Returning buffer at 0x%p\n", &BusyEntry->Buffer);
+ EfiPrintf(L"Returning buffer at 0x%p\r\n", &BusyEntry->Buffer);
return &BusyEntry->Buffer;
}
if (DoDeferred)
{
- EarlyPrint(L"Deferred todo\n");
+ EfiPrintf(L"Deferred todo\r\n");
}
- EarlyPrint(L"Phase 1 TODO\n");
+ EfiPrintf(L"Phase 1 TODO\r\n");
return STATUS_NOT_IMPLEMENTED;
}
}
/* TODO */
- EarlyPrint(L"Required for protected mode\n");
+ EfiPrintf(L"Required for protected mode\r\n");
return STATUS_NOT_IMPLEMENTED;
}
}
/* Have to allocate physical pages */
- EarlyPrint(L"VM Todo\n");
+ EfiPrintf(L"VM Todo\r\n");
return STATUS_NOT_IMPLEMENTED;
}
return STATUS_UNSUCCESSFUL;
}
- EarlyPrint(L"VM todo\n");
+ EfiPrintf(L"VM todo\r\n");
return STATUS_NOT_IMPLEMENTED;
}
if (MmTranslationType != BlNone)
{
/* For virtual memory, there's more to do */
- EarlyPrint(L"VM not supported for mapping\n");
+ EfiPrintf(L"VM not supported for mapping\r\n");
Status = STATUS_NOT_IMPLEMENTED;
goto Quickie;
}
if ((TranslationType > BlPae) || (LibraryParameters->TranslationType > BlPae))
{
/* Bail out */
- EarlyPrint(L"Invalid translation types present\n");
+ EfiPrintf(L"Invalid translation types present\r\n");
Status = STATUS_INVALID_PARAMETER;
goto Quickie;
}
if (LibraryParameters->DescriptorCount > 512)
{
/* Switch to using a dynamic buffer instead */
- EarlyPrint(L"Warning: too many descriptors\n");
+ EfiPrintf(L"Warning: too many descriptors\r\n");
Status = STATUS_NOT_IMPLEMENTED;
goto Quickie;
//MmMdpSwitchToDynamicDescriptors(LibraryParameters->DescriptorCount);
/* Check if we exhausted the list */
if (NextEntry == ListHead)
{
- EarlyPrint(L"No matching memory found\n");
+ EfiPrintf(L"No matching memory found\r\n");
return Status;
}
&EfiAddress);
if (!NT_SUCCESS(Status))
{
- EarlyPrint(L"EFI memory allocation failure\n");
+ EfiPrintf(L"EFI memory allocation failure\r\n");
return Status;
}
/* Are we allocating from the virtual memory list? */
if (CurrentList == &MmMdlMappedUnallocated)
{
- EarlyPrint(L"Virtual memory not yet supported\n");
+ EfiPrintf(L"Virtual memory not yet supported\r\n");
return STATUS_NOT_IMPLEMENTED;
}
/* Does the memory we received not exactly fall onto the beginning of its descriptor? */
if (LocalDescriptor.BasePage != FoundDescriptor->BasePage)
{
- EarlyPrint(L"Local Page: %08I64X Found Page: %08I64X\n", LocalDescriptor.BasePage, FoundDescriptor->BasePage);
+ EfiPrintf(L"Local Page: %08I64X Found Page: %08I64X\r\n", LocalDescriptor.BasePage, FoundDescriptor->BasePage);
TempDescriptor = MmMdInitByteGranularDescriptor(FoundDescriptor->Flags,
FoundDescriptor->Type,
FoundDescriptor->BasePage,
LocalDescriptor.VirtualPage + LocalDescriptor.PageCount : 0;
if (LocalEndPage != FoundEndPage)
{
- EarlyPrint(L"Local Page: %08I64X Found Page: %08I64X\n", LocalEndPage, FoundEndPage);
+ EfiPrintf(L"Local Page: %08I64X Found Page: %08I64X\r\n", LocalEndPage, FoundEndPage);
TempDescriptor = MmMdInitByteGranularDescriptor(FoundDescriptor->Flags,
FoundDescriptor->Type,
LocalEndPage,
if (Status == STATUS_NOT_FOUND)
{
/* Need to re-synchronize the memory map and check other lists */
- EarlyPrint(L"No RAM found -- backup plan not yet implemented\n");
+ EfiPrintf(L"No RAM found -- backup plan not yet implemented\r\n");
}
/* Did we get the region we wanted? */
}
/* Nope, we have to hunt for it elsewhere */
- EarlyPrint(L"TODO\n");
+ EfiPrintf(L"TODO\r\n");
return Status;
}
PLIST_ENTRY listHead, nextEntry;
/* Loop the NT firmware memory list */
- EarlyPrint(L"NT MEMORY MAP\n\n");
+ EfiPrintf(L"NT MEMORY MAP\n\r\n");
listHead = &MmMdlUnmappedUnallocated.ListHead;
nextEntry = listHead->Flink;
while (listHead != nextEntry)
{
Descriptor = CONTAINING_RECORD(nextEntry, BL_MEMORY_DESCRIPTOR, ListEntry);
- EarlyPrint(L"Type: %08lX Flags: %08lX Base: 0x%016I64X End: 0x%016I64X\n",
+ EfiPrintf(L"Type: %08lX Flags: %08lX Base: 0x%016I64X End: 0x%016I64X\r\n",
Descriptor->Type,
Descriptor->Flags,
Descriptor->BasePage << PAGE_SHIFT,
/* Set the frequency based on the two measurements we took */
BlpTimePerformanceFrequency = 125 * (Delta - (TimeStamp2 - TimeStamp1)) & 0x1FFFFFFFFFFFFFF;
- EarlyPrint(L"Computed frequency as: %I64d\n", BlpTimePerformanceFrequency);
return STATUS_SUCCESS;
}
{
/* Read the TSC frequency from the MSR */
BlpTimePerformanceFrequency = __readmsr(0x40000022);
- EarlyPrint(L"Using frequency as: %I64d\n", BlpTimePerformanceFrequency);
+ EfiPrintf(L"Using Hyper-V frequency as: %I64d\r\n", BlpTimePerformanceFrequency);
return STATUS_SUCCESS;
}
}