mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 14:51:44 +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
|
||||
|
||||
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
|
||||
|
|
|
@ -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>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>
|
||||
|
|
|
@ -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@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@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}};
|
||||
|
||||
BOOLEAN STDCALL
|
||||
HalInitSystem (ULONG BootPhase,
|
||||
PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
{
|
||||
if (BootPhase == 0)
|
||||
if (BootPhase == 0)
|
||||
{
|
||||
RtlZeroMemory(&HalpHooks, sizeof(HALP_HOOKS));
|
||||
HalpInitPhase0(LoaderBlock);
|
||||
RtlZeroMemory(&HalpHooks, sizeof(HALP_HOOKS));
|
||||
HalpInitPhase0(LoaderBlock);
|
||||
}
|
||||
else if (BootPhase == 1)
|
||||
else if (BootPhase == 1)
|
||||
{
|
||||
/* Initialize the clock interrupt */
|
||||
//HalpInitPhase1();
|
||||
/* Initialize the clock interrupt */
|
||||
//HalpInitPhase1();
|
||||
|
||||
/* Initialize BUS handlers and DMA */
|
||||
HalpInitBusHandlers();
|
||||
HalpInitDma();
|
||||
}
|
||||
else if (BootPhase == 2)
|
||||
/* Initialize BUS handlers and DMA */
|
||||
HalpInitBusHandlers();
|
||||
HalpInitDma();
|
||||
}
|
||||
else if (BootPhase == 2)
|
||||
{
|
||||
HalpZeroPageMapping = MmMapIoSpace((LARGE_INTEGER)0LL, PAGE_SIZE, MmNonCached);
|
||||
HalpZeroPageMapping = MmMapIoSpace(Null, PAGE_SIZE, MmNonCached);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
/* All done, return */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
VOID
|
||||
NTAPI
|
||||
HalReportResourceUsage(VOID)
|
||||
{
|
||||
/* Initialize PCI bus. */
|
||||
HalpInitPciBus();
|
||||
|
||||
/* FIXME: Report HAL Usage to kernel */
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,23 +1,20 @@
|
|||
/* $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@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
|
||||
/*
|
||||
* 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@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <hal.h>
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
LONG HalpActiveProcessors;
|
||||
KAFFINITY HalpDefaultInterruptAffinity;
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
/*
|
||||
|
@ -28,9 +25,15 @@ NTAPI
|
|||
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 @@ VOID
|
|||
NTAPI
|
||||
HalProcessorIdle(VOID)
|
||||
{
|
||||
/* Enable interrupts and halt the processor */
|
||||
_enable();
|
||||
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 */
|
|
@ -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@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@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <hal.h>
|
||||
#define NDEBUG
|
||||
|
|
|
@ -157,6 +157,7 @@ ExSetResourceOwnerPointer@8
|
|||
ExSetTimerResolution@8
|
||||
ExSystemExceptionFilter@0
|
||||
ExSystemTimeToLocalTime@8
|
||||
@ExiTryToAcquireFastMutex@4=@ExTryToAcquireFastMutex@4
|
||||
ExTryToAcquireResourceExclusiveLite@4
|
||||
ExUnregisterCallback@4
|
||||
ExUuidCreate@4
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue