Commit in reactos/ntoskrnl/ke on MAIN
i386/kernel.c+24-241.42 -> 1.43
    /multiboot.S+341.29 -> 1.30
main.c+39-261.208 -> 1.209
+97-50
3 modified files
- Dipped the code between HalInitializeProcessor and HalStartNextProcessor. Used the functions according its names.
- Changed the init sequence in KeInit1 and KePrepareForApplicationProcessorInit.
- Fixed the pae mode initialisation for application processors.

reactos/ntoskrnl/ke/i386
kernel.c 1.42 -> 1.43
diff -u -r1.42 -r1.43
--- kernel.c	20 Nov 2004 23:46:36 -0000	1.42
+++ kernel.c	28 Nov 2004 01:31:07 -0000	1.43
@@ -132,7 +132,9 @@
   DPRINT("KePrepareForApplicationProcessorInit(Id %d)\n", Id);
   PFN_TYPE PrcPfn;
   PKPCR Pcr;
+  PKPCR BootPcr;
 
+  BootPcr = (PKPCR)KPCR_BASE;
   Pcr = (PKPCR)((ULONG_PTR)KPCR_BASE + Id * PAGE_SIZE);
 
   MmRequestPageMemoryConsumer(MC_NPPOOL, TRUE, &PrcPfn);
@@ -147,14 +149,14 @@
   Pcr->ProcessorNumber = Id;
   Pcr->Tib.Self = &Pcr->Tib;
   Pcr->Self = Pcr;
-  Pcr->Irql = HIGH_LEVEL;
+  Pcr->Irql = SYNCH_LEVEL;
+
+  Pcr->PrcbData.MHz = BootPcr->PrcbData.MHz;
+  Pcr->StallScaleFactor = BootPcr->StallScaleFactor; 
 
   /* Mark the end of the exception handler list */
   Pcr->Tib.ExceptionList = (PVOID)-1;
 
-  KeInitDpc(Pcr);
-
-
   KiGdtPrepareForApplicationProcessorInit(Id);
 }
 
@@ -172,11 +174,6 @@
      Ke386SetCr4(Ke386GetCr4() | X86_CR4_PGE);
   }
   
-  /* Enable PAE mode */
-  if (Ke386PaeEnabled)
-  {
-     MiEnablePAE(NULL);
-  }
 
   Offset = InterlockedIncrement(&PcrsAllocated) - 1;
   Pcr = (PKPCR)((ULONG_PTR)KPCR_BASE + Offset * PAGE_SIZE);
@@ -192,6 +189,8 @@
   /* Check FPU/MMX/SSE support. */
   KiCheckFPU();
 
+  KeInitDpc(Pcr);
+
   /*
    * It is now safe to process interrupts
    */
@@ -221,26 +220,16 @@
    extern USHORT KiBootGdt[];
    extern KTSS KiBootTss;
 
-   /* Get processor information. */
-   Ki386GetCpuId();
-
-   /* Check FPU/MMX/SSE support. */
-   KiCheckFPU();
-
-   KiInitializeGdt (NULL);
-   Ki386BootInitializeTSS();
-   KeInitExceptions ();
-   KeInitInterrupts ();
-
    /*
     * Initialize the initial PCR region. We can't allocate a page
     * with MmAllocPage() here because MmInit1() has not yet been
     * called, so we use a predefined page in low memory 
     */
+
    KPCR = (PKPCR)KPCR_BASE;
    memset(KPCR, 0, PAGE_SIZE);
    KPCR->Self = KPCR;
-   KPCR->Irql = HIGH_LEVEL;
+   KPCR->Irql = SYNCH_LEVEL;
    KPCR->Tib.Self  = &KPCR->Tib;
    KPCR->GDT = KiBootGdt;
    KPCR->IDT = (PUSHORT)KiIdt;
@@ -249,13 +238,24 @@
    KiPcrInitDone = 1;
    PcrsAllocated++;
 
-   KeInitDpc(KPCR);
+   KiInitializeGdt (NULL);
+   Ki386BootInitializeTSS();
+   Ki386InitializeLdt();
+
+   /* Get processor information. */
+   Ki386GetCpuId();
+
+   /* Check FPU/MMX/SSE support. */
+   KiCheckFPU();
 
    /* Mark the end of the exception handler list */
    KPCR->Tib.ExceptionList = (PVOID)-1;
 
-   Ki386InitializeLdt();
-   
+   KeInitDpc(KPCR);
+
+   KeInitExceptions ();
+   KeInitInterrupts ();
+
    if (KPCR->PrcbData.FeatureBits & X86_FEATURE_PGE)
    {
       ULONG Flags;

reactos/ntoskrnl/ke/i386
multiboot.S 1.29 -> 1.30
diff -u -r1.29 -r1.30
--- multiboot.S	20 Nov 2004 23:46:36 -0000	1.29
+++ multiboot.S	28 Nov 2004 01:31:07 -0000	1.30
@@ -1,5 +1,6 @@
 #include <roscfg.h>
 #include <internal/ntoskrnl.h>
+#include <internal/i386/ke.h>
 #include <internal/i386/segment.h>
 #include <internal/ps.h>
 #include <internal/i386/mm.h>
@@ -188,6 +189,30 @@
 #ifdef MP
 
 .m1:
+    	/*
+     	 * Check for pae mode (only possible for an application processor)
+     	 */
+     
+	movl	$(V2P(_Ke386Pae)), %eax
+	cmpb	$0, (%eax)
+	je		.m3
+	
+	/*
+	 * Set up the PDBR
+	 */
+	movl	$(V2P(_pae_pagedirtable)), %eax
+	movl	%eax, %cr3
+	
+	/*
+	 * Enable pae mode
+	 */
+	movl	%cr4, %eax
+	orl		$X86_CR4_PAE, %eax
+	movl	%eax, %cr4
+
+	jmp		.m4
+
+.m3:
 
 #endif /* MP */
 
@@ -196,6 +221,10 @@
 	 */
 	movl	$(V2P(startup_pagedirectory)), %eax
 	movl	%eax, %cr3
+	
+#ifdef MP
+.m4:
+#endif
 
 	/*
 	 * Enable paging and set write protect
@@ -245,6 +274,11 @@
 	 */
 	pushl	$0
 	popfl
+	
+	/*
+	 *  Reserve space for the floating point save area.
+	 */
+	subl    $SIZEOF_FX_SAVE_AREA, %esp
 
 	/*
 	 * Call the application processor initialization code

reactos/ntoskrnl/ke
main.c 1.208 -> 1.209
diff -u -r1.208 -r1.209
--- main.c	27 Nov 2004 11:42:56 -0000	1.208
+++ main.c	28 Nov 2004 01:31:08 -0000	1.209
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: main.c,v 1.208 2004/11/27 11:42:56 ekohl Exp $
+/* $Id: main.c,v 1.209 2004/11/28 01:31:08 hbirr Exp $
  *
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/ke/main.c
@@ -509,24 +509,23 @@
     }
 
   /* Initialize all processors */
-  KeNumberProcessors = 0;
+  KeNumberProcessors = 1;
 
   while (!HalAllProcessorsStarted())
     {
       PVOID ProcessorStack;
 
-      if (KeNumberProcessors != 0)
-	{
-	  KePrepareForApplicationProcessorInit(KeNumberProcessors);
-	  PsPrepareForApplicationProcessorInit(KeNumberProcessors);
-	}
+      KePrepareForApplicationProcessorInit(KeNumberProcessors);
+      PsPrepareForApplicationProcessorInit(KeNumberProcessors);
+
       /* Allocate a stack for use when booting the processor */
       /* FIXME: The nonpaged memory for the stack is not released after use */
       ProcessorStack = 
 	(char*)ExAllocatePool(NonPagedPool, MM_STACK_SIZE) + MM_STACK_SIZE;
       Ki386InitialStackArray[((int)KeNumberProcessors)] = 
 	(PVOID)((char*)ProcessorStack - MM_STACK_SIZE);
-      HalInitializeProcessor(KeNumberProcessors, ProcessorStack);
+
+      HalStartNextProcessor(0, (ULONG)ProcessorStack - 2*sizeof(FX_SAVE_AREA));
       KeNumberProcessors++;
     }
 
@@ -848,21 +847,30 @@
 VOID __attribute((noinline))
 KiSystemStartup(BOOLEAN BootProcessor)
 {
-  HalInitSystem (0, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
+  if (BootProcessor)
+  {
+  }
+  else
+  {
+     KeApplicationProcessorInit();
+  }
+
+  HalInitializeProcessor(KeNumberProcessors, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
 
   if (BootProcessor)
-    {
-      ExpInitializeExecutive();
-      MiFreeInitMemory();
-      /* Never returns */
-      PsTerminateSystemThread(STATUS_SUCCESS);
-      KEBUGCHECK(0);
-    }
-  /* Do application processor initialization */
-  KeApplicationProcessorInit();
-  PsApplicationProcessorInit();
-  KeLowerIrql(PASSIVE_LEVEL);
-  PsIdleThreadMain(NULL);
+  {
+     ExpInitializeExecutive();
+     MiFreeInitMemory();
+     /* Never returns */
+     PsTerminateSystemThread(STATUS_SUCCESS);
+  }
+  else
+  {
+     /* Do application processor initialization */
+     PsApplicationProcessorInit();
+     KeLowerIrql(PASSIVE_LEVEL);
+     PsIdleThreadMain(NULL);
+  }
   KEBUGCHECK(0);
   for(;;);
 }
@@ -989,10 +997,6 @@
   /* Low level architecture specific initialization */
   KeInit1((PCHAR)KeLoaderBlock.CommandLine, &LastKernelAddress);
 
-#ifdef HAL_DBG
-  HalnInitializeDisplay((PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
-#endif
-
   HalBase = KeLoaderModules[1].ModStart;
   DriverBase = LastKernelAddress;
   LdrHalBase = (ULONG_PTR)DriverBase;
@@ -1036,8 +1040,17 @@
           KeMemoryMapRangeCount++;
           i += size;
         }
+      KeLoaderBlock.MmapLength = KeMemoryMapRangeCount * sizeof(ADDRESS_RANGE);
+      KeLoaderBlock.MmapAddr = (ULONG)KeMemoryMap;
     }
-  
+  else
+    {
+      KeLoaderBlock.MmapLength = 0;
+      KeLoaderBlock.MmapAddr = (ULONG)KeMemoryMap;
+    }
+
+  HalInitSystem (0, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
+
   KiSystemStartup(1);
 }
 
CVSspam 0.2.8