From d40a356433a0819740d7dd4e9567ba7abf37f75f Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Sat, 21 Mar 2009 11:11:44 +0000 Subject: [PATCH] - Allocate and initialize setup loader block. - Add setup loader block pointer conversion to WinLdrInitializePhase1 (if it exists). - Temporary: provide empty boot options string. svn path=/trunk/; revision=40156 --- .../boot/freeldr/freeldr/windows/setupldr2.c | 20 ++++++++++++++++++- reactos/boot/freeldr/freeldr/windows/winldr.c | 4 ++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/reactos/boot/freeldr/freeldr/windows/setupldr2.c b/reactos/boot/freeldr/freeldr/windows/setupldr2.c index 7b252d68f5d..251ea3c247f 100644 --- a/reactos/boot/freeldr/freeldr/windows/setupldr2.c +++ b/reactos/boot/freeldr/freeldr/windows/setupldr2.c @@ -21,6 +21,8 @@ #include #include +#include + #include // TODO: Move to .h @@ -155,6 +157,7 @@ VOID LoadReactOSSetup2(VOID) CHAR SystemPath[512], SearchPath[512]; CHAR FileName[512]; CHAR BootPath[512]; + CHAR LoadOptions[512]; LPCSTR BootOptions; PVOID NtosBase = NULL, HalBase = NULL, KdComBase = NULL; BOOLEAN Status; @@ -163,6 +166,7 @@ VOID LoadReactOSSetup2(VOID) HINF InfHandle; INFCONTEXT InfContext; PLOADER_PARAMETER_BLOCK LoaderBlock, LoaderBlockVA; + PSETUP_LOADER_BLOCK SetupBlock; KERNEL_ENTRY_POINT KiSystemStartup; PLDR_DATA_TABLE_ENTRY KernelDTE, HalDTE, KdComDTE = NULL; // Mm-related things @@ -249,6 +253,14 @@ VOID LoadReactOSSetup2(VOID) /* Allocate and minimalistic-initialize LPB */ AllocateAndInitLPB(&LoaderBlock); + /* Allocate and initialize setup loader block */ + SetupBlock = MmHeapAlloc(sizeof(SETUP_LOADER_BLOCK)); + RtlZeroMemory(SetupBlock, sizeof(SETUP_LOADER_BLOCK)); + LoaderBlock->SetupLdrBlock = SetupBlock; + + /* Set textmode setup flag */ + SetupBlock->Flags = SETUPLDR_TEXT_MODE; + /* Detect hardware */ UseRealHeap = TRUE; LoaderBlock->ConfigurationRoot = MachHwDetect(); @@ -300,7 +312,8 @@ VOID LoadReactOSSetup2(VOID) WinLdrSetupForNt(LoaderBlock, &GdtIdt, &PcrBasePage, &TssBasePage); /* Initialize Phase 1 - no drivers loading anymore */ - WinLdrInitializePhase1(LoaderBlock, (PCHAR)BootOptions, SystemPath, BootPath, _WIN32_WINNT_WS03); + LoadOptions[0] = 0; + WinLdrInitializePhase1(LoaderBlock, LoadOptions, SystemPath, BootPath, _WIN32_WINNT_WS03); /* Save entry-point pointer and Loader block VAs */ KiSystemStartup = (KERNEL_ENTRY_POINT)KernelDTE->EntryPoint; @@ -325,6 +338,11 @@ VOID LoadReactOSSetup2(VOID) //WinLdrpDumpBootDriver(LoaderBlockVA); //WinLdrpDumpArcDisks(LoaderBlockVA); + /*asm(".intel_syntax noprefix\n"); + asm("test1:\n"); + asm("jmp test1\n"); + asm(".att_syntax\n");*/ + /* Pass control */ (*KiSystemStartup)(LoaderBlockVA); diff --git a/reactos/boot/freeldr/freeldr/windows/winldr.c b/reactos/boot/freeldr/freeldr/windows/winldr.c index dd4beb07855..406deb0b055 100644 --- a/reactos/boot/freeldr/freeldr/windows/winldr.c +++ b/reactos/boot/freeldr/freeldr/windows/winldr.c @@ -201,7 +201,11 @@ WinLdrInitializePhase1(PLOADER_PARAMETER_BLOCK LoaderBlock, Extension->DrvDBImage = PaToVa(WinLdrLoadModule(MiscFiles, &Extension->DrvDBSize, LoaderRegistryData)); + /* Convert extension and setup block pointers */ LoaderBlock->Extension = PaToVa(Extension); + + if (LoaderBlock->SetupLdrBlock) + LoaderBlock->SetupLdrBlock = PaToVa(LoaderBlock->SetupLdrBlock); } // Last step before going virtual