From a1c9a520cfbcef6d20b3850b3115ac4da47bc940 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Mon, 20 Mar 2000 18:00:55 +0000 Subject: [PATCH] Modified kernel initialization sequence Enabled bus handlers svn path=/trunk/; revision=1087 --- reactos/include/internal/i386/hal.h | 3 +- reactos/include/internal/ntoskrnl.h | 7 +- reactos/ntoskrnl/ex/napi.c | 4 +- reactos/ntoskrnl/hal/x86/bus.c | 222 +++++++++++++++++++--------- reactos/ntoskrnl/hal/x86/halinit.c | 9 +- reactos/ntoskrnl/hal/x86/irq.c | 3 +- reactos/ntoskrnl/hal/x86/isa.c | 40 ++++- reactos/ntoskrnl/ke/main.c | 15 +- reactos/ntoskrnl/mm/mm.c | 32 ++-- 9 files changed, 236 insertions(+), 99 deletions(-) diff --git a/reactos/include/internal/i386/hal.h b/reactos/include/internal/i386/hal.h index 1b70ebeaf7e..006b46b6965 100644 --- a/reactos/include/internal/i386/hal.h +++ b/reactos/include/internal/i386/hal.h @@ -83,7 +83,8 @@ HalpInitBusHandlers (VOID); ULONG STDCALL HalpGetSystemInterruptVector ( - PVOID BusHandler, + PVOID BusHandler, + ULONG BusNumber, ULONG BusInterruptLevel, ULONG BusInterruptVector, PKIRQL Irql, diff --git a/reactos/include/internal/ntoskrnl.h b/reactos/include/internal/ntoskrnl.h index 99aad202b09..95ddfc42060 100644 --- a/reactos/include/internal/ntoskrnl.h +++ b/reactos/include/internal/ntoskrnl.h @@ -72,11 +72,6 @@ typedef struct extern IDT_DESCRIPTOR KiIdt[256]; //extern GDT_DESCRIPTOR KiGdt[256]; -/* - * printf style functions - */ -int vsprintf(char *buf, const char *fmt, va_list args); -int sprintf(char* buf, const char* fmt, ...); VOID NtInitializeEventImplementation(VOID); VOID NtInit(VOID); @@ -84,7 +79,7 @@ VOID NtInit(VOID); /* * Initalization functions (called once by main()) */ -VOID MmInitialize(boot_param* bp, ULONG LastKernelAddress); +VOID MmInitSystem(ULONG Phase, boot_param* bp, ULONG LastKernelAddress); VOID IoInit(VOID); VOID ObInit(VOID); VOID PsInit(VOID); diff --git a/reactos/ntoskrnl/ex/napi.c b/reactos/ntoskrnl/ex/napi.c index 5a9bf458370..ac1f957969e 100644 --- a/reactos/ntoskrnl/ex/napi.c +++ b/reactos/ntoskrnl/ex/napi.c @@ -21,7 +21,9 @@ -KE_SERVICE_DESCRIPTOR_TABLE_ENTRY KeServiceDescriptorTable[SSDT_MAX_ENTRIES] = +KE_SERVICE_DESCRIPTOR_TABLE_ENTRY +__declspec(dllexport) +KeServiceDescriptorTable[SSDT_MAX_ENTRIES] = { { MainSSDT, NULL, NUMBER_OF_SYSCALLS, MainSSPT }, { NULL, NULL, 0, NULL }, diff --git a/reactos/ntoskrnl/hal/x86/bus.c b/reactos/ntoskrnl/hal/x86/bus.c index 3addd514b3e..4625b814613 100644 --- a/reactos/ntoskrnl/hal/x86/bus.c +++ b/reactos/ntoskrnl/hal/x86/bus.c @@ -1,4 +1,5 @@ -/* +/* $Id: bus.c,v 1.4 2000/03/20 17:59:41 ekohl Exp $ + * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel * FILE: ntoskrnl/hal/x86/bus.c @@ -8,14 +9,7 @@ * Created 22/05/98 * * - * NOTE: The bus handler code is under contruction! - * It does NOT work yet! - * * TODO: - * - Add missing default bus handler functions - * - Change ntoskrnl's initialization sequence - * (non-paged pool and spin locks must be available before HalInitSystem() - * is called in system initialization phase 0) * - Add bus handler functions for all busses */ @@ -32,8 +26,35 @@ struct _BUS_HANDLER; +typedef NTSTATUS (STDCALL *pAdjustResourceList) ( + IN struct _BUS_HANDLER *BusHandler, + IN ULONG BusNumber, + IN OUT PCM_RESOURCE_LIST Resources + ); + +typedef NTSTATUS (STDCALL *pAssignSlotResources) ( + IN struct _BUS_HANDLER *BusHandler, + IN ULONG BusNumber, + IN PUNICODE_STRING RegistryPath, + IN PUNICODE_STRING DriverClassName, + IN PDRIVER_OBJECT DriverObject, + IN PDEVICE_OBJECT DeviceObject, + IN ULONG SlotNumber, + IN OUT PCM_RESOURCE_LIST *AllocatedResources + ); + +typedef ULONG (STDCALL *pGetSetBusData) ( + IN struct _BUS_HANDLER *BusHandler, + IN ULONG BusNumber, + IN ULONG SlotNumber, + OUT PVOID Buffer, + IN ULONG Offset, + IN ULONG Length + ); + typedef ULONG (STDCALL *pGetInterruptVector) ( IN struct _BUS_HANDLER *BusHandler, + IN ULONG BusNumber, IN ULONG BusInterruptLevel, IN ULONG BusInterruptVector, OUT PKIRQL Irql, @@ -42,13 +63,12 @@ typedef ULONG (STDCALL *pGetInterruptVector) ( typedef ULONG (STDCALL *pTranslateBusAddress) ( IN struct _BUS_HANDLER *BusHandler, + IN ULONG BusNumber, IN PHYSICAL_ADDRESS BusAddress, - IN ULONG Length, IN OUT PULONG AddressSpace, OUT PPHYSICAL_ADDRESS TranslatedAddress ); - typedef struct _BUS_HANDLER { LIST_ENTRY Entry; @@ -57,9 +77,10 @@ typedef struct _BUS_HANDLER ULONG BusNumber; ULONG RefCount; - PVOID GetBusData; - PVOID SetBusData; - PVOID AssignSlotResources; + pGetSetBusData GetBusData; + pGetSetBusData SetBusData; + pAdjustResourceList AdjustResourceList; + pAssignSlotResources AssignSlotResources; pGetInterruptVector GetInterruptVector; pTranslateBusAddress TranslateBusAddress; @@ -68,16 +89,47 @@ typedef struct _BUS_HANDLER /* GLOBAL VARIABLES **********************************************************/ -//KSPIN_LOCK HalpBusHandlerSpinLock = {0,}; +KSPIN_LOCK HalpBusHandlerSpinLock = {0,}; LIST_ENTRY HalpBusHandlerList; /* FUNCTIONS *****************************************************************/ +static +NTSTATUS +STDCALL +HalpNoAdjustResourceList ( + PBUS_HANDLER BusHandler, + ULONG BusNumber, + PCM_RESOURCE_LIST Resources + ) +{ + return STATUS_UNSUCCESSFUL; +} + +static +NTSTATUS +STDCALL +HalpNoAssignSlotResources ( + PBUS_HANDLER BusHandler, + ULONG BusNumber, + PUNICODE_STRING RegistryPath, + PUNICODE_STRING DriverClassName, + PDRIVER_OBJECT DriverObject, + PDEVICE_OBJECT DeviceObject, + ULONG SlotNumber, + PCM_RESOURCE_LIST *AllocatedResources + ) +{ + return STATUS_NOT_SUPPORTED; +} + static ULONG +STDCALL HalpNoBusData ( PBUS_HANDLER BusHandler, + ULONG BusNumber, ULONG SlotNumber, PVOID Buffer, ULONG Offset, @@ -87,6 +139,35 @@ HalpNoBusData ( return 0; } +static +ULONG +STDCALL +HalpNoGetInterruptVector ( + PBUS_HANDLER BusHandler, + ULONG BusNumber, + ULONG BusInterruptLevel, + ULONG BusInterruptVector, + PKIRQL Irql, + PKAFFINITY Affinity + ) +{ + return 0; +} + +static +ULONG +STDCALL +HalpNoTranslateBusAddress ( + PBUS_HANDLER BusHandler, + ULONG BusNumber, + PHYSICAL_ADDRESS BusAddress, + PULONG AddressSpace, + PPHYSICAL_ADDRESS TranslatedAddress + ) +{ + return 0; +} + PBUS_HANDLER HalpAllocateBusHandler ( @@ -97,7 +178,9 @@ HalpAllocateBusHandler ( { PBUS_HANDLER BusHandler = NULL; -// BusHandler = ExAllocatePool (NonPagedPool, sizeof(BUS_HANDLER)); + DPRINT("HalpAllocateBusHandler()\n"); + + BusHandler = ExAllocatePool (NonPagedPool, sizeof(BUS_HANDLER)); if (BusHandler == NULL) return NULL; @@ -110,27 +193,29 @@ HalpAllocateBusHandler ( BusHandler->BusDataType = BusDataType; BusHandler->BusNumber = BusNumber; - /* initialize handler function table */ + /* initialize default bus handler functions */ BusHandler->GetBusData = HalpNoBusData; BusHandler->SetBusData = HalpNoBusData; -// BusHandler->AdjustResourceList = HalpNoAdjustResourceList; -// BusHandler->AssignSlotResources = HalpNoAssignSlotResources; -// BusHandler->GetInterruptVector = HalpNoGetInterruptVector; -// BusHandler->TranslateBusAddress = HalpNoTranslateBusAddress; + BusHandler->AdjustResourceList = HalpNoAdjustResourceList; + BusHandler->AssignSlotResources = HalpNoAssignSlotResources; + BusHandler->GetInterruptVector = HalpNoGetInterruptVector; + BusHandler->TranslateBusAddress = HalpNoTranslateBusAddress; + /* any more ?? */ + + DPRINT("HalpAllocateBusHandler() done\n"); return BusHandler; } - VOID HalpInitBusHandlers (VOID) { PBUS_HANDLER BusHandler; /* general preparations */ -// KeInitializeSpinLock (&HalpBusHandlerSpinLock); + KeInitializeSpinLock (&HalpBusHandlerSpinLock); InitializeListHead (&HalpBusHandlerList); /* initialize hal dispatch tables */ @@ -148,8 +233,8 @@ HalpInitBusHandlers (VOID) BusHandler = HalpAllocateBusHandler (Internal, ConfigurationSpaceUndefined, 0); -// BusHandler->GetInterruptVector = -// (pGetInterruptVector)HalpGetSystemInterruptVector; + BusHandler->GetInterruptVector = + (pGetInterruptVector)HalpGetSystemInterruptVector; // BusHandler->TranslateBusAddress = // (pTranslateBusAddress)HalpTranslateSystemBusAddress; @@ -157,17 +242,32 @@ HalpInitBusHandlers (VOID) BusHandler = HalpAllocateBusHandler (InterfaceTypeUndefined, Cmos, 0); +// BusHandler->GetBusData = +// (pGetSetBusData)HalpGetCmosData; +// BusHandler->SetBusData = +// (pGetSetBusData)HalpSetCmosData; /* pci bus handler */ BusHandler = HalpAllocateBusHandler (PCIBus, PCIConfiguration, 0); +// BusHandler->GetBusData = +// (pGetSetBusData)HalpGetPciData; +// BusHandler->SetBusData = +// (pGetSetBusData)HalpSetPciData; +// BusHandler->GetInterruptVector = +// (pGetInterruptVector)HalpGetPciInterruptVector; +// BusHandler->AdjustResourceList = +// (pGetSetBusData)HalpAdjustPciResourceList; +// BusHandler->AssignSlotResources = +// (pGetSetBusData)HalpAssignPciSlotResources; /* isa bus handler */ BusHandler = HalpAllocateBusHandler (Isa, ConfigurationSpaceUndefined, 0); - +// BusHandler->TranslateBusAddress = +// (pTranslateBusAddress)HalpTranslateIsaBusAddress; } @@ -180,9 +280,9 @@ HaliHandlerForBus ( { PBUS_HANDLER BusHandler; PLIST_ENTRY CurrentEntry; -// KIRQL OldIrql; + KIRQL OldIrql; -// KeAcquireSpinLock (&HalpBusHandlerSpinLock, &OldIrql); + KeAcquireSpinLock (&HalpBusHandlerSpinLock, &OldIrql); CurrentEntry = HalpBusHandlerList.Flink; while (CurrentEntry != &HalpBusHandlerList) @@ -191,12 +291,12 @@ HaliHandlerForBus ( if (BusHandler->InterfaceType == InterfaceType && BusHandler->BusNumber == BusNumber) { -// KeReleaseSpinLock (&HalpBusHandlerSpinLock, OldIrql); + KeReleaseSpinLock (&HalpBusHandlerSpinLock, OldIrql); return BusHandler; } CurrentEntry = CurrentEntry->Flink; } -// KeReleaseSpinLock (&HalpBusHandlerSpinLock, OldIrql); + KeReleaseSpinLock (&HalpBusHandlerSpinLock, OldIrql); return NULL; } @@ -211,9 +311,9 @@ HaliHandlerForConfigSpace ( { PBUS_HANDLER BusHandler; PLIST_ENTRY CurrentEntry; -// KIRQL OldIrql; + KIRQL OldIrql; -// KeAcquireSpinLock (&HalpBusHandlerSpinLock, &OldIrql); + KeAcquireSpinLock (&HalpBusHandlerSpinLock, &OldIrql); CurrentEntry = HalpBusHandlerList.Flink; while (CurrentEntry != &HalpBusHandlerList) @@ -222,12 +322,12 @@ HaliHandlerForConfigSpace ( if (BusHandler->BusDataType == BusDataType && BusHandler->BusNumber == BusNumber) { -// KeReleaseSpinLock (&HalpBusHandlerSpinLock, OldIrql); + KeReleaseSpinLock (&HalpBusHandlerSpinLock, OldIrql); return BusHandler; } CurrentEntry = CurrentEntry->Flink; } -// KeReleaseSpinLock (&HalpBusHandlerSpinLock, OldIrql); + KeReleaseSpinLock (&HalpBusHandlerSpinLock, OldIrql); return NULL; } @@ -242,9 +342,9 @@ HaliReferenceHandlerForBus ( { PBUS_HANDLER BusHandler; PLIST_ENTRY CurrentEntry; -// KIRQL OldIrql; + KIRQL OldIrql; -// KeAcquireSpinLock (&HalpBusHandlerSpinLock, &OldIrql); + KeAcquireSpinLock (&HalpBusHandlerSpinLock, &OldIrql); CurrentEntry = HalpBusHandlerList.Flink; while (CurrentEntry != &HalpBusHandlerList) @@ -254,12 +354,12 @@ HaliReferenceHandlerForBus ( BusHandler->BusNumber == BusNumber) { BusHandler->RefCount++; -// KeReleaseSpinLock (&HalpBusHandlerSpinLock, OldIrql); + KeReleaseSpinLock (&HalpBusHandlerSpinLock, OldIrql); return BusHandler; } CurrentEntry = CurrentEntry->Flink; } -// KeReleaseSpinLock (&HalpBusHandlerSpinLock, OldIrql); + KeReleaseSpinLock (&HalpBusHandlerSpinLock, OldIrql); return NULL; } @@ -274,9 +374,9 @@ HaliReferenceHandlerForConfigSpace ( { PBUS_HANDLER BusHandler; PLIST_ENTRY CurrentEntry; -// KIRQL OldIrql; + KIRQL OldIrql; -// KeAcquireSpinLock (&HalpBusHandlerSpinLock, &OldIrql); + KeAcquireSpinLock (&HalpBusHandlerSpinLock, &OldIrql); CurrentEntry = HalpBusHandlerList.Flink; while (CurrentEntry != &HalpBusHandlerList) @@ -286,12 +386,12 @@ HaliReferenceHandlerForConfigSpace ( BusHandler->BusNumber == BusNumber) { BusHandler->RefCount++; -// KeReleaseSpinLock (&HalpBusHandlerSpinLock, OldIrql); + KeReleaseSpinLock (&HalpBusHandlerSpinLock, OldIrql); return BusHandler; } CurrentEntry = CurrentEntry->Flink; } -// KeReleaseSpinLock (&HalpBusHandlerSpinLock, OldIrql); + KeReleaseSpinLock (&HalpBusHandlerSpinLock, OldIrql); return NULL; } @@ -303,13 +403,13 @@ HaliDereferenceBusHandler ( PBUS_HANDLER BusHandler ) { -// KIRQL OldIrql; + KIRQL OldIrql; -// KeAcquireSpinLock (&HalpBusHandlerSpinLock, &OldIrql); + KeAcquireSpinLock (&HalpBusHandlerSpinLock, &OldIrql); BusHandler->RefCount--; -// KeReleaseSpinLock (&HalpBusHandlerSpinLock, OldIrql); + KeReleaseSpinLock (&HalpBusHandlerSpinLock, OldIrql); } @@ -319,7 +419,6 @@ HalAdjustResourceList ( PCM_RESOURCE_LIST Resources ) { -#if 0 PBUS_HANDLER BusHandler; NTSTATUS Status; @@ -329,14 +428,12 @@ HalAdjustResourceList ( return STATUS_SUCCESS; Status = BusHandler->AdjustResourceList (BusHandler, - BusHandler, + Resources->List[0].BusNumber, Resources); HaliDereferenceBusHandler (BusHandler); return Status; -#endif - UNIMPLEMENTED; } @@ -353,17 +450,16 @@ HalAssignSlotResources ( PCM_RESOURCE_LIST *AllocatedResources ) { -#if 0 PBUS_HANDLER BusHandler; NTSTATUS Status; - BusHandler = HaliReferenceHandlerForBus (InterfaceType, + BusHandler = HaliReferenceHandlerForBus (BusType, BusNumber); if (BusHandler == NULL) return STATUS_NOT_FOUND; Status = BusHandler->AssignSlotResources (BusHandler, - BusHandler, + BusNumber, RegistryPath, DriverClassName, DriverObject, @@ -374,8 +470,6 @@ HalAssignSlotResources ( HaliDereferenceBusHandler (BusHandler); return Status; -#endif - UNIMPLEMENTED; } @@ -409,7 +503,6 @@ HalGetBusDataByOffset ( ULONG Length ) { -#if 0 PBUS_HANDLER BusHandler; ULONG Result; @@ -419,6 +512,7 @@ HalGetBusDataByOffset ( return 0; Result = BusHandler->GetBusData (BusHandler, + BusNumber, SlotNumber, Buffer, Offset, @@ -427,8 +521,6 @@ HalGetBusDataByOffset ( HaliDereferenceBusHandler (BusHandler); return Result; -#endif - UNIMPLEMENTED; } @@ -443,7 +535,6 @@ HalGetInterruptVector ( PKAFFINITY Affinity ) { -#if 0 PBUS_HANDLER BusHandler; ULONG Result; @@ -453,6 +544,7 @@ HalGetInterruptVector ( return 0; Result = BusHandler->GetInterruptVector (BusHandler, + BusNumber, BusInterruptLevel, BusInterruptVector, Irql, @@ -461,12 +553,6 @@ HalGetInterruptVector ( HaliDereferenceBusHandler (BusHandler); return Result; -#endif - return (HalpGetSystemInterruptVector (NULL, - BusInterruptLevel, - BusInterruptVector, - Irql, - Affinity)); } @@ -500,7 +586,6 @@ HalSetBusDataByOffset ( ULONG Length ) { -#if 0 PBUS_HANDLER BusHandler; ULONG Result; @@ -510,7 +595,7 @@ HalSetBusDataByOffset ( return 0; Result = BusHandler->SetBusData (BusHandler, - BusHandler, + BusNumber, SlotNumber, Buffer, Offset, @@ -519,8 +604,6 @@ HalSetBusDataByOffset ( HaliDereferenceBusHandler (BusHandler); return Result; -#endif - UNIMPLEMENTED; } @@ -534,7 +617,6 @@ HalTranslateBusAddress ( PPHYSICAL_ADDRESS TranslatedAddress ) { -#if 0 PBUS_HANDLER BusHandler; BOOLEAN Result; @@ -544,7 +626,7 @@ HalTranslateBusAddress ( return FALSE; Result = BusHandler->TranslateBusAddress (BusHandler, - BusHandler, + BusNumber, BusAddress, AddressSpace, TranslatedAddress); @@ -552,8 +634,6 @@ HalTranslateBusAddress ( HaliDereferenceBusHandler (BusHandler); return Result; -#endif - UNIMPLEMENTED; } /* EOF */ diff --git a/reactos/ntoskrnl/hal/x86/halinit.c b/reactos/ntoskrnl/hal/x86/halinit.c index 1f17f843f9a..d598a50a7c0 100644 --- a/reactos/ntoskrnl/hal/x86/halinit.c +++ b/reactos/ntoskrnl/hal/x86/halinit.c @@ -1,4 +1,4 @@ -/* $Id: halinit.c,v 1.8 2000/03/19 13:34:47 ekohl Exp $ +/* $Id: halinit.c,v 1.9 2000/03/20 17:59:42 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -31,13 +31,12 @@ HalInitSystem ( if (Phase == 0) { HalInitializeDisplay (bp); - } - else - { KeInitExceptions(); KeInitIRQ(); KeLowerIrql(DISPATCH_LEVEL); - + } + else + { HalpInitBusHandlers (); /* diff --git a/reactos/ntoskrnl/hal/x86/irq.c b/reactos/ntoskrnl/hal/x86/irq.c index d9641f7b6ea..d703360a1ff 100644 --- a/reactos/ntoskrnl/hal/x86/irq.c +++ b/reactos/ntoskrnl/hal/x86/irq.c @@ -1,4 +1,4 @@ -/* $Id: irq.c,v 1.8 2000/03/19 13:34:47 ekohl Exp $ +/* $Id: irq.c,v 1.9 2000/03/20 17:59:42 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -369,6 +369,7 @@ VOID IoDisconnectInterrupt(PKINTERRUPT InterruptObject) ULONG STDCALL HalpGetSystemInterruptVector(PVOID BusHandler, + ULONG BusNumber, ULONG BusInterruptLevel, ULONG BusInterruptVector, PKIRQL Irql, diff --git a/reactos/ntoskrnl/hal/x86/isa.c b/reactos/ntoskrnl/hal/x86/isa.c index 83b98ea037f..8428f6ef08d 100644 --- a/reactos/ntoskrnl/hal/x86/isa.c +++ b/reactos/ntoskrnl/hal/x86/isa.c @@ -1,4 +1,5 @@ -/* +/* $Id: isa.c,v 1.5 2000/03/20 17:59:42 ekohl Exp $ + * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel * FILE: ntoskrnl/hal/isa.c @@ -29,3 +30,40 @@ BOOL HalIsaProbe(VOID) */ return(TRUE); } + +#if 0 +BOOLEAN +STDCALL +HalpTranslateIsaBusAddress ( + PBUS_HANDLER BusHandler, + ULONG BusNumber, + PHYSICAL_ADDRESS BusAddress, + PULONG AddressSpace, + PPHYSICAL_ADDRESS TranslatedAddress + ) +{ + BOOLEAN Result; + + Result = HalpTranslateSystemBusAddress (BusHandler, + BusNumber, + BusAddress, + AddressSpace, + TranslatedAddress); + if (Result != FALSE) + return Result; + + /* PCI does not provide memory address space */ + if (*AddressSpace == 0) + return Result; + + Result = HalTranslateBusAddress (PCIBus, + BusNumber, + BusAddress, + AddressSpace, + TranslatedAddress); + + return Result; +} +#endif + +/* EOF */ diff --git a/reactos/ntoskrnl/ke/main.c b/reactos/ntoskrnl/ke/main.c index 89654d6213e..25ac81fb3fa 100644 --- a/reactos/ntoskrnl/ke/main.c +++ b/reactos/ntoskrnl/ke/main.c @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.40 2000/03/16 18:44:56 dwelch Exp $ +/* $Id: main.c,v 1.41 2000/03/20 18:00:24 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -178,7 +178,7 @@ asmlinkage void _main(boot_param* _bp) strcpy (bp.kernel_parameters, "/DEBUGPORT=SCREEN"); /* - * Initalize the hal (Phase 0) + * Initialization phase 0 */ HalInitSystem (0, &bp); @@ -203,6 +203,9 @@ asmlinkage void _main(boot_param* _bp) PAGE_ROUND_UP(bp.module_length[i]); } + DPRINT("MmInitSystem()\n"); + MmInitSystem(0, &bp, last_kernel_address); + /* * Initialize the kernel debugger */ @@ -213,12 +216,16 @@ asmlinkage void _main(boot_param* _bp) // } /* + * Initialization phase 1 * Initalize various critical subsystems */ + DPRINT("Kernel Initialization Phase 1\n"); + DPRINT("HalInitSystem()\n"); HalInitSystem (1, &bp); - DPRINT("MmInitialize()\n"); - MmInitialize(&bp, last_kernel_address); + DPRINT("MmInitSystem()\n"); + MmInitSystem(1, &bp, 0); + DPRINT("KeInit()\n"); KeInit(); DPRINT("ExInit()\n"); diff --git a/reactos/ntoskrnl/mm/mm.c b/reactos/ntoskrnl/mm/mm.c index 0ad770f4b3a..d36e9d738a9 100644 --- a/reactos/ntoskrnl/mm/mm.c +++ b/reactos/ntoskrnl/mm/mm.c @@ -1,4 +1,5 @@ -/* +/* $Id: mm.c,v 1.24 2000/03/20 18:00:55 ekohl Exp $ + * * COPYRIGHT: See COPYING in the top directory * PROJECT: ReactOS kernel * FILE: ntoskrnl/mm/mm.c @@ -109,19 +110,14 @@ VOID MmInitVirtualMemory(boot_param* bp) Length = ParamLength; MmCreateMemoryArea(KernelMode,NULL,MEMORY_AREA_SYSTEM,&BaseAddress, Length,0,&kernel_param_desc); - + BaseAddress = (PVOID)(KERNEL_BASE + PAGE_ROUND_UP(kernel_len) + PAGESIZE); Length = NONPAGED_POOL_SIZE; MmCreateMemoryArea(KernelMode,NULL,MEMORY_AREA_SYSTEM,&BaseAddress, Length,0,&kernel_pool_desc); - + // MmDumpMemoryAreas(); - CHECKPOINT; - -// while (inb_p(0x60)!=0x1); inb_p(0x60); - - MmInitSectionImplementation(); - MmInitPagingFile(); + DPRINT("MmInitVirtualMemory() done\n"); } NTSTATUS MmCommitedSectionHandleFault(MEMORY_AREA* MemoryArea, PVOID Address) @@ -406,3 +402,21 @@ void MmInitialize(boot_param* bp, ULONG LastKernelAddress) */ MmInitVirtualMemory(bp); } + +VOID +MmInitSystem (ULONG Phase, boot_param* bp, ULONG LastKernelAddress) +{ + if (Phase == 0) + { + /* Phase 0 Initialization */ + MmInitialize (bp, LastKernelAddress); + } + else + { + /* Phase 1 Initialization */ + MmInitSectionImplementation(); + MmInitPagingFile(); + } +} + +/* EOF */