Author: ion
Date: Wed Nov 15 03:08:51 2006
New Revision: 24762
URL:
http://svn.reactos.org/svn/reactos?rev=24762&view=rev
Log:
- Export ExiTryToAcquireFastMutex from ntoskrnl, I had forgotten to export this ages ago
when adding the other Exi*FastMutex* stuff.
- Remove fmutex.c and fastmutex functions from HAL. The whole point of having the Exi ones
in the kernel was that HAL calls them through forward exports now (so any old driver can
still link with HAL). Now we don't duplicate the implementation anymore.
- Remove DriverEntry, it's useless. Also move HalReportResourceUsage to halinit
because it's a call-once-on-boot function much akin a HalInitPhase2 function, so
delete resource.c
- Keep track of interrupt affinity and active processor mask each time a new CPU
initializes.
Removed:
trunk/reactos/hal/halx86/generic/fmutex.c
trunk/reactos/hal/halx86/generic/resource.c
Modified:
trunk/reactos/hal/hal/hal.def
trunk/reactos/hal/halx86/generic/generic.rbuild
trunk/reactos/hal/halx86/generic/halinit.c
trunk/reactos/hal/halx86/generic/processor.c
trunk/reactos/hal/halx86/generic/sysinfo.c
trunk/reactos/ntoskrnl/ntoskrnl.def
Modified: trunk/reactos/hal/hal/hal.def
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/hal/hal.def?rev=24762&…
==============================================================================
--- trunk/reactos/hal/hal/hal.def (original)
+++ trunk/reactos/hal/hal/hal.def Wed Nov 15 03:08:51 2006
@@ -3,9 +3,9 @@
LIBRARY hal.dll
EXPORTS
-@ExAcquireFastMutex@4
-@ExReleaseFastMutex@4
-@ExTryToAcquireFastMutex@4
+@ExAcquireFastMutex@4=@ExiAcquireFastMutex@4
+@ExReleaseFastMutex@4=@ExiReleaseFastMutex@4
+@ExTryToAcquireFastMutex@4=@ExiTryToAcquireFastMutex@4
HalAcquireDisplayOwnership@4
HalAdjustResourceList@4
HalAllProcessorsStarted@0
Removed: trunk/reactos/hal/halx86/generic/fmutex.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/fmutex.…
==============================================================================
--- trunk/reactos/hal/halx86/generic/fmutex.c (original)
+++ trunk/reactos/hal/halx86/generic/fmutex.c (removed)
@@ -1,101 +1,0 @@
-/*
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS HAL
- * FILE: ntoskrnl/hal/x86/fmutex.c
- * PURPOSE: Deprecated HAL Fast Mutex
- * PROGRAMMERS: Alex Ionescu (alex(a)relsoft.net)
- */
-
-/*
- * NOTE: Even HAL itself has #defines to use the Exi* APIs inside NTOSKRNL.
- * These are only exported here for compatibility with really old
- * drivers. Also note that in theory, these can be made much faster
- * by using assembly and inlining all the operations, including
- * raising and lowering irql.
- */
-
-/* INCLUDES *****************************************************************/
-
-#include <hal.h>
-#define NDEBUG
-#include <debug.h>
-
-#undef ExAcquireFastMutex
-#undef ExReleaseFastMutex
-#undef ExTryToAcquireFastMutex
-
-/* FUNCTIONS *****************************************************************/
-
-VOID
-FASTCALL
-ExAcquireFastMutex(PFAST_MUTEX FastMutex)
-{
- KIRQL OldIrql;
-
- /* Raise IRQL to APC */
- OldIrql = KfRaiseIrql(APC_LEVEL);
-
- /* Decrease the count */
- if (InterlockedDecrement(&FastMutex->Count))
- {
- /* Someone is still holding it, use slow path */
- FastMutex->Contention++;
- KeWaitForSingleObject(&FastMutex->Gate,
- WrExecutive,
- KernelMode,
- FALSE,
- NULL);
- }
-
- /* Set the owner and IRQL */
- FastMutex->Owner = KeGetCurrentThread();
- FastMutex->OldIrql = OldIrql;
-}
-
-VOID
-FASTCALL
-ExReleaseFastMutex(PFAST_MUTEX FastMutex)
-{
- KIRQL OldIrql;
-
- /* Erase the owner */
- FastMutex->Owner = (PVOID)1;
- OldIrql = FastMutex->OldIrql;
-
- /* Increase the count */
- if (InterlockedIncrement(&FastMutex->Count) <= 0)
- {
- /* Someone was waiting for it, signal the waiter */
- KeSetEventBoostPriority(&FastMutex->Gate, IO_NO_INCREMENT);
- }
-
- /* Lower IRQL back */
- KfLowerIrql(OldIrql);
-}
-
-BOOLEAN
-FASTCALL
-ExTryToAcquireFastMutex(PFAST_MUTEX FastMutex)
-{
- KIRQL OldIrql;
-
- /* Raise to APC_LEVEL */
- OldIrql = KfRaiseIrql(APC_LEVEL);
-
- /* Check if we can quickly acquire it */
- if (InterlockedCompareExchange(&FastMutex->Count, 0, 1) == 1)
- {
- /* We have, set us as owners */
- FastMutex->Owner = KeGetCurrentThread();
- FastMutex->OldIrql = OldIrql;
- return TRUE;
- }
- else
- {
- /* Acquire attempt failed */
- KfLowerIrql(OldIrql);
- return FALSE;
- }
-}
-
-/* EOF */
Modified: trunk/reactos/hal/halx86/generic/generic.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/generic…
==============================================================================
--- trunk/reactos/hal/halx86/generic/generic.rbuild (original)
+++ trunk/reactos/hal/halx86/generic/generic.rbuild Wed Nov 15 03:08:51 2006
@@ -8,7 +8,6 @@
<file>bus.c</file>
<file>dma.c</file>
<file>drive.c</file>
- <file>fmutex.c</file>
<file>halinit.c</file>
<file>isa.c</file>
<file>kdbg.c</file>
@@ -31,7 +30,6 @@
<define name="__USE_W32API" />
<file>irql.c</file>
<file>processor.c</file>
- <file>resource.c</file>
<file>spinlock.c</file>
<file>systimer.S</file>
</module>
Modified: trunk/reactos/hal/halx86/generic/halinit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/halinit…
==============================================================================
--- trunk/reactos/hal/halx86/generic/halinit.c (original)
+++ trunk/reactos/hal/halx86/generic/halinit.c Wed Nov 15 03:08:51 2006
@@ -1,60 +1,69 @@
-/* $Id$
- *
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS kernel
- * FILE: ntoskrnl/hal/x86/halinit.c
- * PURPOSE: Initalize the x86 hal
- * PROGRAMMER: David Welch (welch(a)cwcom.net)
- * UPDATE HISTORY:
- * 11/06/98: Created
+/*
+ * PROJECT: ReactOS HAL
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: ntoskrnl/hal/halx86/generic/processor.c
+ * PURPOSE: HAL Processor Routines
+ * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org)
*/
-/* INCLUDES *****************************************************************/
+/* INCLUDES ******************************************************************/
#include <hal.h>
#define NDEBUG
#include <debug.h>
-/* GLOBALS *****************************************************************/
+/* GLOBALS *******************************************************************/
PVOID HalpZeroPageMapping = NULL;
HALP_HOOKS HalpHooks;
-/* FUNCTIONS ***************************************************************/
+/* FUNCTIONS *****************************************************************/
-NTSTATUS
-STDCALL
-DriverEntry(
- PDRIVER_OBJECT DriverObject,
- PUNICODE_STRING RegistryPath)
+/*
+ * @implemented
+ */
+BOOLEAN
+NTAPI
+HalInitSystem(IN ULONG BootPhase,
+ IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{
- return STATUS_SUCCESS;
+ PHYSICAL_ADDRESS Null = {{0}};
+
+ if (BootPhase == 0)
+ {
+ RtlZeroMemory(&HalpHooks, sizeof(HALP_HOOKS));
+ HalpInitPhase0(LoaderBlock);
+ }
+ else if (BootPhase == 1)
+ {
+ /* Initialize the clock interrupt */
+ //HalpInitPhase1();
+
+ /* Initialize BUS handlers and DMA */
+ HalpInitBusHandlers();
+ HalpInitDma();
+ }
+ else if (BootPhase == 2)
+ {
+ HalpZeroPageMapping = MmMapIoSpace(Null, PAGE_SIZE, MmNonCached);
+ }
+
+ /* All done, return */
+ return TRUE;
}
-BOOLEAN STDCALL
-HalInitSystem (ULONG BootPhase,
- PLOADER_PARAMETER_BLOCK LoaderBlock)
+/*
+ * @implemented
+ */
+VOID
+NTAPI
+HalReportResourceUsage(VOID)
{
- if (BootPhase == 0)
- {
- RtlZeroMemory(&HalpHooks, sizeof(HALP_HOOKS));
- HalpInitPhase0(LoaderBlock);
- }
- else if (BootPhase == 1)
- {
- /* Initialize the clock interrupt */
- //HalpInitPhase1();
+ /* Initialize PCI bus. */
+ HalpInitPciBus();
- /* Initialize BUS handlers and DMA */
- HalpInitBusHandlers();
- HalpInitDma();
- }
- else if (BootPhase == 2)
- {
- HalpZeroPageMapping = MmMapIoSpace((LARGE_INTEGER)0LL, PAGE_SIZE, MmNonCached);
- }
-
- return TRUE;
+ /* FIXME: Report HAL Usage to kernel */
}
+
/* EOF */
Modified: trunk/reactos/hal/halx86/generic/processor.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/process…
==============================================================================
--- trunk/reactos/hal/halx86/generic/processor.c (original)
+++ trunk/reactos/hal/halx86/generic/processor.c Wed Nov 15 03:08:51 2006
@@ -1,22 +1,19 @@
-/* $Id$
- *
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS kernel
- * FILE: hal/halx86/generic/processor.c
- * PURPOSE: Intel MultiProcessor specification support
- * PROGRAMMER: David Welch (welch(a)cwcom.net)
- * Casper S. Hornstrup (chorns(a)users.sourceforge.net)
- * NOTES: Parts adapted from linux SMP code
- * UPDATE HISTORY:
- * 22/05/1998 DW Created
- * 12/04/2001 CSH Added MultiProcessor specification support
+/*
+ * PROJECT: ReactOS HAL
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: ntoskrnl/hal/halx86/generic/processor.c
+ * PURPOSE: HAL Processor Routines
+ * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org)
*/
-/* INCLUDES *****************************************************************/
+/* INCLUDES ******************************************************************/
#include <hal.h>
#define NDEBUG
#include <debug.h>
+
+LONG HalpActiveProcessors;
+KAFFINITY HalpDefaultInterruptAffinity;
/* FUNCTIONS *****************************************************************/
@@ -28,9 +25,15 @@
HalInitializeProcessor(IN ULONG ProcessorNumber,
IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{
- /* Set default IDR */
+ /* Set default IDR and stall count */
KeGetPcr()->IDR = 0xFFFFFFFB;
KeGetPcr()->StallScaleFactor = INITIAL_STALL_COUNT;
+
+ /* Update the interrupt affinity and processor mask */
+ InterlockedBitTestAndSet(&HalpActiveProcessors, ProcessorNumber);
+ InterlockedBitTestAndSet(&HalpDefaultInterruptAffinity, ProcessorNumber);
+
+ /* FIXME: Register routines for KDCOM */
}
/*
@@ -63,6 +66,7 @@
NTAPI
HalProcessorIdle(VOID)
{
+ /* Enable interrupts and halt the processor */
_enable();
Ki386HaltProcessor();
}
Removed: trunk/reactos/hal/halx86/generic/resource.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/resourc…
==============================================================================
--- trunk/reactos/hal/halx86/generic/resource.c (original)
+++ trunk/reactos/hal/halx86/generic/resource.c (removed)
@@ -1,31 +1,0 @@
-/* $Id$
- *
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS kernel
- * FILE: hal/halx86/generic/resource.c
- * PURPOSE: Miscellaneous resource functions
- * PROGRAMMER: Eric Kohl (ekohl(a)rz-online.de)
- */
-
-/* INCLUDES *****************************************************************/
-
-#include <hal.h>
-#define NDEBUG
-#include <debug.h>
-
-
-/* FUNCTIONS ****************************************************************/
-
-VOID STDCALL
-HalReportResourceUsage(VOID)
-{
- /*
- * FIXME: Report all resources used by hal.
- * Calls IoReportHalResourceUsage()
- */
-
- /* Initialize PCI bus. */
- HalpInitPciBus ();
-}
-
-/* EOF */
Modified: trunk/reactos/hal/halx86/generic/sysinfo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/sysinfo…
==============================================================================
--- trunk/reactos/hal/halx86/generic/sysinfo.c (original)
+++ trunk/reactos/hal/halx86/generic/sysinfo.c Wed Nov 15 03:08:51 2006
@@ -1,12 +1,12 @@
/*
-* PROJECT: ReactOS HA:
-* LICENSE: GPL - See COPYING in the top level directory
-* FILE: ntoskrnl/hal/halx86/generic/sysinfo.c
-* PURPOSE: HAL Information Routines
-* PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org)
-*/
+ * PROJECT: ReactOS HA:
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: ntoskrnl/hal/halx86/generic/sysinfo.c
+ * PURPOSE: HAL Information Routines
+ * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org)
+ */
-/* INCLUDES *****************************************************************/
+/* INCLUDES ******************************************************************/
#include <hal.h>
#define NDEBUG
Modified: trunk/reactos/ntoskrnl/ntoskrnl.def
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl.def?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ntoskrnl.def (original)
+++ trunk/reactos/ntoskrnl/ntoskrnl.def Wed Nov 15 03:08:51 2006
@@ -157,6 +157,7 @@
ExSetTimerResolution@8
ExSystemExceptionFilter@0
ExSystemTimeToLocalTime@8
+@ExiTryToAcquireFastMutex@4=@ExTryToAcquireFastMutex@4
ExTryToAcquireResourceExclusiveLite@4
ExUnregisterCallback@4
ExUuidCreate@4