char reactos_kernel_cmdline[255]; // Command line passed to kernel
LOADER_MODULE reactos_modules[64]; // Array to hold boot module info loaded for the kernel
char reactos_module_strings[64][256]; // Array to hold module names
-unsigned long reactos_memory_map_descriptor_size;
-memory_map_t reactos_memory_map[32]; // Memory map
+reactos_mem_data_t reactos_mem_data;
+extern char reactos_arc_hardware_data[HW_MAX_ARC_HEAP_SIZE];
char szBootPath[256];
char szHalName[256];
CHAR SystemRoot[255];
-extern ULONG_PTR KernelBase, KernelEntryPoint;
+extern ULONG_PTR KernelBase;
+extern ROS_KERNEL_ENTRY_POINT KernelEntryPoint;
extern BOOLEAN FrLdrLoadDriver(PCHAR szFileName, INT nPos);
/* Get the NT header, kernel base and kernel entry */
NtHeader = RtlImageNtHeader(LoadBase);
KernelBase = NtHeader->OptionalHeader.ImageBase;
- KernelEntryPoint = KernelBase + NtHeader->OptionalHeader.AddressOfEntryPoint;
+ KernelEntryPoint = (ROS_KERNEL_ENTRY_POINT)(KernelBase + NtHeader->OptionalHeader.AddressOfEntryPoint);
LoaderBlock.KernelBase = KernelBase;
/* Update Processbar and return success */
LoadNlsFile(PCSTR szSourcePath, PCSTR szFileName, PCSTR szModuleName)
{
CHAR szFullName[256];
-#ifdef USE_UI
CHAR szBuffer[80];
-#endif
PFILE FilePointer;
PCSTR szShortName;
/*
* Update the status bar with the current file
*/
-#ifdef USE_UI
sprintf(szBuffer, "Setup is loading files (%s)", szShortName);
UiDrawStatusText(szBuffer);
-#else
- printf("Reading %s\n", szShortName);
-#endif
/* Load the driver */
FrLdrLoadModule(FilePointer, szModuleName, NULL);
VOID RunLoader(VOID)
{
- ULONG_PTR Base;
- ULONG Size, i;
+ ULONG i;
const char *SourcePath;
const char *LoadOptions = "", *DbgLoadOptions = "";
const char *sourcePaths[] = {
LoaderBlock.MmapLength = (unsigned long)MachGetMemoryMap((PBIOS_MEMORY_MAP)reactos_memory_map, 32) * sizeof(memory_map_t);
if (LoaderBlock.MmapLength)
{
+#ifdef _M_IX86
ULONG i;
-
+#endif
+ LoaderBlock.Flags |= MB_FLAGS_MEM_INFO | MB_FLAGS_MMAP_INFO;
LoaderBlock.MmapAddr = (unsigned long)&reactos_memory_map;
reactos_memory_map_descriptor_size = sizeof(memory_map_t); // GetBiosMemoryMap uses a fixed value of 24
+#ifdef _M_IX86
for (i=0; i<(LoaderBlock.MmapLength/sizeof(memory_map_t)); i++)
{
if (BiosMemoryUsable == reactos_memory_map[i].type &&
LoaderBlock.MemHigher = (reactos_memory_map[i].base_addr_low + reactos_memory_map[i].length_low) / 1024 - 1024;
}
}
+#endif
}
#ifdef USE_UI
SetupUiInitialize();
- UiDrawStatusText("");
#endif
+ UiDrawStatusText("");
extern BOOLEAN FrLdrBootType;
FrLdrBootType = TRUE;
RegInitializeRegistry();
/* Detect hardware */
-#ifdef USE_UI
UiDrawStatusText("Detecting hardware...");
-#else
- printf("Detecting hardware...\n\n");
-#endif
- MachHwDetect();
-#ifdef USE_UI
+ LoaderBlock.ArchExtra = (ULONG)MachHwDetect();
UiDrawStatusText("");
-#endif
/* set boot device */
MachDiskGetBootDevice(&LoaderBlock.BootDevice);
/* Open boot drive */
if (!FsOpenBootVolume())
{
-#ifdef USE_UI
UiMessageBox("Failed to open boot drive.");
-#else
- printf("Failed to open boot drive.");
-#endif
return;
}
SourcePath = "\\";
#ifdef DBG
- /* Get load options */
+ /* Get load options */
if (InfFindFirstLine (InfHandle,
"SetupData",
"DbgOsLoadOptions",
printf("Failed to get load options\n");
return;
}
-#if 0
- printf("LoadOptions: '%s'\n", LoadOptions);
-#endif
/* Set kernel command line */
MachDiskGetBootPath(reactos_kernel_cmdline, sizeof(reactos_kernel_cmdline));
strcpy(SystemRoot, SourcePath);
strcat(SystemRoot, "\\");
-
+
/* Setup the boot path and kernel path */
strcpy(szBootPath, SourcePath);
strcpy(szKernelName, szBootPath);
/* Load the kernel */
if (!FrLdrLoadKernel(szKernelName, 5)) return;
- /* Export the hardware hive */
- Base = FrLdrCreateModule ("HARDWARE");
- RegExportBinaryHive (L"\\Registry\\Machine\\HARDWARE", (PVOID)Base, &Size);
- FrLdrCloseModule (Base, Size);
-
-#if 0
- printf("Base: %x\n", Base);
- printf("Size: %u\n", Size);
- printf("*** System stopped ***\n");
-for(;;);
-#endif
-
/* Insert boot disk 2 */
if (MachDiskBootingFromFloppy())
{
-#ifdef USE_UI
UiMessageBox("Please insert \"ReactOS Boot Disk 2\" and press ENTER");
-#else
- printf("\n\n Please insert \"ReactOS Boot Disk 2\" and press ENTER\n");
- MachConsGetCh();
-#endif
/* Open boot drive */
if (!FsOpenBootVolume())
{
-#ifdef USE_UI
UiMessageBox("Failed to open boot drive.");
-#else
- printf("Failed to open boot drive.");
-#endif
return;
}
/* Load ANSI codepage file */
if (!LoadNlsFile(SourcePath, LoadOptions, "ansi.nls"))
{
-#ifdef USE_UI
UiMessageBox("Failed to load the ANSI codepage file.");
-#else
- printf("Failed to load the ANSI codepage file.");
-#endif
return;
}
/* Load OEM codepage file */
if (!LoadNlsFile(SourcePath, LoadOptions, "oem.nls"))
{
-#ifdef USE_UI
UiMessageBox("Failed to load the OEM codepage file.");
-#else
- printf("Failed to load the OEM codepage file.");
-#endif
return;
}
/* Load Unicode casemap file */
if (!LoadNlsFile(SourcePath, LoadOptions, "casemap.nls"))
{
-#ifdef USE_UI
UiMessageBox("Failed to load the Unicode casemap file.");
-#else
- printf("Failed to load the Unicode casemap file.");
-#endif
return;
}
-#if 0
- /* Load acpi.sys */
- if (!LoadDriver(SourcePath, "acpi.sys"))
- return;
-#endif
-
-#if 0
- /* Load isapnp.sys */
- if (!LoadDriver(SourcePath, "isapnp.sys"))
- return;
-#endif
-
-#if 0
- /* Load pci.sys */
- if (!LoadDriver(SourcePath, "pci.sys"))
- return;
-#endif
-
- /* Load scsiport.sys */
- if (!LoadDriver(SourcePath, "scsiport.sys"))
- return;
-
- /* Load atapi.sys (depends on hardware detection) */
- if (!LoadDriver(SourcePath, "atapi.sys"))
- return;
-
- /* Load buslogic.sys (depends on hardware detection) */
- if (!LoadDriver(SourcePath, "buslogic.sys"))
- return;
-
- /* Load class2.sys */
- if (!LoadDriver(SourcePath, "class2.sys"))
- return;
-
- /* Load cdrom.sys */
- if (!LoadDriver(SourcePath, "cdrom.sys"))
- return;
-
- /* Load cdfs.sys */
- if (!LoadDriver(SourcePath, "cdfs.sys"))
- return;
-
- /* Load disk.sys */
- if (!LoadDriver(SourcePath, "disk.sys"))
- return;
-
- /* Load floppy.sys */
- if (!LoadDriver(SourcePath, "floppy.sys"))
- return;
-
/* Load vfatfs.sys (could be loaded by the setup prog!) */
if (!LoadDriver(SourcePath, "vfatfs.sys"))
return;
+ /* Load additional files specified in txtsetup.inf */
+ if (InfFindFirstLine(InfHandle,
+ "SourceDisksFiles",
+ NULL,
+ &InfContext))
+ {
+ do
+ {
+ LPCSTR Media, DriverName;
+ if (InfGetDataField(&InfContext, 7, &Media) &&
+ InfGetDataField(&InfContext, 0, &DriverName))
+ {
+ if (strcmp(Media, "x") == 0)
+ {
+ if (!LoadDriver(SourcePath, DriverName))
+ return;
+ }
+ }
+ } while (InfFindNextLine(&InfContext, &InfContext));
+ }
- /* Load keyboard driver */
- if (!LoadDriver(SourcePath, "i8042prt.sys"))
- return;
- if (!LoadDriver(SourcePath, "kbdclass.sys"))
- return;
-
- /* Load screen driver */
- if (!LoadDriver(SourcePath, "blue.sys"))
- return;
-
-#ifdef USE_UI
UiUnInitialize("Booting ReactOS...");
-#endif
- /* Now boot the kernel */
- DiskStopFloppyMotor();
- MachVideoPrepareForReactOS(TRUE);
- FrLdrStartup(0x2badb002);
+ //
+ // Perform architecture-specific pre-boot configuration
+ //
+ MachPrepareForReactOS(FALSE);
+
+ //
+ // Setup paging and jump to kernel
+ //
+ FrLdrStartup(0x2badb002);
}
/* EOF */