mirror of
https://github.com/reactos/reactos.git
synced 2024-08-04 02:20:54 +00:00
- Use new way of obtaining the hardware tree in winldr too.
- NT4 requires text mode to be set up, and further version of Windows OS require a different preparation. - Fix configuration tree conversion routine to also convert Identifier pointers from physical address to virtual address. svn path=/trunk/; revision=31991
This commit is contained in:
parent
57da0f7d20
commit
43dbecaac6
|
@ -1,124 +1,128 @@
|
||||||
/*
|
/*
|
||||||
* PROJECT: EFI Windows Loader
|
* PROJECT: EFI Windows Loader
|
||||||
* LICENSE: GPL - See COPYING in the top level directory
|
* LICENSE: GPL - See COPYING in the top level directory
|
||||||
* FILE: freeldr/winldr/conversion.c
|
* FILE: freeldr/winldr/conversion.c
|
||||||
* PURPOSE: Physical <-> Virtual addressing mode conversions
|
* PURPOSE: Physical <-> Virtual addressing mode conversions
|
||||||
* PROGRAMMERS: Aleksey Bragin (aleksey@reactos.org)
|
* PROGRAMMERS: Aleksey Bragin (aleksey@reactos.org)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* INCLUDES ***************************************************************/
|
/* INCLUDES ***************************************************************/
|
||||||
|
|
||||||
#include <freeldr.h>
|
#include <freeldr.h>
|
||||||
|
|
||||||
//#include <ndk/ldrtypes.h>
|
//#include <ndk/ldrtypes.h>
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
/* FUNCTIONS **************************************************************/
|
/* FUNCTIONS **************************************************************/
|
||||||
|
|
||||||
/* Arch-specific addresses translation implementation */
|
/* Arch-specific addresses translation implementation */
|
||||||
PVOID
|
PVOID
|
||||||
VaToPa(PVOID Va)
|
VaToPa(PVOID Va)
|
||||||
{
|
{
|
||||||
return (PVOID)((ULONG_PTR)Va & ~KSEG0_BASE);
|
return (PVOID)((ULONG_PTR)Va & ~KSEG0_BASE);
|
||||||
}
|
}
|
||||||
|
|
||||||
PVOID
|
PVOID
|
||||||
PaToVa(PVOID Pa)
|
PaToVa(PVOID Pa)
|
||||||
{
|
{
|
||||||
return (PVOID)((ULONG_PTR)Pa | KSEG0_BASE);
|
return (PVOID)((ULONG_PTR)Pa | KSEG0_BASE);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
List_PaToVa(LIST_ENTRY *ListEntry)
|
List_PaToVa(LIST_ENTRY *ListEntry)
|
||||||
{
|
{
|
||||||
LIST_ENTRY *ListHead = ListEntry;
|
LIST_ENTRY *ListHead = ListEntry;
|
||||||
LIST_ENTRY *Next = ListEntry->Flink;
|
LIST_ENTRY *Next = ListEntry->Flink;
|
||||||
LIST_ENTRY *NextPA;
|
LIST_ENTRY *NextPA;
|
||||||
|
|
||||||
//Print(L"\n\nList_Entry: %X, First Next: %X\n", ListEntry, Next);
|
//Print(L"\n\nList_Entry: %X, First Next: %X\n", ListEntry, Next);
|
||||||
//
|
//
|
||||||
// Walk through the whole list
|
// Walk through the whole list
|
||||||
//
|
//
|
||||||
if (Next != NULL)
|
if (Next != NULL)
|
||||||
{
|
{
|
||||||
while (Next != PaToVa(ListHead))
|
while (Next != PaToVa(ListHead))
|
||||||
{
|
{
|
||||||
NextPA = VaToPa(Next);
|
NextPA = VaToPa(Next);
|
||||||
//Print(L"Current: %X, Flink: %X, Blink: %X\n", Next, NextPA->Flink, NextPA->Blink);
|
//Print(L"Current: %X, Flink: %X, Blink: %X\n", Next, NextPA->Flink, NextPA->Blink);
|
||||||
|
|
||||||
NextPA->Flink = PaToVa((PVOID)NextPA->Flink);
|
NextPA->Flink = PaToVa((PVOID)NextPA->Flink);
|
||||||
NextPA->Blink = PaToVa((PVOID)NextPA->Blink);
|
NextPA->Blink = PaToVa((PVOID)NextPA->Blink);
|
||||||
|
|
||||||
//Print(L"After converting Flink: %X, Blink: %X\n", NextPA->Flink, NextPA->Blink);
|
//Print(L"After converting Flink: %X, Blink: %X\n", NextPA->Flink, NextPA->Blink);
|
||||||
|
|
||||||
Next = NextPA->Flink;
|
Next = NextPA->Flink;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Finally convert first Flink/Blink
|
// Finally convert first Flink/Blink
|
||||||
//
|
//
|
||||||
ListEntry->Flink = PaToVa((PVOID)ListEntry->Flink);
|
ListEntry->Flink = PaToVa((PVOID)ListEntry->Flink);
|
||||||
if (ListEntry->Blink)
|
if (ListEntry->Blink)
|
||||||
ListEntry->Blink = PaToVa((PVOID)ListEntry->Blink);
|
ListEntry->Blink = PaToVa((PVOID)ListEntry->Blink);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function converts only Child->Child, and calls itself for each Sibling
|
// This function converts only Child->Child, and calls itself for each Sibling
|
||||||
VOID
|
VOID
|
||||||
ConvertConfigToVA(PCONFIGURATION_COMPONENT_DATA Start)
|
ConvertConfigToVA(PCONFIGURATION_COMPONENT_DATA Start)
|
||||||
{
|
{
|
||||||
PCONFIGURATION_COMPONENT_DATA Child;
|
PCONFIGURATION_COMPONENT_DATA Child;
|
||||||
PCONFIGURATION_COMPONENT_DATA Sibling;
|
PCONFIGURATION_COMPONENT_DATA Sibling;
|
||||||
|
|
||||||
DbgPrint((DPRINT_WINDOWS, "ConvertConfigToVA(Start 0x%X)\n", Start));
|
DbgPrint((DPRINT_WINDOWS, "ConvertConfigToVA(Start 0x%X)\n", Start));
|
||||||
Child = Start;
|
Child = Start;
|
||||||
|
|
||||||
while (Child != NULL)
|
while (Child != NULL)
|
||||||
{
|
{
|
||||||
if (Child->ConfigurationData)
|
if (Child->ConfigurationData)
|
||||||
Child->ConfigurationData = PaToVa(Child->ConfigurationData);
|
Child->ConfigurationData = PaToVa(Child->ConfigurationData);
|
||||||
|
|
||||||
if (Child->Child)
|
if (Child->Child)
|
||||||
Child->Child = PaToVa(Child->Child);
|
Child->Child = PaToVa(Child->Child);
|
||||||
|
|
||||||
if (Child->Parent)
|
if (Child->Parent)
|
||||||
Child->Parent = PaToVa(Child->Parent);
|
Child->Parent = PaToVa(Child->Parent);
|
||||||
|
|
||||||
if (Child->Sibling)
|
if (Child->Sibling)
|
||||||
Child->Sibling = PaToVa(Child->Sibling);
|
Child->Sibling = PaToVa(Child->Sibling);
|
||||||
|
|
||||||
DbgPrint((DPRINT_WINDOWS, "Device 0x%X class %d type %d, parent %p\n", Child,
|
if (Child->ComponentEntry.Identifier)
|
||||||
Child->ComponentEntry.Class, Child->ComponentEntry.Type, Child->Parent));
|
Child->ComponentEntry.Identifier = PaToVa(Child->ComponentEntry.Identifier);
|
||||||
|
|
||||||
// If the child has a sibling list, then search the sibling list
|
DbgPrint((DPRINT_WINDOWS, "Device 0x%X class %d type %d id %p, parent %p\n", Child,
|
||||||
// for an entry that matches the specified class, type, and key.
|
Child->ComponentEntry.Class, Child->ComponentEntry.Type, Child->ComponentEntry.Identifier, Child->Parent));
|
||||||
Sibling = VaToPa(Child->Sibling);
|
|
||||||
while (Sibling != NULL)
|
// Go through siblings list
|
||||||
{
|
Sibling = VaToPa(Child->Sibling);
|
||||||
if (Sibling->ConfigurationData)
|
while (Sibling != NULL)
|
||||||
Sibling->ConfigurationData = PaToVa(Sibling->ConfigurationData);
|
{
|
||||||
|
if (Sibling->ConfigurationData)
|
||||||
if (Sibling->Child)
|
Sibling->ConfigurationData = PaToVa(Sibling->ConfigurationData);
|
||||||
Sibling->Child = PaToVa(Sibling->Child);
|
|
||||||
|
if (Sibling->Child)
|
||||||
if (Sibling->Parent)
|
Sibling->Child = PaToVa(Sibling->Child);
|
||||||
Sibling->Parent = PaToVa(Sibling->Parent);
|
|
||||||
|
if (Sibling->Parent)
|
||||||
if (Sibling->Sibling)
|
Sibling->Parent = PaToVa(Sibling->Parent);
|
||||||
Sibling->Sibling = PaToVa(Sibling->Sibling);
|
|
||||||
|
if (Sibling->Sibling)
|
||||||
DbgPrint((DPRINT_WINDOWS, "Device 0x%X class %d type %d sib, parent %p\n", Sibling,
|
Sibling->Sibling = PaToVa(Sibling->Sibling);
|
||||||
Sibling->ComponentEntry.Class, Sibling->ComponentEntry.Type, Sibling->Parent));
|
|
||||||
|
if (Sibling->ComponentEntry.Identifier)
|
||||||
// If the sibling has a child tree, then search the child tree
|
Sibling->ComponentEntry.Identifier = PaToVa(Sibling->ComponentEntry.Identifier);
|
||||||
// for an entry that matches the specified class, type, and key.
|
|
||||||
if (VaToPa(Sibling->Child) != NULL)
|
DbgPrint((DPRINT_WINDOWS, "Device 0x%X class %d type %d id %p, parent %p\n", Sibling,
|
||||||
ConvertConfigToVA(VaToPa(Sibling->Child));
|
Sibling->ComponentEntry.Class, Sibling->ComponentEntry.Type, Sibling->ComponentEntry.Identifier, Sibling->Parent));
|
||||||
|
|
||||||
Sibling = VaToPa(Sibling->Sibling);
|
// Recurse into the Child tree
|
||||||
}
|
if (VaToPa(Sibling->Child) != NULL)
|
||||||
|
ConvertConfigToVA(VaToPa(Sibling->Child));
|
||||||
// Go to the next child
|
|
||||||
Child = VaToPa(Child->Child);
|
Sibling = VaToPa(Sibling->Sibling);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Go to the next child
|
||||||
|
Child = VaToPa(Child->Child);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
extern ULONG reactos_disk_count;
|
extern ULONG reactos_disk_count;
|
||||||
extern ARC_DISK_SIGNATURE reactos_arc_disk_info[];
|
extern ARC_DISK_SIGNATURE reactos_arc_disk_info[];
|
||||||
extern char reactos_arc_strings[32][256];
|
extern char reactos_arc_strings[32][256];
|
||||||
extern char reactos_arc_hardware_data[HW_MAX_ARC_HEAP_SIZE];
|
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
WinLdrCheckForLoadedDll(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
WinLdrCheckForLoadedDll(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
||||||
|
@ -430,10 +429,7 @@ LoadAndBootWindows(PCSTR OperatingSystemName, WORD OperatingSystemVersion)
|
||||||
AllocateAndInitLPB(&LoaderBlock);
|
AllocateAndInitLPB(&LoaderBlock);
|
||||||
|
|
||||||
/* Detect hardware */
|
/* Detect hardware */
|
||||||
MachHwDetect();
|
LoaderBlock->ConfigurationRoot = MachHwDetect();
|
||||||
LoaderBlock->ConfigurationRoot = MmHeapAlloc(16 * 1024);
|
|
||||||
RtlCopyMemory(LoaderBlock->ConfigurationRoot,
|
|
||||||
(PVOID)reactos_arc_hardware_data, 16 * 1024);
|
|
||||||
|
|
||||||
/* Load kernel */
|
/* Load kernel */
|
||||||
strcpy(FileName, BootPath);
|
strcpy(FileName, BootPath);
|
||||||
|
@ -495,7 +491,10 @@ LoadAndBootWindows(PCSTR OperatingSystemName, WORD OperatingSystemVersion)
|
||||||
|
|
||||||
/* "Stop all motors", change videomode */
|
/* "Stop all motors", change videomode */
|
||||||
DiskStopFloppyMotor();
|
DiskStopFloppyMotor();
|
||||||
MachVideoPrepareForReactOS(FALSE);
|
if (OperatingSystemVersion < _WIN32_WINNT_WIN2K)
|
||||||
|
MachVideoPrepareForReactOS(TRUE);
|
||||||
|
else
|
||||||
|
MachVideoPrepareForReactOS(FALSE);
|
||||||
|
|
||||||
/* Debugging... */
|
/* Debugging... */
|
||||||
//DumpMemoryAllocMap();
|
//DumpMemoryAllocMap();
|
||||||
|
|
Loading…
Reference in a new issue