mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 05:22:57 +00:00
- 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. svn path=/trunk/; revision=24762
This commit is contained in:
parent
6e572dc57a
commit
b649dd5293
8 changed files with 74 additions and 194 deletions
|
@ -3,9 +3,9 @@
|
||||||
LIBRARY hal.dll
|
LIBRARY hal.dll
|
||||||
|
|
||||||
EXPORTS
|
EXPORTS
|
||||||
@ExAcquireFastMutex@4
|
@ExAcquireFastMutex@4=@ExiAcquireFastMutex@4
|
||||||
@ExReleaseFastMutex@4
|
@ExReleaseFastMutex@4=@ExiReleaseFastMutex@4
|
||||||
@ExTryToAcquireFastMutex@4
|
@ExTryToAcquireFastMutex@4=@ExiTryToAcquireFastMutex@4
|
||||||
HalAcquireDisplayOwnership@4
|
HalAcquireDisplayOwnership@4
|
||||||
HalAdjustResourceList@4
|
HalAdjustResourceList@4
|
||||||
HalAllProcessorsStarted@0
|
HalAllProcessorsStarted@0
|
||||||
|
|
|
@ -1,101 +0,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@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 */
|
|
|
@ -8,7 +8,6 @@
|
||||||
<file>bus.c</file>
|
<file>bus.c</file>
|
||||||
<file>dma.c</file>
|
<file>dma.c</file>
|
||||||
<file>drive.c</file>
|
<file>drive.c</file>
|
||||||
<file>fmutex.c</file>
|
|
||||||
<file>halinit.c</file>
|
<file>halinit.c</file>
|
||||||
<file>isa.c</file>
|
<file>isa.c</file>
|
||||||
<file>kdbg.c</file>
|
<file>kdbg.c</file>
|
||||||
|
@ -31,7 +30,6 @@
|
||||||
<define name="__USE_W32API" />
|
<define name="__USE_W32API" />
|
||||||
<file>irql.c</file>
|
<file>irql.c</file>
|
||||||
<file>processor.c</file>
|
<file>processor.c</file>
|
||||||
<file>resource.c</file>
|
|
||||||
<file>spinlock.c</file>
|
<file>spinlock.c</file>
|
||||||
<file>systimer.S</file>
|
<file>systimer.S</file>
|
||||||
</module>
|
</module>
|
||||||
|
|
|
@ -1,40 +1,34 @@
|
||||||
/* $Id$
|
/*
|
||||||
*
|
* PROJECT: ReactOS HAL
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* LICENSE: GPL - See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* FILE: ntoskrnl/hal/halx86/generic/processor.c
|
||||||
* FILE: ntoskrnl/hal/x86/halinit.c
|
* PURPOSE: HAL Processor Routines
|
||||||
* PURPOSE: Initalize the x86 hal
|
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
|
||||||
* PROGRAMMER: David Welch (welch@cwcom.net)
|
|
||||||
* UPDATE HISTORY:
|
|
||||||
* 11/06/98: Created
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* INCLUDES *****************************************************************/
|
/* INCLUDES ******************************************************************/
|
||||||
|
|
||||||
#include <hal.h>
|
#include <hal.h>
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
/* GLOBALS *****************************************************************/
|
/* GLOBALS *******************************************************************/
|
||||||
|
|
||||||
PVOID HalpZeroPageMapping = NULL;
|
PVOID HalpZeroPageMapping = NULL;
|
||||||
HALP_HOOKS HalpHooks;
|
HALP_HOOKS HalpHooks;
|
||||||
|
|
||||||
/* FUNCTIONS ***************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
NTSTATUS
|
/*
|
||||||
STDCALL
|
* @implemented
|
||||||
DriverEntry(
|
*/
|
||||||
PDRIVER_OBJECT DriverObject,
|
BOOLEAN
|
||||||
PUNICODE_STRING RegistryPath)
|
NTAPI
|
||||||
|
HalInitSystem(IN ULONG BootPhase,
|
||||||
|
IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
{
|
{
|
||||||
return STATUS_SUCCESS;
|
PHYSICAL_ADDRESS Null = {{0}};
|
||||||
}
|
|
||||||
|
|
||||||
BOOLEAN STDCALL
|
|
||||||
HalInitSystem (ULONG BootPhase,
|
|
||||||
PLOADER_PARAMETER_BLOCK LoaderBlock)
|
|
||||||
{
|
|
||||||
if (BootPhase == 0)
|
if (BootPhase == 0)
|
||||||
{
|
{
|
||||||
RtlZeroMemory(&HalpHooks, sizeof(HALP_HOOKS));
|
RtlZeroMemory(&HalpHooks, sizeof(HALP_HOOKS));
|
||||||
|
@ -51,10 +45,25 @@ HalInitSystem (ULONG BootPhase,
|
||||||
}
|
}
|
||||||
else if (BootPhase == 2)
|
else if (BootPhase == 2)
|
||||||
{
|
{
|
||||||
HalpZeroPageMapping = MmMapIoSpace((LARGE_INTEGER)0LL, PAGE_SIZE, MmNonCached);
|
HalpZeroPageMapping = MmMapIoSpace(Null, PAGE_SIZE, MmNonCached);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* All done, return */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
HalReportResourceUsage(VOID)
|
||||||
|
{
|
||||||
|
/* Initialize PCI bus. */
|
||||||
|
HalpInitPciBus();
|
||||||
|
|
||||||
|
/* FIXME: Report HAL Usage to kernel */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -1,23 +1,20 @@
|
||||||
/* $Id$
|
/*
|
||||||
*
|
* PROJECT: ReactOS HAL
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* LICENSE: GPL - See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* FILE: ntoskrnl/hal/halx86/generic/processor.c
|
||||||
* FILE: hal/halx86/generic/processor.c
|
* PURPOSE: HAL Processor Routines
|
||||||
* PURPOSE: Intel MultiProcessor specification support
|
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
|
||||||
* PROGRAMMER: David Welch (welch@cwcom.net)
|
|
||||||
* Casper S. Hornstrup (chorns@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
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* INCLUDES *****************************************************************/
|
/* INCLUDES ******************************************************************/
|
||||||
|
|
||||||
#include <hal.h>
|
#include <hal.h>
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
LONG HalpActiveProcessors;
|
||||||
|
KAFFINITY HalpDefaultInterruptAffinity;
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -28,9 +25,15 @@ NTAPI
|
||||||
HalInitializeProcessor(IN ULONG ProcessorNumber,
|
HalInitializeProcessor(IN ULONG ProcessorNumber,
|
||||||
IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
{
|
{
|
||||||
/* Set default IDR */
|
/* Set default IDR and stall count */
|
||||||
KeGetPcr()->IDR = 0xFFFFFFFB;
|
KeGetPcr()->IDR = 0xFFFFFFFB;
|
||||||
KeGetPcr()->StallScaleFactor = INITIAL_STALL_COUNT;
|
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 @@ VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
HalProcessorIdle(VOID)
|
HalProcessorIdle(VOID)
|
||||||
{
|
{
|
||||||
|
/* Enable interrupts and halt the processor */
|
||||||
_enable();
|
_enable();
|
||||||
Ki386HaltProcessor();
|
Ki386HaltProcessor();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,31 +0,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@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 */
|
|
|
@ -6,7 +6,7 @@
|
||||||
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
|
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* INCLUDES *****************************************************************/
|
/* INCLUDES ******************************************************************/
|
||||||
|
|
||||||
#include <hal.h>
|
#include <hal.h>
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
|
|
|
@ -157,6 +157,7 @@ ExSetResourceOwnerPointer@8
|
||||||
ExSetTimerResolution@8
|
ExSetTimerResolution@8
|
||||||
ExSystemExceptionFilter@0
|
ExSystemExceptionFilter@0
|
||||||
ExSystemTimeToLocalTime@8
|
ExSystemTimeToLocalTime@8
|
||||||
|
@ExiTryToAcquireFastMutex@4=@ExTryToAcquireFastMutex@4
|
||||||
ExTryToAcquireResourceExclusiveLite@4
|
ExTryToAcquireResourceExclusiveLite@4
|
||||||
ExUnregisterCallback@4
|
ExUnregisterCallback@4
|
||||||
ExUuidCreate@4
|
ExUuidCreate@4
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue