Author: fireball
Date: Sun Oct 8 12:54:44 2006
New Revision: 24442
URL: http://svn.reactos.org/svn/reactos?rev=24442&view=rev
Log:
- Add simple support functions to be able to use more RTL in FreeLdr
Added:
trunk/reactos/boot/freeldr/freeldr/rtl/libsupp.c (with props)
Modified:
trunk/reactos/boot/freeldr/freeldr/freeldr_base.rbuild
Modified: trunk/reactos/boot/freeldr/freeldr/freeldr_base.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/freel…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/freeldr_base.rbuild (original)
+++ trunk/reactos/boot/freeldr/freeldr/freeldr_base.rbuild Sun Oct 8 12:54:44 2006
@@ -52,6 +52,7 @@
<file>reactos.c</file>
</directory>
<directory name="rtl">
+ <file>libsupp.c</file>
<file>list.c</file>
</directory>
<directory name="ui">
Added: trunk/reactos/boot/freeldr/freeldr/rtl/libsupp.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/rtl/l…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/rtl/libsupp.c (added)
+++ trunk/reactos/boot/freeldr/freeldr/rtl/libsupp.c Sun Oct 8 12:54:44 2006
@@ -1,0 +1,46 @@
+/*
+ * FreeLoader
+ * Copyright (C) 1998-2003 Brian Palmer <brianp(a)sginet.com>
+ * Copyright (C) 2006 Aleksey Bragin <aleksey(a)reactos.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <freeldr.h>
+
+#ifdef DBG
+VOID FASTCALL
+CHECK_PAGED_CODE_RTL(char *file, int line)
+{
+ // boot-code is always ok
+}
+#endif
+
+PVOID
+STDCALL
+RtlpAllocateMemory(ULONG Bytes,
+ ULONG Tag)
+{
+ return MmAllocateMemory(Bytes);
+}
+
+
+VOID
+STDCALL
+RtlpFreeMemory(PVOID Mem,
+ ULONG Tag)
+{
+ return MmFreeMemory(Mem);
+}
Propchange: trunk/reactos/boot/freeldr/freeldr/rtl/libsupp.c
------------------------------------------------------------------------------
svn:eol-style = native
Author: ion
Date: Sun Oct 8 08:47:26 2006
New Revision: 24439
URL: http://svn.reactos.org/svn/reactos?rev=24439&view=rev
Log:
- More re-shuffling of initialization calls, including enabling access to the blue screen much much earlier (no point in doing it so late, but this change is not that useful since soon we'll have bootvid).
- Split Po init in two, so the early Po init (which we'll need to do eventually) doesn't depent on the later Po init (which uses a PnP notification which depends on the Io system).
- Make I/O initialize quite a bit later.
Modified:
trunk/reactos/ntoskrnl/ex/init.c
trunk/reactos/ntoskrnl/include/internal/po.h
trunk/reactos/ntoskrnl/po/power.c
Modified: trunk/reactos/ntoskrnl/ex/init.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/init.c?rev=244…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/init.c (original)
+++ trunk/reactos/ntoskrnl/ex/init.c Sun Oct 8 08:47:26 2006
@@ -876,6 +876,14 @@
/* Check if GUI Boot is enabled */
if (strstr(KeLoaderBlock->LoadOptions, "NOGUIBOOT")) NoGuiBoot = TRUE;
+ /* Clear the screen to blue and display the boot notice and debug status */
+ HalInitSystem(2, KeLoaderBlock);
+ if (NoGuiBoot) ExpDisplayNotice();
+ KdInitSystem(2, KeLoaderBlock);
+
+ /* Initialize Power Subsystem in Phase 0 */
+ PoInit(0, AcpiTableDetected);
+
/* Query the clock */
if (HalQueryRealTimeClock(&TimeFields))
{
@@ -925,69 +933,61 @@
KeBugCheckEx(PHASE1_INITIALIZATION_FAILED, 3, 0, 0, 0);
}
+ /* Create SystemRoot Link */
+
/* Create NLS section */
ExpInitNls(KeLoaderBlock);
+ /* Initialize Cache Views */
+ CcInitializeCacheManager();
+
+ /* Initialize the Registry (Hives are NOT yet loaded!) */
+ CmInitSystem1();
+
+ /* Update timezone information */
+ ExRefreshTimeZoneInformation(&SystemBootTime);
+
+ /* Initialize the File System Runtime Library */
+ FsRtlInitSystem();
+
+ /* Report all resources used by HAL */
+ HalReportResourceUsage();
+
+ /* Initialize LPC */
+ LpcpInitSystem();
+
/* Initialize I/O Objects, Filesystems, Error Logging and Shutdown */
IoInit();
- /* Initialize Cache Views */
- CcInitializeCacheManager();
-
- /* Initialize the Registry (Hives are NOT yet loaded!) */
- CmInitSystem1();
-
- /* Update timezone information */
- ExRefreshTimeZoneInformation(&SystemBootTime);
-
- /* TBD */
- PoInit(AcpiTableDetected, KeLoaderBlock);
-
/* Unmap Low memory, and initialize the MPW and Balancer Thread */
MmInit3();
- /* Initialize the File System Runtime Library */
- FsRtlInitSystem();
-
- /* Report all resources used by HAL */
- HalReportResourceUsage();
-
- /* Clear the screen to blue */
- HalInitSystem(2, KeLoaderBlock);
-
- /* Display version number and copyright/warranty message */
- if (NoGuiBoot) ExpDisplayNotice();
-
- /* Call KD Providers at Phase 2 */
- KdInitSystem(2, KeLoaderBlock);
-
- /* Initialize LPC */
- LpcpInitSystem();
-
/* Import and Load Registry Hives */
CmInitHives(ExpInTextModeSetup);
+ /* Enter the kernel debugger before starting up the boot drivers */
+ if (KdDebuggerEnabled && KdpEarlyBreak) DbgBreakPoint();
+
+ /* Setup Drivers and Root Device Node */
+ IoInit2(FALSE);
+
+ /* Display the boot screen image if not disabled */
+ if (!NoGuiBoot) InbvEnableBootDriver(TRUE);
+
+ /* Create ARC Names, SystemRoot SymLink, Load Drivers and Assign Letters */
+ IoInit3();
+
+ /* Load the System DLL and its Entrypoints */
+ PsLocateSystemDll();
+
+ /* Initialize shared user page. Set dos system path, dos device map, etc. */
+ InitSystemSharedUserPage(KeLoaderBlock);
+
/* Initialize VDM support */
KeI386VdmInitialize();
- /* Enter the kernel debugger before starting up the boot drivers */
- if (KdDebuggerEnabled && KdpEarlyBreak)
- DbgBreakPoint();
-
- /* Setup Drivers and Root Device Node */
- IoInit2(FALSE);
-
- /* Display the boot screen image if not disabled */
- if (!NoGuiBoot) InbvEnableBootDriver(TRUE);
-
- /* Create ARC Names, SystemRoot SymLink, Load Drivers and Assign Letters */
- IoInit3();
-
- /* Load the System DLL and its Entrypoints */
- PsLocateSystemDll();
-
- /* Initialize shared user page. Set dos system path, dos device map, etc. */
- InitSystemSharedUserPage(KeLoaderBlock);
+ /* Initialize Power Subsystem in Phase 1*/
+ PoInit(1, AcpiTableDetected);
/* Initialize the Process Manager at Phase 1 */
if (!PsInitSystem()) KeBugCheck(PROCESS1_INITIALIZATION_FAILED);
Modified: trunk/reactos/ntoskrnl/include/internal/po.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/po.h (original)
+++ trunk/reactos/ntoskrnl/include/internal/po.h Sun Oct 8 08:47:26 2006
@@ -38,8 +38,8 @@
VOID
NTAPI
PoInit(
- BOOLEAN HaveAcpiTable,
- IN PLOADER_PARAMETER_BLOCK LoaderBlock
+ IN ULONG BootPhase,
+ IN BOOLEAN HaveAcpiTable
);
VOID
Modified: trunk/reactos/ntoskrnl/po/power.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/po/power.c?rev=24…
==============================================================================
--- trunk/reactos/ntoskrnl/po/power.c (original)
+++ trunk/reactos/ntoskrnl/po/power.c Sun Oct 8 08:47:26 2006
@@ -17,6 +17,7 @@
#pragma alloc_text(INIT, PoInit)
#endif
+extern ULONG ExpInitialiationPhase;
typedef struct _REQUEST_POWER_ITEM
{
@@ -306,41 +307,47 @@
VOID
INIT_FUNCTION
NTAPI
-PoInit(BOOLEAN HaveAcpiTable,
- IN PLOADER_PARAMETER_BLOCK LoaderBlock)
-{
- PVOID NotificationEntry;
- PCHAR CommandLine;
- BOOLEAN ForceAcpiDisable = FALSE;
-
- /* Get the Command Line */
- CommandLine = KeLoaderBlock->LoadOptions;
-
- /* Upcase it */
- _strupr(CommandLine);
-
- /* Check for ACPI disable */
- if (strstr(CommandLine, "NOACPI")) ForceAcpiDisable = TRUE;
-
- if (ForceAcpiDisable)
+PoInit(IN ULONG BootPhase,
+ IN BOOLEAN HaveAcpiTable)
+{
+ PVOID NotificationEntry;
+ PCHAR CommandLine;
+ BOOLEAN ForceAcpiDisable = FALSE;
+
+ /* Check if this is phase 1 init */
+ if (BootPhase == 1)
{
- /* Set the ACPI State to False if it's been forced that way */
- PopAcpiPresent = FALSE;
+ /* Registry power button notification */
+ IoRegisterPlugPlayNotification(EventCategoryDeviceInterfaceChange,
+ 0, /* The registry has not been initialized yet */
+ (PVOID)&GUID_DEVICE_SYS_BUTTON,
+ IopRootDeviceNode->
+ PhysicalDeviceObject->DriverObject,
+ PopAddRemoveSysCapsCallback,
+ NULL,
+ &NotificationEntry);
+ return;
}
- else
+
+ /* Get the Command Line */
+ CommandLine = KeLoaderBlock->LoadOptions;
+
+ /* Upcase it */
+ _strupr(CommandLine);
+
+ /* Check for ACPI disable */
+ if (strstr(CommandLine, "NOACPI")) ForceAcpiDisable = TRUE;
+
+ if (ForceAcpiDisable)
{
- /* Otherwise check the LoaderBlock's Flag */
- PopAcpiPresent = HaveAcpiTable;
+ /* Set the ACPI State to False if it's been forced that way */
+ PopAcpiPresent = FALSE;
}
-
- IoRegisterPlugPlayNotification(
- EventCategoryDeviceInterfaceChange,
- 0, /* The registry has not been initialized yet */
- (PVOID)&GUID_DEVICE_SYS_BUTTON,
- IopRootDeviceNode->PhysicalDeviceObject->DriverObject,
- PopAddRemoveSysCapsCallback,
- NULL,
- &NotificationEntry);
+ else
+ {
+ /* Otherwise check the LoaderBlock's Flag */
+ PopAcpiPresent = HaveAcpiTable;
+ }
}
VOID