[HAL]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Thu, 31 Dec 2009 19:26:37 +0000 (19:26 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Thu, 31 Dec 2009 19:26:37 +0000 (19:26 +0000)
some improvements

svn path=/branches/ros-amd64-bringup/; revision=44832

reactos/hal/halamd64/generic/halinit.c
reactos/hal/halamd64/include/halp.h
reactos/hal/halamd64/up/processor.c

index 152618c..5c91dbd 100644 (file)
@@ -62,7 +62,7 @@ HalInitSystem(IN ULONG BootPhase,
     PKPRCB Prcb = KeGetCurrentPrcb();
 
     /* Check the boot phase */
-    if (!BootPhase)
+    if (BootPhase == 0)
     {
         /* Phase 0... save bus type */
         HalpBusType = LoaderBlock->u.I386.MachineType & 0xFF;
@@ -70,8 +70,8 @@ HalInitSystem(IN ULONG BootPhase,
         /* Get command-line parameters */
         HalpGetParameters(LoaderBlock);
 
-        /* Checked HAL requires checked kernel */
 #if DBG
+        /* Checked HAL requires checked kernel */
         if (!(Prcb->BuildType & PRCB_BUILD_DEBUG))
         {
             /* No match, bugcheck */
@@ -101,18 +101,21 @@ HalInitSystem(IN ULONG BootPhase,
             /* Validation failed, bugcheck */
             KeBugCheckEx(MISMATCHED_HAL, 1, Prcb->MajorVersion, 1, 0);
         }
-DPRINT1("HalInitSystem 2\n");
+
+        DPRINT1("HalInitSystem 1\n");
+
         /* Initialize the PICs */
         HalpInitPICs();
-DPRINT1("HalInitSystem 3\n");
-        /* Force initial PIC state */
-        KfRaiseIrql(KeGetCurrentIrql());
-DPRINT1("HalInitSystem 4\n");
+
+        DPRINT1("HalInitSystem 2\n");
+
         /* Initialize the clock */
         HalpInitializeClock();
-DPRINT1("HalInitSystem 5\n");
-        /* Setup busy waiting */
-        //HalpCalibrateStallExecution();
+
+        DPRINT1("HalInitSystem 3\n");
+
+        /* Calibrate counters */
+//        HalpCalibrateCounters();
 
         /* Fill out the dispatch tables */
         HalQuerySystemInformation = HaliQuerySystemInformation;
@@ -121,7 +124,9 @@ DPRINT1("HalInitSystem 5\n");
 //        HalGetDmaAdapter = HalpGetDmaAdapter;
         HalGetInterruptTranslator = NULL;  // FIXME: TODO
 //        HalResetDisplay = HalpBiosDisplayReset;
-DPRINT1("HalInitSystem 6\n");
+
+        DPRINT1("HalInitSystem 4\n");
+
         /* Initialize the hardware lock (CMOS) */
         KeInitializeSpinLock(&HalpSystemHardwareLock);
 
@@ -134,11 +139,8 @@ DPRINT1("HalInitSystem 6\n");
         //HalpInitBusHandler();
 
         /* Enable the clock interrupt */
-        PKIDTENTRY64 IdtEntry = &((PKIPCR)KeGetPcr())->IdtBase[0x30];
-        IdtEntry->OffsetLow = (((ULONG_PTR)HalpClockInterrupt) & 0xFFFF);
-        IdtEntry->OffsetMiddle = (((ULONG_PTR)HalpClockInterrupt >> 16) & 0xFFFF);
-        IdtEntry->OffsetHigh = ((ULONG_PTR)HalpClockInterrupt >> 32);
-//        HalEnableSystemInterrupt(0x30, CLOCK_LEVEL, Latched);
+        HalpSetInterruptGate(0x30, HalpClockInterrupt);
+        HalEnableSystemInterrupt(0x30, CLOCK_LEVEL, Latched);
 
         /* Initialize DMA. NT does this in Phase 0 */
         HalpInitDma();
index bac9ef1..4004a85 100644 (file)
@@ -164,6 +164,10 @@ HalpGetDmaAdapter(
 VOID HaliInitBSP(VOID);
 VOID HaliStartApplicationProcessor(ULONG Cpu, ULONG Stack);
 
+VOID NTAPI HalpInitIdtEntry(PKIDTENTRY64 Idt, PVOID Address);
+VOID NTAPI HalpSetInterruptGate(ULONG Index, PVOID Address);
+VOID NTAPI HalpInitCpuInterruptHandling(ULONG Cpu);
+
 extern PVOID HalpRealModeStart;
 extern PVOID HalpRealModeEnd;
 
index 1104ed3..1be90e8 100644 (file)
@@ -25,8 +25,7 @@ NTAPI
 HalInitializeProcessor(IN ULONG ProcessorNumber,
                        IN PLOADER_PARAMETER_BLOCK LoaderBlock)
 {
-    /* Set default IDR and stall count */
-//    KeGetPcr()->IDR = 0xFFFFFFFB;
+    /* Set default stall count */
     KeGetPcr()->StallScaleFactor = INITIAL_STALL_COUNT;
 
     /* Update the interrupt affinity and processor mask */
@@ -36,6 +35,9 @@ HalInitializeProcessor(IN ULONG ProcessorNumber,
 
     /* Register routines for KDCOM */
     HalpRegisterKdSupportFunctions();
+
+    /* Do per CPU interrupt handling initialization */
+//    HalpInitCpuInterruptHandling(ProcessorNumber);
 }
 
 /*