mirror of
https://github.com/reactos/reactos.git
synced 2024-08-22 19:33:01 +00:00
211 lines
3.7 KiB
C
211 lines
3.7 KiB
C
/*
|
|
* PROJECT: ReactOS HAL
|
|
* LICENSE: GPL - See COPYING in the top level directory
|
|
* FILE: hal/halppc/generic/spinlock.c
|
|
* PURPOSE: Spinlock and Queued Spinlock Support
|
|
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
|
|
*/
|
|
|
|
/* INCLUDES ******************************************************************/
|
|
|
|
#include <hal.h>
|
|
#define NDEBUG
|
|
#include <debug.h>
|
|
|
|
#undef KeAcquireSpinLock
|
|
#undef KeReleaseSpinLock
|
|
#undef KeLowerIrql
|
|
#undef KeRaiseIrql
|
|
|
|
|
|
KIRQL FASTCALL
|
|
KfRaiseIrql (KIRQL NewIrql);
|
|
|
|
VOID FASTCALL
|
|
KfLowerIrql (KIRQL NewIrql);
|
|
|
|
/* FUNCTIONS *****************************************************************/
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
VOID
|
|
NTAPI
|
|
KeLowerIrql(KIRQL NewIrql)
|
|
{
|
|
/* Call the fastcall function */
|
|
KfLowerIrql(NewIrql);
|
|
}
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
NTKERNELAPI
|
|
KIRQL
|
|
NTAPI
|
|
KeRaiseIrql(KIRQL NewIrql,
|
|
PKIRQL OldIrql)
|
|
{
|
|
/* Call the fastcall function */
|
|
return *OldIrql = KfRaiseIrql(NewIrql);
|
|
}
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
VOID
|
|
NTAPI
|
|
KeAcquireSpinLock(PKSPIN_LOCK SpinLock,
|
|
PKIRQL OldIrql)
|
|
{
|
|
/* Call the fastcall function */
|
|
*OldIrql = KfAcquireSpinLock(SpinLock);
|
|
}
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
KIRQL
|
|
FASTCALL
|
|
KeAcquireSpinLockRaiseToSynch(PKSPIN_LOCK SpinLock)
|
|
{
|
|
/* Simply raise to dispatch */
|
|
return KfRaiseIrql(DISPATCH_LEVEL);
|
|
}
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
VOID
|
|
NTAPI
|
|
KeReleaseSpinLock(PKSPIN_LOCK SpinLock,
|
|
KIRQL NewIrql)
|
|
{
|
|
/* Call the fastcall function */
|
|
KfReleaseSpinLock(SpinLock, NewIrql);
|
|
}
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
KIRQL
|
|
FASTCALL
|
|
KfAcquireSpinLock(PKSPIN_LOCK SpinLock)
|
|
{
|
|
/* Simply raise to dispatch */
|
|
return KfRaiseIrql(DISPATCH_LEVEL);
|
|
}
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
VOID
|
|
FASTCALL
|
|
KfReleaseSpinLock(PKSPIN_LOCK SpinLock,
|
|
KIRQL OldIrql)
|
|
{
|
|
/* Simply lower IRQL back */
|
|
KfLowerIrql(OldIrql);
|
|
}
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
KIRQL
|
|
FASTCALL
|
|
KeAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber)
|
|
{
|
|
/* Simply raise to dispatch */
|
|
return KfRaiseIrql(DISPATCH_LEVEL);
|
|
}
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
KIRQL
|
|
FASTCALL
|
|
KeAcquireQueuedSpinLockRaiseToSynch(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber)
|
|
{
|
|
/* Simply raise to dispatch */
|
|
return KfRaiseIrql(DISPATCH_LEVEL);
|
|
}
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
VOID
|
|
FASTCALL
|
|
KeAcquireInStackQueuedSpinLock(IN PKSPIN_LOCK SpinLock,
|
|
IN PKLOCK_QUEUE_HANDLE LockHandle)
|
|
{
|
|
/* Simply raise to dispatch */
|
|
LockHandle->OldIrql = KfRaiseIrql(DISPATCH_LEVEL);
|
|
}
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
VOID
|
|
FASTCALL
|
|
KeAcquireInStackQueuedSpinLockRaiseToSynch(IN PKSPIN_LOCK SpinLock,
|
|
IN PKLOCK_QUEUE_HANDLE LockHandle)
|
|
{
|
|
/* Simply raise to synch */
|
|
LockHandle->OldIrql = KfRaiseIrql(SYNCH_LEVEL);
|
|
}
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
VOID
|
|
FASTCALL
|
|
KeReleaseQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber,
|
|
IN KIRQL OldIrql)
|
|
{
|
|
/* Simply lower IRQL back */
|
|
KfLowerIrql(OldIrql);
|
|
}
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
VOID
|
|
FASTCALL
|
|
KeReleaseInStackQueuedSpinLock(IN PKLOCK_QUEUE_HANDLE LockHandle)
|
|
{
|
|
/* Simply lower IRQL back */
|
|
KfLowerIrql(LockHandle->OldIrql);
|
|
}
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
BOOLEAN
|
|
FASTCALL
|
|
KeTryToAcquireQueuedSpinLockRaiseToSynch(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber,
|
|
IN PKIRQL OldIrql)
|
|
{
|
|
/* Simply raise to dispatch */
|
|
*OldIrql = KfRaiseIrql(DISPATCH_LEVEL);
|
|
|
|
/* Always return true on UP Machines */
|
|
return TRUE;
|
|
}
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
LOGICAL
|
|
FASTCALL
|
|
KeTryToAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber,
|
|
OUT PKIRQL OldIrql)
|
|
{
|
|
/* Simply raise to dispatch */
|
|
*OldIrql = KfRaiseIrql(DISPATCH_LEVEL);
|
|
|
|
/* Always return true on UP Machines */
|
|
return TRUE;
|
|
}
|
|
|
|
/* EOF */
|