Author: tkreuzer
Date: Fri Jun 4 12:59:19 2010
New Revision: 47565
URL:
http://svn.reactos.org/svn/reactos?rev=47565&view=rev
Log:
[HAL]
- 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
Added:
trunk/reactos/hal/halx86/amd64/
- copied from r47560, trunk/reactos/hal/halx86/generic/amd64/
trunk/reactos/hal/halx86/amd64/halinit.c (with props)
trunk/reactos/hal/halx86/amd64/mps.S
- copied unchanged from r47560, trunk/reactos/hal/halx86/mp/amd64/mps.S
trunk/reactos/hal/halx86/amd64/processor.c (with props)
trunk/reactos/hal/halx86/amd64/stubs.c (with props)
Removed:
trunk/reactos/hal/halx86/generic/amd64/
trunk/reactos/hal/halx86/mp/amd64/mps.S
Modified:
trunk/reactos/hal/halx86/amd64/x86bios.c
trunk/reactos/hal/halx86/generic/timer.c
trunk/reactos/hal/halx86/generic/usage.c
trunk/reactos/hal/halx86/hal_generic.rbuild
trunk/reactos/hal/halx86/halamd64.rbuild
Added: trunk/reactos/hal/halx86/amd64/halinit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/amd64/halinit.c…
==============================================================================
--- trunk/reactos/hal/halx86/amd64/halinit.c (added)
+++ trunk/reactos/hal/halx86/amd64/halinit.c [iso-8859-1] Fri Jun 4 12:59:19 2010
@@ -1,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;
+}
Propchange: trunk/reactos/hal/halx86/amd64/halinit.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/hal/halx86/amd64/processor.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/amd64/processor…
==============================================================================
--- trunk/reactos/hal/halx86/amd64/processor.c (added)
+++ trunk/reactos/hal/halx86/amd64/processor.c [iso-8859-1] Fri Jun 4 12:59:19 2010
@@ -1,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(a)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 */
Propchange: trunk/reactos/hal/halx86/amd64/processor.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/hal/halx86/amd64/stubs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/amd64/stubs.c?r…
==============================================================================
--- trunk/reactos/hal/halx86/amd64/stubs.c (added)
+++ trunk/reactos/hal/halx86/amd64/stubs.c [iso-8859-1] Fri Jun 4 12:59:19 2010
@@ -1,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;
+}
+
Propchange: trunk/reactos/hal/halx86/amd64/stubs.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/hal/halx86/amd64/x86bios.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/amd64/x86bios.c…
==============================================================================
--- trunk/reactos/hal/halx86/amd64/x86bios.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/amd64/x86bios.c [iso-8859-1] Fri Jun 4 12:59:19 2010
@@ -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 @@
return STATUS_SUCCESS;
}
+#if 0
BOOLEAN
NTAPI
x86BiosCall(
@@ -261,11 +262,13 @@
return TRUE;
}
+#endif
BOOLEAN
NTAPI
HalpBiosDisplayReset(VOID)
{
+#if 0
X86_BIOS_REGISTERS Registers;
ULONG OldEflags;
@@ -283,7 +286,7 @@
/* Restore previous flags */
__writeeflags(OldEflags);
-
+#endif
return TRUE;
}
Modified: trunk/reactos/hal/halx86/generic/timer.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/timer.c…
==============================================================================
--- trunk/reactos/hal/halx86/generic/timer.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/generic/timer.c [iso-8859-1] Fri Jun 4 12:59:19 2010
@@ -109,6 +109,7 @@
HalpCurrentRollOver = RollOver;
}
+#ifdef _M_IX86
#ifndef _MINIHAL_
VOID
FASTCALL
@@ -163,6 +164,7 @@
}
#endif
+#endif
/* PUBLIC FUNCTIONS ***********************************************************/
Modified: trunk/reactos/hal/halx86/generic/usage.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/usage.c…
==============================================================================
--- trunk/reactos/hal/halx86/generic/usage.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/generic/usage.c [iso-8859-1] Fri Jun 4 12:59:19 2010
@@ -509,17 +509,11 @@
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);
Modified: trunk/reactos/hal/halx86/hal_generic.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/hal_generic.rbu…
==============================================================================
--- trunk/reactos/hal/halx86/hal_generic.rbuild [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/hal_generic.rbuild [iso-8859-1] Fri Jun 4 12:59:19 2010
@@ -36,19 +36,6 @@
<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>
Modified: trunk/reactos/hal/halx86/halamd64.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/halamd64.rbuild…
==============================================================================
--- trunk/reactos/hal/halx86/halamd64.rbuild [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/halamd64.rbuild [iso-8859-1] Fri Jun 4 12:59:19 2010
@@ -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>
@@ -19,18 +20,14 @@
<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>
Removed: trunk/reactos/hal/halx86/mp/amd64/mps.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/mp/amd64/mps.S?…
==============================================================================
--- trunk/reactos/hal/halx86/mp/amd64/mps.S [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/mp/amd64/mps.S (removed)
@@ -1,96 +1,0 @@
-/*
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS kernel
- * FILE: ntoskrnl/hal/amd64/generic/mps.S
- * PURPOSE: Intel MultiProcessor specification support
- * PROGRAMMER: Casper S. Hornstrup (chorns(a)users.sourceforge.net)
- */
-
-/* INCLUDES ******************************************************************/
-
-#include <reactos/asm.h>
-#include <ndk/amd64/asm.h>
-
-/* FUNCTIONS *****************************************************************/
-
-#define BEFORE \
- cld; \
- push rax; \
- push rbx; \
- push rcx; \
- push rdx; \
- push rsi; \
- push rdi; \
- push fs; \
- push gs; \
-
-#define AFTER \
- pop gs; \
- pop fs; \
- pop rdi; \
- pop rsi; \
- pop rdx; \
- pop rcx; \
- pop rbx; \
- pop rax; \
-
-#ifdef CONFIG_SMP
-PUBLIC MpsIpiInterrupt
-MpsIpiInterrupt:
- /* Save registers */
- BEFORE
-
- /* Call the C handler */
- call MpsIpiHandler
-
- /* Return to the caller */
- AFTER
- iret
-#endif
-
-PUBLIC MpsErrorInterrupt
-MpsErrorInterrupt:
- /* Save registers */
- BEFORE
-
- /* Call the C handler */
- call MpsErrorHandler
-
- /* Return to the caller */
- AFTER
- iret
-
-
-PUBLIC MpsSpuriousInterrupt
-MpsSpuriousInterrupt:
- /* Save registers */
- BEFORE
-
- /* Call the C handler */
- call MpsSpuriousHandler
-
- /* Return to the caller */
- AFTER
- iret
-
-PUBLIC MpsTimerInterrupt
-MpsTimerInterrupt:
- /* Save registers */
- BEFORE
-
- mov ebx, 0xef
- mov eax, 0xceafbeef
- push rax
- push rsp
- push rbx
- call MpsTimerHandler
- pop rax
- pop rax
- pop rax
-
- /* Return to the caller */
- AFTER
- iret
-
-
-/* EOF */