[FREELDR]

- Add DPRINT_WINDOWS DPRINT_PELOADER (the only useful) to DEBUG_ALL and DEBUG_CUSTOM
- Enable a few useful DPRINTs

svn path=/branches/ros-amd64-bringup/; revision=45431
This commit is contained in:
Timo Kreuzer 2010-02-05 03:03:38 +00:00
parent 3e8181cc61
commit 4088be01fe
3 changed files with 23 additions and 16 deletions

View file

@ -32,15 +32,13 @@
#if defined (DEBUG_ALL)
ULONG DebugPrintMask = DPRINT_WARNING | DPRINT_MEMORY | DPRINT_FILESYSTEM |
DPRINT_UI | DPRINT_DISK | DPRINT_CACHE | DPRINT_REACTOS |
DPRINT_LINUX | DPRINT_HWDETECT;
DPRINT_LINUX | DPRINT_HWDETECT | DPRINT_WINDOWS | DPRINT_PELOADER;
#elif defined (DEBUG_INIFILE)
ULONG DebugPrintMask = DPRINT_INIFILE;
#elif defined (DEBUG_REACTOS)
ULONG DebugPrintMask = DPRINT_REACTOS | DPRINT_REGISTRY;
#elif defined (DEBUG_CUSTOM)
ULONG DebugPrintMask = DPRINT_WARNING |
DPRINT_UI | DPRINT_CACHE | DPRINT_REACTOS |
DPRINT_LINUX;
ULONG DebugPrintMask = DPRINT_WARNING | DPRINT_WINDOWS | DPRINT_PELOADER;
#else //#elif defined (DEBUG_NONE)
ULONG DebugPrintMask = 0;
#endif

View file

@ -507,8 +507,8 @@ WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
LONG High, Low, Middle, Result;
ULONG Hint;
//DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName(): DllBase 0x%X, ImageBase 0x%X, ThunkData 0x%X, ExportDirectory 0x%X, ExportSize %d, ProcessForwards 0x%X\n",
// DllBase, ImageBase, ThunkData, ExportDirectory, ExportSize, ProcessForwards);
DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName(): DllBase 0x%X, ImageBase 0x%X, ThunkData 0x%X, ExportDirectory 0x%X, ExportSize %d, ProcessForwards 0x%X\n",
DllBase, ImageBase, ThunkData, ExportDirectory, ExportSize, ProcessForwards);
/* Check passed DllBase param */
if(DllBase == NULL)
@ -525,7 +525,7 @@ WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
{
/* Yes, calculate the ordinal */
Ordinal = (ULONG)(IMAGE_ORDINAL(ThunkData->u1.Ordinal) - (UINT32)ExportDirectory->Base);
//DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName(): Ordinal %d\n", Ordinal);
DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName(): Ordinal %d\n", Ordinal);
}
else
{
@ -543,12 +543,12 @@ WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
NameTable = (PULONG)VaToPa(RVA(DllBase, ExportDirectory->AddressOfNames));
OrdinalTable = (PUSHORT)VaToPa(RVA(DllBase, ExportDirectory->AddressOfNameOrdinals));
//DPRINTM(DPRINT_PELOADER, "NameTable 0x%X, OrdinalTable 0x%X, ED->AddressOfNames 0x%X, ED->AOFO 0x%X\n",
// NameTable, OrdinalTable, ExportDirectory->AddressOfNames, ExportDirectory->AddressOfNameOrdinals);
DPRINTM(DPRINT_PELOADER, "NameTable 0x%X, OrdinalTable 0x%X, ED->AddressOfNames 0x%X, ED->AOFO 0x%X\n",
NameTable, OrdinalTable, ExportDirectory->AddressOfNames, ExportDirectory->AddressOfNameOrdinals);
/* Get the hint, convert it to a physical pointer */
Hint = ((PIMAGE_IMPORT_BY_NAME)VaToPa((PVOID)ThunkData->u1.AddressOfData))->Hint;
//DPRINTM(DPRINT_PELOADER, "HintIndex %d\n", Hint);
DPRINTM(DPRINT_PELOADER, "HintIndex %d\n", Hint);
/* If Hint is less than total number of entries in the export directory,
and import name == export name, then we can just get it from the OrdinalTable */
@ -561,19 +561,20 @@ WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
)
{
Ordinal = OrdinalTable[Hint];
//DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName(): Ordinal %d\n", Ordinal);
DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName(): Ordinal %d\n", Ordinal);
}
else
{
/* It's not the easy way, we have to lookup import name in the name table.
Let's use a binary search for this task. */
//DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName() looking up the import name using binary search...\n");
/* Low boundary is set to 0, and high boundary to the maximum index */
Low = 0;
High = ExportDirectory->NumberOfNames - 1;
DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName() looking up import '%s' in #0..#%d\n",
VaToPa(&((PIMAGE_IMPORT_BY_NAME)VaToPa(ThunkData->u1.AddressOfData))->Name[0]), High);
/* Perform a binary-search loop */
while (High >= Low)
{
@ -584,9 +585,9 @@ WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
Result = strcmp(VaToPa(&((PIMAGE_IMPORT_BY_NAME)VaToPa((PVOID)ThunkData->u1.AddressOfData))->Name[0]),
(PCHAR)VaToPa(RVA(DllBase, NameTable[Middle])));
/*DPRINTM(DPRINT_PELOADER, "Binary search: comparing Import '__', Export '%s'\n",*/
/*VaToPa(&((PIMAGE_IMPORT_BY_NAME)VaToPa(ThunkData->u1.AddressOfData))->Name[0]),*/
/*(PCHAR)VaToPa(RVA(DllBase, NameTable[Middle])));*/
DPRINTM(DPRINT_PELOADER, "Binary search: comparing Import '%s', Export #%ld:'%s' -> %d\n",
VaToPa(&((PIMAGE_IMPORT_BY_NAME)VaToPa(ThunkData->u1.AddressOfData))->Name[0]),
Middle, (PCHAR)VaToPa(RVA(DllBase, NameTable[Middle])), Result);
/*DPRINTM(DPRINT_PELOADER, "TE->u1.AOD %p, fulladdr %p\n",
ThunkData->u1.AddressOfData,

View file

@ -256,7 +256,10 @@ WinLdrLoadDeviceDriver(PLOADER_PARAMETER_BLOCK LoaderBlock,
sprintf(FullPath,"%s%S", BootPath, FilePath->Buffer);
Status = WinLdrLoadImage(FullPath, LoaderBootDriver, &DriverBase);
if (!Status)
{
DPRINTM(DPRINT_WINDOWS, "WinLdrLoadImage() failed\n");
return FALSE;
}
// Allocate a DTE for it
Status = WinLdrAllocateDataTableEntry(LoaderBlock, DllName, DllName, DriverBase, DriverDTE);
@ -310,6 +313,7 @@ WinLdrLoadBootDrivers(PLOADER_PARAMETER_BLOCK LoaderBlock,
//FIXME: Maybe remove it from the list and try to continue?
if (!Status)
{
DPRINTM(DPRINT_WARNING, "Can't load boot driver: %wZ\n", &BootDriver->FilePath);
UiMessageBox("Can't load boot driver!");
return FALSE;
}
@ -583,12 +587,16 @@ LoadAndBootWindows(PCSTR OperatingSystemName,
/* Turn on paging mode of CPU*/
WinLdrTurnOnPaging(LoaderBlock, PcrBasePage, TssBasePage, GdtIdt);
DbgPrint("Heeelooo\n");
/* Save final value of LoaderPagesSpanned */
LoaderBlock->Extension->LoaderPagesSpanned = LoaderPagesSpanned;
DPRINTM(DPRINT_WINDOWS, "Hello from paged mode, KiSystemStartup %p, LoaderBlockVA %p!\n",
KiSystemStartup, LoaderBlockVA);
DbgPrint("Heeelooo\n");
WinLdrpDumpMemoryDescriptors(LoaderBlockVA);
WinLdrpDumpBootDriver(LoaderBlockVA);
WinLdrpDumpArcDisks(LoaderBlockVA);