Author: ion Date: Sat Sep 2 08:40:09 2006 New Revision: 23880
URL: http://svn.reactos.org/svn/reactos?rev=23880&view=rev Log: - More Initialization changes: - Initialize bugcheck lists, timer DPC, profile list/locks, timer lists, the swap lists and syscall table as part of KiInitSystem (portable). - Add more initialization for the initial/idle process+thread (some code disabled due to dispatcher problems). - Add code to support future Timer implementation (based on tick-hashes) - Separate post-boostrap initialization code in KiInitializeKernel. - Add some support for future SMP paths. - Create a DPC stack. - Changes based on WI4 and my automated parsing tool.
Modified: trunk/reactos/ntoskrnl/ex/init.c trunk/reactos/ntoskrnl/include/internal/ke.h trunk/reactos/ntoskrnl/ke/bug.c trunk/reactos/ntoskrnl/ke/clock.c trunk/reactos/ntoskrnl/ke/dpc.c trunk/reactos/ntoskrnl/ke/i386/kernel.c trunk/reactos/ntoskrnl/ke/process.c trunk/reactos/ntoskrnl/ke/timer.c
Modified: trunk/reactos/ntoskrnl/ex/init.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/init.c?rev=2388... ============================================================================== --- trunk/reactos/ntoskrnl/ex/init.c (original) +++ trunk/reactos/ntoskrnl/ex/init.c Sat Sep 2 08:40:09 2006 @@ -25,9 +25,6 @@ extern ULONG_PTR LastKernelAddress; extern LOADER_MODULE KeLoaderModules[64]; extern PRTL_MESSAGE_RESOURCE_DATA KiBugCodeMessages; -extern LIST_ENTRY KiProfileListHead; -extern LIST_ENTRY KiProfileSourceListHead; -extern KSPIN_LOCK KiProfileLock; BOOLEAN SetupMode = TRUE; BOOLEAN NoGuiBoot = FALSE;
@@ -503,6 +500,9 @@ /* Check if the structures match the ASM offset constants */ ExecuteRuntimeAsserts();
+ /* Initialize HAL */ + HalInitSystem (0, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock); + /* Sets up the Text Sections of the Kernel and HAL for debugging */ LdrInit1();
@@ -531,11 +531,6 @@
/* Bring back the IRQL to Passive */ KeLowerIrql(PASSIVE_LEVEL); - - /* Initialize Profiling */ - InitializeListHead(&KiProfileListHead); - InitializeListHead(&KiProfileSourceListHead); - KeInitializeSpinLock(&KiProfileLock);
/* Initialize resources */ ExpResourceInitialization();
Modified: trunk/reactos/ntoskrnl/include/internal/ke.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/k... ============================================================================== --- trunk/reactos/ntoskrnl/include/internal/ke.h (original) +++ trunk/reactos/ntoskrnl/include/internal/ke.h Sat Sep 2 08:40:09 2006 @@ -48,6 +48,12 @@ PKINTERRUPT_ROUTINE ChainedDispatch; PKINTERRUPT_ROUTINE *FlatDispatch; } DISPATCH_INFO, *PDISPATCH_INFO; + +typedef struct _KTIMER_TABLE_ENTRY +{ + LIST_ENTRY Entry; + ULARGE_INTEGER Time; +} KTIMER_TABLE_ENTRY, *PKTIMER_TABLE_ENTRY;
typedef PCHAR (NTAPI *PKE_BUGCHECK_UNICODE_TO_ANSI)( @@ -94,6 +100,19 @@ extern ULONG KiMinimumDpcRate; extern ULONG KiAdjustDpcThreshold; extern ULONG KiIdealDpcRate; +extern LARGE_INTEGER KiTimeIncrementReciprocal; +extern UCHAR KiTimeIncrementShiftCount; +extern LIST_ENTRY BugcheckCallbackListHead, BugcheckReasonCallbackListHead; +extern KSPIN_LOCK BugCheckCallbackLock; +extern KDPC KiExpireTimerDpc; +extern KTIMER_TABLE_ENTRY KiTimerTableListHead[TIMER_TABLE_SIZE]; +extern LIST_ENTRY KiTimerListHead; +extern KMUTEX KiGenericCallDpcMutex; +extern LIST_ENTRY KiProfileListHead, KiProfileSourceListHead; +extern KSPIN_LOCK KiProfileLock; +extern LIST_ENTRY KiProcessInSwapListHead, KiProcessOutSwapListHead; +extern LIST_ENTRY KiStackInSwapListHead; +extern KEVENT KiSwapEvent;
/* MACROS *************************************************************************/
Modified: trunk/reactos/ntoskrnl/ke/bug.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/bug.c?rev=23880... ============================================================================== --- trunk/reactos/ntoskrnl/ke/bug.c (original) +++ trunk/reactos/ntoskrnl/ke/bug.c Sat Sep 2 08:40:09 2006 @@ -28,6 +28,7 @@
LIST_ENTRY BugcheckCallbackListHead; LIST_ENTRY BugcheckReasonCallbackListHead; +KSPIN_LOCK BugCheckCallbackLock; ULONG KeBugCheckActive, KeBugCheckOwner; LONG KeBugCheckOwnerRecursionCount; PRTL_MESSAGE_RESOURCE_DATA KiBugCodeMessages; @@ -125,10 +126,6 @@ LDR_RESOURCE_INFO ResourceInfo; PIMAGE_RESOURCE_DATA_ENTRY ResourceDataEntry; NTSTATUS Status; - - /* Initialize Callbadk Listhead and State */ - InitializeListHead(&BugcheckCallbackListHead); - InitializeListHead(&BugcheckReasonCallbackListHead);
/* Cache the Bugcheck Message Strings. Prepare the Lookup Data */ ResourceInfo.Type = 11;
Modified: trunk/reactos/ntoskrnl/ke/clock.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/clock.c?rev=238... ============================================================================== --- trunk/reactos/ntoskrnl/ke/clock.c (original) +++ trunk/reactos/ntoskrnl/ke/clock.c Sat Sep 2 08:40:09 2006 @@ -77,9 +77,6 @@ KiInitializeSystemClock(VOID) { TIME_FIELDS TimeFields; - - InitializeListHead(&KiTimerListHead); - KeInitializeDpc(&KiExpireTimerDpc, (PKDEFERRED_ROUTINE)KiExpireTimers, 0);
/* Calculate the starting time for the system clock */ HalQueryRealTimeClock(&TimeFields);
Modified: trunk/reactos/ntoskrnl/ke/dpc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/dpc.c?rev=23880... ============================================================================== --- trunk/reactos/ntoskrnl/ke/dpc.c (original) +++ trunk/reactos/ntoskrnl/ke/dpc.c Sat Sep 2 08:40:09 2006 @@ -29,6 +29,7 @@ ULONG KiMinimumDpcRate = 3; ULONG KiAdjustDpcThreshold = 20; ULONG KiIdealDpcRate = 20; +KMUTEX KiGenericCallDpcMutex;
/* TYPES *******************************************************************/
Modified: trunk/reactos/ntoskrnl/ke/i386/kernel.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/kernel.c?r... ============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/kernel.c (original) +++ trunk/reactos/ntoskrnl/ke/i386/kernel.c Sat Sep 2 08:40:09 2006 @@ -13,6 +13,7 @@ #include <ntoskrnl.h> #define NDEBUG #include <internal/debug.h> +#include <internal/napi.h>
/* GLOBALS *******************************************************************/
@@ -23,6 +24,8 @@ PKPRCB KiProcessorBlock[MAXIMUM_PROCESSORS]; ETHREAD KiInitialThread; EPROCESS KiInitialProcess; + +extern LIST_ENTRY KiProcessListHead; extern ULONG Ke386GlobalPagesEnabled;
/* System-defined Spinlocks */ @@ -44,12 +47,132 @@ KSPIN_LOCK KiTimerTableLock[16]; KSPIN_LOCK KiReverseStallIpiLock;
+KSPIN_LOCK KiFreezeExecutionLock; +KSPIN_LOCK Ki486CompatibilityLock; + #if defined (ALLOC_PRAGMA) #pragma alloc_text(INIT, KeInit1) #pragma alloc_text(INIT, KeInit2) #endif
/* FUNCTIONS *****************************************************************/ + +VOID +NTAPI +KiInitSystem(VOID) +{ + ULONG i; + + /* Initialize Bugcheck Callback data */ + InitializeListHead(&BugcheckCallbackListHead); + InitializeListHead(&BugcheckReasonCallbackListHead); + KeInitializeSpinLock(&BugCheckCallbackLock); + + /* Initialize the Timer Expiration DPC */ + KeInitializeDpc(&KiExpireTimerDpc, KiExpireTimers, NULL); + KeSetTargetProcessorDpc(&KiExpireTimerDpc, 0); + + /* Initialize Profiling data */ + KeInitializeSpinLock(&KiProfileLock); + InitializeListHead(&KiProfileListHead); + InitializeListHead(&KiProfileSourceListHead); + + /* Loop the timer table */ + for (i = 0; i < TIMER_TABLE_SIZE; i++) + { + /* Initialize the list and entries */ + InitializeListHead(&KiTimerTableListHead[i].Entry); + KiTimerTableListHead[i].Time.HighPart = 0xFFFFFFFF; + KiTimerTableListHead[i].Time.LowPart = 0; + } + + /* Initialize old-style list */ + InitializeListHead(&KiTimerListHead); + + /* Initialize the Swap event and all swap lists */ + KeInitializeEvent(&KiSwapEvent, SynchronizationEvent, FALSE); + InitializeListHead(&KiProcessInSwapListHead); + InitializeListHead(&KiProcessOutSwapListHead); + InitializeListHead(&KiStackInSwapListHead); + + /* Initialize the mutex for generic DPC calls */ + KeInitializeMutex(&KiGenericCallDpcMutex, 0); + + /* Initialize the syscall table */ + KeServiceDescriptorTable[0].Base = MainSSDT; + KeServiceDescriptorTable[0].Count = NULL; + KeServiceDescriptorTable[0].Limit = NUMBER_OF_SYSCALLS; + KeServiceDescriptorTable[1].Limit = 0; + KeServiceDescriptorTable[0].Number = MainSSPT; + + /* Copy the the current table into the shadow table for win32k */ + RtlCopyMemory(KeServiceDescriptorTableShadow, + KeServiceDescriptorTable, + sizeof(KeServiceDescriptorTable)); +} + +LARGE_INTEGER +NTAPI +KiComputeReciprocal(IN LONG Divisor, + OUT PUCHAR Shift) +{ + LARGE_INTEGER Reciprocal = {{0}}; + LONG BitCount = 0, Remainder = 1; + + /* Start by calculating the remainder */ + while (Reciprocal.HighPart >= 0) + { + /* Increase the loop (bit) count */ + BitCount++; + + /* Calculate the current fraction */ + Reciprocal.HighPart = (Reciprocal.HighPart << 1) | + (Reciprocal.LowPart >> 31); + Reciprocal.LowPart <<= 1; + + /* Double the remainder and see if we went past the divisor */ + Remainder <<= 1; + if (Remainder >= Divisor) + { + /* Set the low-bit and calculate the new remainder */ + Remainder -= Divisor; + Reciprocal.LowPart |= 1; + } + } + + /* Check if we have a remainder */ + if (Remainder) + { + /* Check if the current fraction value is too large */ + if ((Reciprocal.LowPart == 0xFFFFFFFF) && + (Reciprocal.HighPart == 0xFFFFFFFF)) + { + /* Set the high bit and reduce the bit count */ + Reciprocal.LowPart = 0; + Reciprocal.HighPart = 0x80000000; + BitCount--; + } + else + { + /* Check if only the lowest bits got too large */ + if (Reciprocal.LowPart == 0xFFFFFFFF) + { + /* Reset them and increase the high bits instead */ + Reciprocal.LowPart = 0; + Reciprocal.HighPart++; + } + else + { + /* All is well, increase the low bits */ + Reciprocal.LowPart++; + } + } + } + + /* Now calculate the actual shift and return the reciprocal */ + *Shift = (UCHAR)BitCount - 64; + return Reciprocal; +}
VOID NTAPI @@ -78,7 +201,7 @@ Prcb->MinimumDpcRate = KiMinimumDpcRate; Prcb->AdjustDpcThreshold = KiAdjustDpcThreshold; KeInitializeDpc(&Prcb->CallDpc, NULL, NULL); - //KeSetTargetProcessorDpc(&Prcb->CallDpc, Number); + KeSetTargetProcessorDpc(&Prcb->CallDpc, Number); KeSetImportanceDpc(&Prcb->CallDpc, HighImportance);
/* Initialize the Wait List Head */ @@ -202,6 +325,215 @@
VOID NTAPI +KiInitializeKernel(IN PKPROCESS InitProcess, + IN PKTHREAD InitThread, + IN PVOID IdleStack, + IN PKPRCB Prcb, + IN CCHAR Number, + IN PROS_LOADER_PARAMETER_BLOCK LoaderBlock) +{ + BOOLEAN NpxPresent; + ULONG FeatureBits; + LARGE_INTEGER PageDirectory; + PVOID DpcStack; + + /* Detect and set the CPU Type */ + KiSetProcessorType(); + + /* Set CR0 features based on detected CPU */ + KiSetCR0Bits(); + + /* Check if an FPU is present */ + NpxPresent = KiIsNpxPresent(); + + /* Initialize the Power Management Support for this PRCB */ + PoInitializePrcb(Prcb); + + /* Bugcheck if this is a 386 CPU */ + if (Prcb->CpuType == 3) KeBugCheckEx(0x5D, 0x386, 0, 0, 0); + + /* Get the processor features for the CPU */ + FeatureBits = KiGetFeatureBits(); + + /* Save feature bits */ + Prcb->FeatureBits = FeatureBits; + + /* Get cache line information for this CPU */ + KiGetCacheInformation(); + + /* Initialize spinlocks and DPC data */ + KiInitSpinLocks(Prcb, Number); + + /* Check if this is the Boot CPU */ + if (!Number) + { + /* Set Node Data */ + KeNodeBlock[0] = &KiNode0; + Prcb->ParentNode = KeNodeBlock[0]; + KeNodeBlock[0]->ProcessorMask = Prcb->SetMember; + + /* Set boot-level flags */ + KeI386NpxPresent = NpxPresent; + KeI386CpuType = Prcb->CpuType; + KeI386CpuStep = Prcb->CpuStep; + KeProcessorArchitecture = 0; + KeProcessorLevel = (USHORT)Prcb->CpuType; + if (Prcb->CpuID) KeProcessorRevision = Prcb->CpuStep; + KeFeatureBits = FeatureBits; + KeI386FxsrPresent = (KeFeatureBits & KF_FXSR) ? TRUE : FALSE; + KeI386XMMIPresent = (KeFeatureBits & KF_XMMI) ? TRUE : FALSE; + + /* Set the current MP Master KPRCB to the Boot PRCB */ + Prcb->MultiThreadSetMaster = Prcb; + + /* Initialize some spinlocks */ + KeInitializeSpinLock(&KiFreezeExecutionLock); + KeInitializeSpinLock(&Ki486CompatibilityLock); + + /* Initialize portable parts of the OS */ + KiInitSystem(); + + /* Initialize the Idle Process and the Process Listhead */ + InitializeListHead(&KiProcessListHead); + PageDirectory.QuadPart = 0; + KeInitializeProcess(InitProcess, + 0, + 0xFFFFFFFF, + PageDirectory); + InitProcess->QuantumReset = MAXCHAR; + } + else + { + /* FIXME */ + DPRINT1("SMP Boot support not yet present\n"); + } + + /* Check if Fxsr was found */ + if (KeI386FxsrPresent) + { + /* Enable it. FIXME: Send an IPI */ + Ke386SetCr4(Ke386GetCr4() | X86_CR4_OSFXSR); + + /* Check if XMM was found too */ + if (KeI386XMMIPresent) + { + /* Enable it: FIXME: Send an IPI. */ + Ke386SetCr4(Ke386GetCr4() | X86_CR4_OSXMMEXCPT); + + /* FIXME: Implement and enable XMM Page Zeroing for Mm */ + } + } + + if (KeFeatureBits & KF_GLOBAL_PAGE) + { + ULONG Flags; + /* Enable global pages */ + Ke386GlobalPagesEnabled = TRUE; + Ke386SaveFlags(Flags); + Ke386DisableInterrupts(); + Ke386SetCr4(Ke386GetCr4() | X86_CR4_PGE); + Ke386RestoreFlags(Flags); + } + + if (KeFeatureBits & KF_FAST_SYSCALL) + { + extern void KiFastCallEntry(void); + + /* CS Selector of the target segment. */ + Ke386Wrmsr(0x174, KGDT_R0_CODE, 0); + /* Target ESP. */ + Ke386Wrmsr(0x175, 0, 0); + /* Target EIP. */ + Ke386Wrmsr(0x176, (ULONG_PTR)KiFastCallEntry, 0); + } + + /* Does the CPU Support 'prefetchnta' (SSE) */ + if(KeFeatureBits & KF_XMMI) + { + ULONG Protect; + + Protect = MmGetPageProtect(NULL, (PVOID)RtlPrefetchMemoryNonTemporal); + MmSetPageProtect(NULL, (PVOID)RtlPrefetchMemoryNonTemporal, Protect | PAGE_IS_WRITABLE); + /* Replace the ret by a nop */ + *(PCHAR)RtlPrefetchMemoryNonTemporal = 0x90; + MmSetPageProtect(NULL, (PVOID)RtlPrefetchMemoryNonTemporal, Protect); + } + +#if 0 + /* Setup the Idle Thread */ + KeInitializeThread(InitProcess, + InitThread, + NULL, + NULL, + NULL, + NULL, + NULL, + IdleStack); +#endif + InitThread->NextProcessor = Number; + InitThread->Priority = HIGH_PRIORITY; + InitThread->State = Running; + InitThread->Affinity = 1 << Number; + InitThread->WaitIrql = DISPATCH_LEVEL; + InitProcess->ActiveProcessors = 1 << Number; + + /* Set up the thread-related fields in the PRCB */ + //Prcb->CurrentThread = InitThread; + Prcb->NextThread = NULL; + //Prcb->IdleThread = InitThread; + + /* Initialize the Debugger */ + KdInitSystem (0, &KeLoaderBlock); + + /* Initialize the Kernel Executive */ + ExpInitializeExecutive(); + + /* Only do this on the boot CPU */ + if (!Number) + { + /* Calculate the time reciprocal */ + KiTimeIncrementReciprocal = + KiComputeReciprocal(KeMaximumIncrement, + &KiTimeIncrementShiftCount); + + /* Update DPC Values in case they got updated by the executive */ + Prcb->MaximumDpcQueueDepth = KiMaximumDpcQueueDepth; + Prcb->MinimumDpcRate = KiMinimumDpcRate; + Prcb->AdjustDpcThreshold = KiAdjustDpcThreshold; + + /* Allocate the DPC Stack */ + DpcStack = MmCreateKernelStack(FALSE); + if (!DpcStack) KeBugCheckEx(NO_PAGES_AVAILABLE, 1, 0, 0, 0); + Prcb->DpcStack = DpcStack; + + /* Allocate the IOPM save area. */ + Ki386IopmSaveArea = ExAllocatePoolWithTag(PagedPool, + PAGE_SIZE * 2, + TAG('K', 'e', ' ', ' ')); + if (!Ki386IopmSaveArea) + { + /* Bugcheck. We need this for V86/VDM support. */ + KeBugCheckEx(NO_PAGES_AVAILABLE, 2, PAGE_SIZE * 2, 0, 0); + } + } + + /* Free Initial Memory */ + MiFreeInitMemory(); + + while (1) + { + LARGE_INTEGER Timeout; + Timeout.QuadPart = 0x7fffffffffffffffLL; + KeDelayExecutionThread(KernelMode, FALSE, &Timeout); + } + + /* Bug Check and loop forever if anything failed */ + KEBUGCHECK(0); + for(;;); +} + +VOID +NTAPI KiSystemStartup(IN PROS_LOADER_PARAMETER_BLOCK LoaderBlock, IN ULONG DriverBase) // FIXME: hackhack { @@ -209,11 +541,9 @@ ULONG Cpu = 0; PKIPCR Pcr = (PKIPCR)KPCR_BASE; PKPRCB Prcb; - BOOLEAN NpxPresent; - ULONG FeatureBits; ULONG DriverSize; extern KGDTENTRY KiBootGdt[]; - extern PVOID trap_stack; + extern PVOID trap_stack, init_stack; extern KTSS KiBootTss;
/* Initialize the PCR */ @@ -267,135 +597,13 @@ /* Raise to HIGH_LEVEL */ KfRaiseIrql(HIGH_LEVEL);
- /* Detect and set the CPU Type */ - KiSetProcessorType(); - - /* Set CR0 features based on detected CPU */ - KiSetCR0Bits(); - - /* Check if an FPU is present */ - NpxPresent = KiIsNpxPresent(); - - /* Initialize the Power Management Support for this PRCB */ - PoInitializePrcb(Prcb); - - /* Bugcheck if this is a 386 CPU */ - if (Prcb->CpuType == 3) KeBugCheckEx(0x5D, 0x386, 0, 0, 0); - - /* Get the processor features for the CPU */ - FeatureBits = KiGetFeatureBits(); - - /* Save feature bits */ - Prcb->FeatureBits = FeatureBits; - - /* Get cache line information for this CPU */ - KiGetCacheInformation(); - - /* Initialize spinlocks and DPC data */ - KiInitSpinLocks(Prcb, 0); - - /* Set Node Data */ - KeNodeBlock[0] = &KiNode0; - Prcb->ParentNode = KeNodeBlock[0]; - KeNodeBlock[0]->ProcessorMask = Prcb->SetMember; - - /* Set boot-level flags */ - KeI386NpxPresent = NpxPresent; - KeI386CpuType = Prcb->CpuType; - KeI386CpuStep = Prcb->CpuStep; - KeProcessorArchitecture = 0; - KeProcessorLevel = (USHORT)Prcb->CpuType; - if (Prcb->CpuID) KeProcessorRevision = Prcb->CpuStep; - KeFeatureBits = FeatureBits; - KeI386FxsrPresent = (KeFeatureBits & KF_FXSR) ? TRUE : FALSE; - KeI386XMMIPresent = (KeFeatureBits & KF_XMMI) ? TRUE : FALSE; - - /* Check if Fxsr was found */ - if (KeI386FxsrPresent) - { - /* Enable it. FIXME: Send an IPI */ - Ke386SetCr4(Ke386GetCr4() | X86_CR4_OSFXSR); - - /* Check if XMM was found too */ - if (KeI386XMMIPresent) - { - /* Enable it: FIXME: Send an IPI. */ - Ke386SetCr4(Ke386GetCr4() | X86_CR4_OSXMMEXCPT); - - /* FIXME: Implement and enable XMM Page Zeroing for Mm */ - } - } - - if (KeFeatureBits & KF_GLOBAL_PAGE) - { - ULONG Flags; - /* Enable global pages */ - Ke386GlobalPagesEnabled = TRUE; - Ke386SaveFlags(Flags); - Ke386DisableInterrupts(); - Ke386SetCr4(Ke386GetCr4() | X86_CR4_PGE); - Ke386RestoreFlags(Flags); - } - - if (KeFeatureBits & KF_FAST_SYSCALL) - { - extern void KiFastCallEntry(void); - - /* CS Selector of the target segment. */ - Ke386Wrmsr(0x174, KGDT_R0_CODE, 0); - /* Target ESP. */ - Ke386Wrmsr(0x175, 0, 0); - /* Target EIP. */ - Ke386Wrmsr(0x176, (ULONG_PTR)KiFastCallEntry, 0); - } - - /* Does the CPU Support 'prefetchnta' (SSE) */ - if(KeFeatureBits & KF_XMMI) - { - ULONG Protect; - - Protect = MmGetPageProtect(NULL, (PVOID)RtlPrefetchMemoryNonTemporal); - MmSetPageProtect(NULL, (PVOID)RtlPrefetchMemoryNonTemporal, Protect | PAGE_IS_WRITABLE); - /* Replace the ret by a nop */ - *(PCHAR)RtlPrefetchMemoryNonTemporal = 0x90; - MmSetPageProtect(NULL, (PVOID)RtlPrefetchMemoryNonTemporal, Protect); - } - - /* Initialize the Debugger */ - KdInitSystem (0, &KeLoaderBlock); - - /* Initialize HAL */ - HalInitSystem (0, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock); - - /* Initialize the Kernel Executive */ - ExpInitializeExecutive(); - - /* Create the IOPM Save Area */ - Ki386IopmSaveArea = ExAllocatePoolWithTag(NonPagedPool, - PAGE_SIZE * 2, - TAG('K', 'e', ' ', ' ')); - - /* Free Initial Memory */ - MiFreeInitMemory(); - - /* Never returns */ -#if 0 - /* FIXME: - * The initial thread isn't a real ETHREAD object, we cannot call PspExitThread. - */ - PspExitThread(STATUS_SUCCESS); -#else - while (1) - { - LARGE_INTEGER Timeout; - Timeout.QuadPart = 0x7fffffffffffffffLL; - KeDelayExecutionThread(KernelMode, FALSE, &Timeout); - } -#endif - - /* Bug Check and loop forever if anything failed */ - KEBUGCHECK(0); - for(;;); + /* Call main kernel intialization */ + KiInitializeKernel(&KiInitialProcess.Pcb, + &KiInitialThread.Tcb, + init_stack, + Prcb, + Cpu, + LoaderBlock); }
VOID
Modified: trunk/reactos/ntoskrnl/ke/process.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/process.c?rev=2... ============================================================================== --- trunk/reactos/ntoskrnl/ke/process.c (original) +++ trunk/reactos/ntoskrnl/ke/process.c Sat Sep 2 08:40:09 2006 @@ -10,26 +10,18 @@ /* INCLUDES *****************************************************************/
#include <ntoskrnl.h> -#include <internal/napi.h> #define NDEBUG #include <internal/debug.h>
/* GLOBALS *****************************************************************/
-KSERVICE_TABLE_DESCRIPTOR -__declspec(dllexport) -KeServiceDescriptorTable[SSDT_MAX_ENTRIES] = -{ - { MainSSDT, NULL, NUMBER_OF_SYSCALLS, MainSSPT }, - { NULL, NULL, 0, NULL }, -}; - -KSERVICE_TABLE_DESCRIPTOR -KeServiceDescriptorTableShadow[SSDT_MAX_ENTRIES] = -{ - { MainSSDT, NULL, NUMBER_OF_SYSCALLS, MainSSPT }, - { NULL, NULL, 0, NULL }, -}; +LIST_ENTRY KiProcessListHead; +LIST_ENTRY KiProcessInSwapListHead, KiProcessOutSwapListHead; +LIST_ENTRY KiStackInSwapListHead; +KEVENT KiSwapEvent; + +KSERVICE_TABLE_DESCRIPTOR KeServiceDescriptorTable[SSDT_MAX_ENTRIES]; +KSERVICE_TABLE_DESCRIPTOR KeServiceDescriptorTableShadow[SSDT_MAX_ENTRIES];
/* FUNCTIONS *****************************************************************/
Modified: trunk/reactos/ntoskrnl/ke/timer.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/timer.c?rev=238... ============================================================================== --- trunk/reactos/ntoskrnl/ke/timer.c (original) +++ trunk/reactos/ntoskrnl/ke/timer.c Sat Sep 2 08:40:09 2006 @@ -15,7 +15,10 @@
/* GLOBALS ****************************************************************/
+LARGE_INTEGER KiTimeIncrementReciprocal; +UCHAR KiTimeIncrementShiftCount; LIST_ENTRY KiTimerListHead; +KTIMER_TABLE_ENTRY KiTimerTableListHead[TIMER_TABLE_SIZE]; #define SYSTEM_TIME_UNITS_PER_MSEC (10000)
/* PRIVATE FUNCTIONS ******************************************************/