[HAL]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Fri, 4 Jun 2010 10:59:19 +0000 (10:59 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Fri, 4 Jun 2010 10:59:19 +0000 (10:59 +0000)
- Move all amd64 specific files to one amd64 folder
- Compile x86 specific timer code only on x86
- Use KeRegisterInterruptHandler instead of manual idt manipulation
- add missing stubs for amd64

svn path=/trunk/; revision=47565

reactos/hal/halx86/amd64/halinit.c [new file with mode: 0644]
reactos/hal/halx86/amd64/mps.S [moved from reactos/hal/halx86/mp/amd64/mps.S with 100% similarity]
reactos/hal/halx86/amd64/processor.c [new file with mode: 0644]
reactos/hal/halx86/amd64/stubs.c [new file with mode: 0644]
reactos/hal/halx86/amd64/systimer.S [moved from reactos/hal/halx86/generic/amd64/systimer.S with 100% similarity]
reactos/hal/halx86/amd64/x86bios.c [moved from reactos/hal/halx86/generic/amd64/x86bios.c with 99% similarity]
reactos/hal/halx86/generic/amd64/.gitignore [deleted file]
reactos/hal/halx86/generic/timer.c
reactos/hal/halx86/generic/usage.c
reactos/hal/halx86/hal_generic.rbuild
reactos/hal/halx86/halamd64.rbuild

diff --git a/reactos/hal/halx86/amd64/halinit.c b/reactos/hal/halx86/amd64/halinit.c
new file mode 100644 (file)
index 0000000..b9b3051
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * PROJECT:         ReactOS HAL
+ * LICENSE:         GPL - See COPYING in the top level directory
+ * FILE:            hal/halx86/amd64/halinit.c
+ * PURPOSE:         HAL Entrypoint and Initialization
+ * PROGRAMMERS:     
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <hal.h>
+#define NDEBUG
+#include <debug.h>
+
+/* GLOBALS *******************************************************************/
+
+/* PRIVATE FUNCTIONS *********************************************************/
+
+/* FUNCTIONS *****************************************************************/
+
+/*
+ * @implemented
+ */
+BOOLEAN
+NTAPI
+HalInitSystem(IN ULONG BootPhase,
+              IN PLOADER_PARAMETER_BLOCK LoaderBlock)
+{
+    UNIMPLEMENTED;
+    return FALSE;
+}
diff --git a/reactos/hal/halx86/amd64/processor.c b/reactos/hal/halx86/amd64/processor.c
new file mode 100644 (file)
index 0000000..255f50b
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ * PROJECT:         ReactOS HAL
+ * LICENSE:         GPL - See COPYING in the top level directory
+ * FILE:            hal/halx86/amd64/processor.c
+ * PURPOSE:         HAL Processor Routines
+ * PROGRAMMERS:     Timo Kreuzer (timo.kreuzer@reactos.org)
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <hal.h>
+#define NDEBUG
+#include <debug.h>
+
+KAFFINITY HalpActiveProcessors;
+KAFFINITY HalpDefaultInterruptAffinity;
+
+/* PRIVATE FUNCTIONS *********************************************************/
+
+VOID
+NTAPI
+HaliHaltSystem(VOID)
+{
+    /* Disable interrupts and halt the CPU */
+    _disable();
+    __halt();
+}
+
+/* FUNCTIONS *****************************************************************/
+
+/*
+ * @implemented
+ */
+VOID
+NTAPI
+HalInitializeProcessor(IN ULONG ProcessorNumber,
+                       IN PLOADER_PARAMETER_BLOCK LoaderBlock)
+{
+    /* Set default stall count */
+    KeGetPcr()->StallScaleFactor = INITIAL_STALL_COUNT;
+
+    /* Update the interrupt affinity and processor mask */
+    InterlockedBitTestAndSet((PLONG)&HalpActiveProcessors, ProcessorNumber);
+    InterlockedBitTestAndSet((PLONG)&HalpDefaultInterruptAffinity,
+                             ProcessorNumber);
+
+    /* Register routines for KDCOM */
+    //HalpRegisterKdSupportFunctions();
+}
+
+/*
+ * @implemented
+ */
+BOOLEAN
+NTAPI
+HalAllProcessorsStarted(VOID)
+{
+    /* Do nothing */
+    return TRUE;
+}
+
+/*
+ * @implemented
+ */
+BOOLEAN
+NTAPI
+HalStartNextProcessor(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
+                      IN PKPROCESSOR_STATE ProcessorState)
+{
+    /* Ready to start */
+    return FALSE;
+}
+
+/*
+ * @implemented
+ */
+VOID
+NTAPI
+HalProcessorIdle(VOID)
+{
+    /* Enable interrupts and halt the processor */
+    _enable();
+    __halt();
+}
+
+/*
+ * @implemented
+ */
+VOID
+NTAPI
+HalRequestIpi(KAFFINITY TargetProcessors)
+{
+    UNIMPLEMENTED;
+    __debugbreak();
+}
+
+/* EOF */
diff --git a/reactos/hal/halx86/amd64/stubs.c b/reactos/hal/halx86/amd64/stubs.c
new file mode 100644 (file)
index 0000000..ee295d1
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ * PROJECT:         ReactOS HAL
+ * LICENSE:         GPL - See COPYING.ARM in the top level directory
+ * FILE:            hal/halx86/amd64/stubs.c
+ * PURPOSE:         HAL stubs
+ * PROGRAMMERS:     
+ */
+
+/* INCLUDES *******************************************************************/
+
+#include <hal.h>
+#define NDEBUG
+#include <debug.h>
+
+/* GLOBALS ********************************************************************/
+
+LARGE_INTEGER HalpPerformanceFrequency;
+
+
+/* FUNCTIONS ******************************************************************/
+
+VOID
+FASTCALL
+HalClearSoftwareInterrupt(
+    IN KIRQL Irql)
+{
+    UNIMPLEMENTED;
+}
+
+VOID
+FASTCALL
+HalRequestSoftwareInterrupt(
+    IN KIRQL Irql)
+{
+    UNIMPLEMENTED;
+}
+
+BOOLEAN
+NTAPI
+HalBeginSystemInterrupt(
+    IN KIRQL Irql,
+    IN UCHAR Vector,
+    OUT PKIRQL OldIrql)
+{
+    UNIMPLEMENTED;
+    return FALSE;
+}
+
+BOOLEAN
+NTAPI
+HalEnableSystemInterrupt(
+    IN UCHAR Vector,
+    IN KIRQL Irql,
+    IN KINTERRUPT_MODE InterruptMode)
+{
+    UNIMPLEMENTED;
+    return FALSE;
+}
+
+VOID
+NTAPI
+HalDisableSystemInterrupt(
+    IN UCHAR Vector,
+    IN KIRQL Irql)
+{
+    UNIMPLEMENTED;
+}
+
+VOID
+NTAPI
+HalEndSystemInterrupt(
+    IN KIRQL OldIrql,
+    IN PKTRAP_FRAME TrapFrame)
+{
+    UNIMPLEMENTED;
+}
+
+LARGE_INTEGER
+NTAPI
+KeQueryPerformanceCounter(
+    OUT PLARGE_INTEGER PerformanceFrequency OPTIONAL)
+{
+    LARGE_INTEGER Result;
+
+//    ASSERT(HalpPerformanceFrequency.QuadPart != 0);
+
+    /* Does the caller want the frequency? */
+    if (PerformanceFrequency)
+    {
+        /* Return value */
+        *PerformanceFrequency = HalpPerformanceFrequency;
+    }
+
+    Result.QuadPart = __rdtsc();
+    return Result;
+}
+
similarity index 99%
rename from reactos/hal/halx86/generic/amd64/x86bios.c
rename to reactos/hal/halx86/amd64/x86bios.c
index 3b43bf1..a814873 100644 (file)
@@ -12,7 +12,7 @@
 //#define NDEBUG
 #include <debug.h>
 
-#include "x86emu.h"
+//#include "x86emu.h"
 
 /* This page serves as fallback for pages used by Mm */
 #define DEFAULT_PAGE 0x21
@@ -216,6 +216,7 @@ x86BiosWriteMemory(
     return STATUS_SUCCESS;
 }
 
+#if 0
 BOOLEAN
 NTAPI
 x86BiosCall(
@@ -261,11 +262,13 @@ x86BiosCall(
 
     return TRUE;
 }
+#endif
 
 BOOLEAN
 NTAPI
 HalpBiosDisplayReset(VOID)
 {
+#if 0
     X86_BIOS_REGISTERS Registers;
     ULONG OldEflags;
 
@@ -283,7 +286,7 @@ HalpBiosDisplayReset(VOID)
 
     /* Restore previous flags */
     __writeeflags(OldEflags);
-
+#endif
     return TRUE;
 }
 
diff --git a/reactos/hal/halx86/generic/amd64/.gitignore b/reactos/hal/halx86/generic/amd64/.gitignore
deleted file mode 100644 (file)
index e69de29..0000000
index 6d90dad..524b6ce 100644 (file)
@@ -109,6 +109,7 @@ HalpInitializeClock(VOID)
     HalpCurrentRollOver = RollOver;
 }
 
+#ifdef _M_IX86
 #ifndef _MINIHAL_
 VOID
 FASTCALL
@@ -163,6 +164,7 @@ HalpProfileInterruptHandler(IN PKTRAP_FRAME TrapFrame)
 }
 #endif
 
+#endif
 
 /* PUBLIC FUNCTIONS ***********************************************************/
 
index 02c86e2..c35df96 100644 (file)
@@ -509,17 +509,11 @@ HalpEnableInterruptHandler(IN UCHAR Flags,
                            IN PVOID Handler,
                            IN KINTERRUPT_MODE Mode)
 {
-    UCHAR Entry;
-
-    /* Convert the vector into the IDT entry */
-    Entry = HalVectorToIDTEntry(SystemVector);
-
     /* Register the vector */
     HalpRegisterVector(Flags, BusVector, SystemVector, Irql);
 
     /* Connect the interrupt */
-    ((PKIPCR)KeGetPcr())->IDT[Entry].ExtendedOffset = (USHORT)(((ULONG_PTR)Handler >> 16) & 0xFFFF);
-    ((PKIPCR)KeGetPcr())->IDT[Entry].Offset = (USHORT)((ULONG_PTR)Handler);
+    KeRegisterInterruptHandler(SystemVector, Handler);
 
     /* Enable the interrupt */
     HalEnableSystemInterrupt(SystemVector, Irql, Mode);
index ed5ec3a..a6ee63b 100644 (file)
                                        <file>trap.S</file>
                                </directory>
                        </if>
-                       <if property="ARCH" value="amd64">
-                               <define name="_X86BIOS_" />
-                               <!-- include base="x86emu">.</include -->
-                               <directory name="amd64">
-                                       <file>x86bios.c</file>
-                                       <!-- file>halinit.c</file -->
-                                       <!-- file>irq.S</file -->
-                                       <!-- file>misc.c</file -->
-                                       <!-- file>apic.c</file -->
-                                       <file>systimer.S</file>
-                                       <!-- file>usage.c</file -->
-               </directory>
-                       </if>
                </directory>
                <directory name="include">
                        <pch>hal.h</pch>
index 92c4f29..02f633c 100644 (file)
@@ -8,6 +8,7 @@
        <include base="ntoskrnl">include</include>
        <!-- include base="x86emu">.</include -->
        <define name="_DISABLE_TIDENTS" />
+       <define name="_NTHALDLL_" />
        <define name="_NTHAL_" />
        <define name="_X86BIOS_" />
        <library>hal_generic</library>
                <file>spinlock.c</file>
        </directory>
 
-       <directory name="up">
+       <directory name="amd64">
+               <file>x86bios.c</file>
+               <file>halinit.c</file>
+               <file>stubs.c</file>
+               <file>systimer.S</file>
                <file>processor.c</file>
        </directory>
 
-       <!-- directory name="mp">
-               <file>halinit_mp.c</file>
-               <file>processor_mp.c</file>
-               <file>halmp.rc</file>
-               <directory name="amd64">
-                       <file>mps.S</file>
-               </directory>
-       </directory -->
 </module>
 </group>