Author: fireball
Date: Fri Jan 25 17:13:54 2008
New Revision: 31991
URL:
http://svn.reactos.org/svn/reactos?rev=31991&view=rev
Log:
- 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.
Modified:
trunk/reactos/boot/freeldr/freeldr/windows/conversion.c
trunk/reactos/boot/freeldr/freeldr/windows/winldr.c
Modified: trunk/reactos/boot/freeldr/freeldr/windows/conversion.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/windo…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/windows/conversion.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/windows/conversion.c Fri Jan 25 17:13:54 2008
@@ -1,124 +1,128 @@
-/*
- * PROJECT: EFI Windows Loader
- * LICENSE: GPL - See COPYING in the top level directory
- * FILE: freeldr/winldr/conversion.c
- * PURPOSE: Physical <-> Virtual addressing mode conversions
- * PROGRAMMERS: Aleksey Bragin (aleksey(a)reactos.org)
- */
-
-/* INCLUDES ***************************************************************/
-
-#include <freeldr.h>
-
-//#include <ndk/ldrtypes.h>
-#include <debug.h>
-
-/* FUNCTIONS **************************************************************/
-
-/* Arch-specific addresses translation implementation */
-PVOID
-VaToPa(PVOID Va)
-{
- return (PVOID)((ULONG_PTR)Va & ~KSEG0_BASE);
-}
-
-PVOID
-PaToVa(PVOID Pa)
-{
- return (PVOID)((ULONG_PTR)Pa | KSEG0_BASE);
-}
-
-VOID
-List_PaToVa(LIST_ENTRY *ListEntry)
-{
- LIST_ENTRY *ListHead = ListEntry;
- LIST_ENTRY *Next = ListEntry->Flink;
- LIST_ENTRY *NextPA;
-
- //Print(L"\n\nList_Entry: %X, First Next: %X\n", ListEntry, Next);
- //
- // Walk through the whole list
- //
- if (Next != NULL)
- {
- while (Next != PaToVa(ListHead))
- {
- NextPA = VaToPa(Next);
- //Print(L"Current: %X, Flink: %X, Blink: %X\n", Next, NextPA->Flink,
NextPA->Blink);
-
- NextPA->Flink = PaToVa((PVOID)NextPA->Flink);
- NextPA->Blink = PaToVa((PVOID)NextPA->Blink);
-
- //Print(L"After converting Flink: %X, Blink: %X\n", NextPA->Flink,
NextPA->Blink);
-
- Next = NextPA->Flink;
- }
-
- //
- // Finally convert first Flink/Blink
- //
- ListEntry->Flink = PaToVa((PVOID)ListEntry->Flink);
- if (ListEntry->Blink)
- ListEntry->Blink = PaToVa((PVOID)ListEntry->Blink);
- }
-}
-
-// This function converts only Child->Child, and calls itself for each Sibling
-VOID
-ConvertConfigToVA(PCONFIGURATION_COMPONENT_DATA Start)
-{
- PCONFIGURATION_COMPONENT_DATA Child;
- PCONFIGURATION_COMPONENT_DATA Sibling;
-
- DbgPrint((DPRINT_WINDOWS, "ConvertConfigToVA(Start 0x%X)\n", Start));
- Child = Start;
-
- while (Child != NULL)
- {
- if (Child->ConfigurationData)
- Child->ConfigurationData = PaToVa(Child->ConfigurationData);
-
- if (Child->Child)
- Child->Child = PaToVa(Child->Child);
-
- if (Child->Parent)
- Child->Parent = PaToVa(Child->Parent);
-
- if (Child->Sibling)
- Child->Sibling = PaToVa(Child->Sibling);
-
- DbgPrint((DPRINT_WINDOWS, "Device 0x%X class %d type %d, parent %p\n",
Child,
- Child->ComponentEntry.Class, Child->ComponentEntry.Type, Child->Parent));
-
- // If the child has a sibling list, then search the sibling list
- // for an entry that matches the specified class, type, and key.
- Sibling = VaToPa(Child->Sibling);
- while (Sibling != NULL)
- {
- if (Sibling->ConfigurationData)
- Sibling->ConfigurationData = PaToVa(Sibling->ConfigurationData);
-
- if (Sibling->Child)
- Sibling->Child = PaToVa(Sibling->Child);
-
- if (Sibling->Parent)
- Sibling->Parent = PaToVa(Sibling->Parent);
-
- if (Sibling->Sibling)
- Sibling->Sibling = PaToVa(Sibling->Sibling);
-
- DbgPrint((DPRINT_WINDOWS, "Device 0x%X class %d type %d sib, parent %p\n",
Sibling,
- Sibling->ComponentEntry.Class, Sibling->ComponentEntry.Type,
Sibling->Parent));
-
- // If the sibling has a child tree, then search the child tree
- // for an entry that matches the specified class, type, and key.
- if (VaToPa(Sibling->Child) != NULL)
- ConvertConfigToVA(VaToPa(Sibling->Child));
-
- Sibling = VaToPa(Sibling->Sibling);
- }
-
- // Go to the next child
- Child = VaToPa(Child->Child);
- }
-}
+/*
+ * PROJECT: EFI Windows Loader
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: freeldr/winldr/conversion.c
+ * PURPOSE: Physical <-> Virtual addressing mode conversions
+ * PROGRAMMERS: Aleksey Bragin (aleksey(a)reactos.org)
+ */
+
+/* INCLUDES ***************************************************************/
+
+#include <freeldr.h>
+
+//#include <ndk/ldrtypes.h>
+#include <debug.h>
+
+/* FUNCTIONS **************************************************************/
+
+/* Arch-specific addresses translation implementation */
+PVOID
+VaToPa(PVOID Va)
+{
+ return (PVOID)((ULONG_PTR)Va & ~KSEG0_BASE);
+}
+
+PVOID
+PaToVa(PVOID Pa)
+{
+ return (PVOID)((ULONG_PTR)Pa | KSEG0_BASE);
+}
+
+VOID
+List_PaToVa(LIST_ENTRY *ListEntry)
+{
+ LIST_ENTRY *ListHead = ListEntry;
+ LIST_ENTRY *Next = ListEntry->Flink;
+ LIST_ENTRY *NextPA;
+
+ //Print(L"\n\nList_Entry: %X, First Next: %X\n", ListEntry, Next);
+ //
+ // Walk through the whole list
+ //
+ if (Next != NULL)
+ {
+ while (Next != PaToVa(ListHead))
+ {
+ NextPA = VaToPa(Next);
+ //Print(L"Current: %X, Flink: %X, Blink: %X\n", Next, NextPA->Flink,
NextPA->Blink);
+
+ NextPA->Flink = PaToVa((PVOID)NextPA->Flink);
+ NextPA->Blink = PaToVa((PVOID)NextPA->Blink);
+
+ //Print(L"After converting Flink: %X, Blink: %X\n", NextPA->Flink,
NextPA->Blink);
+
+ Next = NextPA->Flink;
+ }
+
+ //
+ // Finally convert first Flink/Blink
+ //
+ ListEntry->Flink = PaToVa((PVOID)ListEntry->Flink);
+ if (ListEntry->Blink)
+ ListEntry->Blink = PaToVa((PVOID)ListEntry->Blink);
+ }
+}
+
+// This function converts only Child->Child, and calls itself for each Sibling
+VOID
+ConvertConfigToVA(PCONFIGURATION_COMPONENT_DATA Start)
+{
+ PCONFIGURATION_COMPONENT_DATA Child;
+ PCONFIGURATION_COMPONENT_DATA Sibling;
+
+ DbgPrint((DPRINT_WINDOWS, "ConvertConfigToVA(Start 0x%X)\n", Start));
+ Child = Start;
+
+ while (Child != NULL)
+ {
+ if (Child->ConfigurationData)
+ Child->ConfigurationData = PaToVa(Child->ConfigurationData);
+
+ if (Child->Child)
+ Child->Child = PaToVa(Child->Child);
+
+ if (Child->Parent)
+ Child->Parent = PaToVa(Child->Parent);
+
+ if (Child->Sibling)
+ Child->Sibling = PaToVa(Child->Sibling);
+
+ if (Child->ComponentEntry.Identifier)
+ Child->ComponentEntry.Identifier = PaToVa(Child->ComponentEntry.Identifier);
+
+ DbgPrint((DPRINT_WINDOWS, "Device 0x%X class %d type %d id %p, parent %p\n",
Child,
+ Child->ComponentEntry.Class, Child->ComponentEntry.Type,
Child->ComponentEntry.Identifier, Child->Parent));
+
+ // Go through siblings list
+ Sibling = VaToPa(Child->Sibling);
+ while (Sibling != NULL)
+ {
+ if (Sibling->ConfigurationData)
+ Sibling->ConfigurationData = PaToVa(Sibling->ConfigurationData);
+
+ if (Sibling->Child)
+ Sibling->Child = PaToVa(Sibling->Child);
+
+ if (Sibling->Parent)
+ Sibling->Parent = PaToVa(Sibling->Parent);
+
+ if (Sibling->Sibling)
+ Sibling->Sibling = PaToVa(Sibling->Sibling);
+
+ if (Sibling->ComponentEntry.Identifier)
+ Sibling->ComponentEntry.Identifier =
PaToVa(Sibling->ComponentEntry.Identifier);
+
+ DbgPrint((DPRINT_WINDOWS, "Device 0x%X class %d type %d id %p, parent %p\n",
Sibling,
+ Sibling->ComponentEntry.Class, Sibling->ComponentEntry.Type,
Sibling->ComponentEntry.Identifier, Sibling->Parent));
+
+ // Recurse into the Child tree
+ if (VaToPa(Sibling->Child) != NULL)
+ ConvertConfigToVA(VaToPa(Sibling->Child));
+
+ Sibling = VaToPa(Sibling->Sibling);
+ }
+
+ // Go to the next child
+ Child = VaToPa(Child->Child);
+ }
+}
Modified: trunk/reactos/boot/freeldr/freeldr/windows/winldr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/windo…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/windows/winldr.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/windows/winldr.c Fri Jan 25 17:13:54 2008
@@ -28,7 +28,6 @@
extern ULONG reactos_disk_count;
extern ARC_DISK_SIGNATURE reactos_arc_disk_info[];
extern char reactos_arc_strings[32][256];
-extern char reactos_arc_hardware_data[HW_MAX_ARC_HEAP_SIZE];
BOOLEAN
WinLdrCheckForLoadedDll(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
@@ -430,10 +429,7 @@
AllocateAndInitLPB(&LoaderBlock);
/* Detect hardware */
- MachHwDetect();
- LoaderBlock->ConfigurationRoot = MmHeapAlloc(16 * 1024);
- RtlCopyMemory(LoaderBlock->ConfigurationRoot,
- (PVOID)reactos_arc_hardware_data, 16 * 1024);
+ LoaderBlock->ConfigurationRoot = MachHwDetect();
/* Load kernel */
strcpy(FileName, BootPath);
@@ -495,7 +491,10 @@
/* "Stop all motors", change videomode */
DiskStopFloppyMotor();
- MachVideoPrepareForReactOS(FALSE);
+ if (OperatingSystemVersion < _WIN32_WINNT_WIN2K)
+ MachVideoPrepareForReactOS(TRUE);
+ else
+ MachVideoPrepareForReactOS(FALSE);
/* Debugging... */
//DumpMemoryAllocMap();