Fix a couple of problems with FreeLDR portability.
[reactos.git] / reactos / boot / freeldr / freeldr / reactos / reactos.c
index 2df4c98..87e6414 100644 (file)
@@ -42,8 +42,8 @@ CHAR szBootPath[255];
 CHAR SystemRoot[255];
 static CHAR szLoadingMsg[] = "Loading ReactOS...";
 BOOLEAN FrLdrBootType;
-extern ULONG_PTR KernelBase;
-extern ROS_KERNEL_ENTRY_POINT KernelEntryPoint;
+ULONG_PTR KernelBase;
+ROS_KERNEL_ENTRY_POINT KernelEntryPoint;
 
 BOOLEAN
 FrLdrLoadDriver(PCHAR szFileName,
@@ -574,12 +574,9 @@ LoadAndBootReactOS(PCSTR OperatingSystemName)
        ULONG SectionId;
     PIMAGE_NT_HEADERS NtHeader;
     PVOID LoadBase;
-
        ULONG_PTR Base;
        ULONG Size;
 
-       extern BOOLEAN AcpiPresent;
-
        //
        // Open the operating system section
        // specified in the .ini file
@@ -702,11 +699,19 @@ LoadAndBootReactOS(PCSTR OperatingSystemName)
        LoaderBlock.ArchExtra = (ULONG)MachHwDetect();
     UiDrawProgressBarCenter(5, 100, szLoadingMsg);
 
-       if (AcpiPresent) LoaderBlock.Flags |= MB_FLAGS_ACPI_TABLE;
     LoaderBlock.DrivesCount = reactos_disk_count;
 
        UiDrawStatusText("Loading...");
 
+       //
+       // If we have a ramdisk, this will switch to the ramdisk disk routines
+       // which read from memory instead of using the firmware. This has to be done
+       // after hardware detection, since hardware detection will require using the
+       // real routines in order to perform disk-detection (just because we're on a
+       // ram-boot doesn't mean the user doesn't have actual disks installed too!)
+       //
+       RamDiskSwitchFromBios();
+
        /*
         * Try to open system drive
         */
@@ -855,11 +860,14 @@ LoadAndBootReactOS(PCSTR OperatingSystemName)
        FrLdrLoadBootDrivers(szBootPath, 40);
        //UiUnInitialize("Booting ReactOS...");
 
-       /*
-        * Now boot the kernel
-        */
-       DiskStopFloppyMotor();
-       MachVideoPrepareForReactOS(FALSE);
+    //
+    // Perform architecture-specific pre-boot configuration
+    //
+    MachPrepareForReactOS(FALSE);
+
+    //
+    // Setup paging and jump to kernel
+    //
        FrLdrStartup(0x2badb002);
 }