diff --git a/reactos/ntoskrnl/amd64stubs.c b/reactos/ntoskrnl/amd64stubs.c index fccd94cca8d..b384d2e564c 100644 --- a/reactos/ntoskrnl/amd64stubs.c +++ b/reactos/ntoskrnl/amd64stubs.c @@ -7,7 +7,6 @@ unsigned long (*FrLdrDbgPrint)(const char *Format, ...); STUB(KdpEnableSafeMem) STUB(KiIdleLoop) -STUB(KeAcquireInStackQueuedSpinLockRaiseToSynch) STUB(KeBugcheckCallbackListHead) STUB(ExpInterlockedPushEntrySList) STUB(NtContinue) @@ -131,12 +130,6 @@ STUB(IoTranslateBusAddress) STUB(IoWMIDeviceObjectToProviderId) STUB(KdDebuggerEnabled) STUB(KdDebuggerNotPresent) -STUB(KeAcquireQueuedSpinLock) -STUB(_imp__KeAcquireQueuedSpinLock) -STUB(_imp__KeReleaseQueuedSpinLock) -STUB(KeAcquireQueuedSpinLockRaiseToSynch) -STUB(KeAcquireSpinLockRaiseToDpc) -STUB(KeAcquireSpinLockRaiseToSynch) STUB(KeEnterCriticalRegion) STUB(KeEnterGuardedRegion) STUB(KeExpandKernelStackAndCallout) @@ -152,8 +145,6 @@ STUB(KeQueryActiveProcessors) STUB(KeQueryMultiThreadProcessorSet) STUB(KeQueryPrcbAddress) STUB(KeReadStateMutex) -STUB(KeReleaseQueuedSpinLock) -STUB(KeReleaseSpinLock) STUB(KeRestoreFloatingPointState) STUB(KeSaveFloatingPointState) STUB(KeSaveStateForHibernate) @@ -161,8 +152,6 @@ STUB(KeSetDmaIoCoherency) STUB(KeSignalCallDpcDone) STUB(KeSignalCallDpcSynchronize) STUB(KeSynchronizeExecution) -STUB(KeTryToAcquireQueuedSpinLock) -STUB(KeTryToAcquireQueuedSpinLockRaiseToSynch) STUB(KeUpdateRunTime) STUB(KeUpdateSystemTime) STUB(KeUserModeCallback) @@ -245,10 +234,6 @@ STUB(_local_unwind) STUB(_setjmp) STUB(_setjmpex) STUB(longjmp) -STUB(KfReleaseSpinLock) -STUB(KeAcquireInStackQueuedSpinLock) -STUB(KeReleaseInStackQueuedSpinLock) -STUB(KfAcquireSpinLock) STUB(KeProcessorArchitecture) STUB(KeProcessorLevel) STUB(KeProcessorRevision) diff --git a/reactos/ntoskrnl/include/internal/amd64/ke.h b/reactos/ntoskrnl/include/internal/amd64/ke.h index 8ee91fb03d9..6fa646a0865 100644 --- a/reactos/ntoskrnl/include/internal/amd64/ke.h +++ b/reactos/ntoskrnl/include/internal/amd64/ke.h @@ -65,6 +65,9 @@ typedef struct _KIDT_INIT //#define KeArchFnInit() Ke386FnInit() #define KeArchFnInit() DbgPrint("KeArchFnInit is unimplemented!\n"); #define KeArchHaltProcessor() Ke386HaltProcessor() +#define KfLowerIrql KeLowerIrql +#define KfAcquireSpinLock KeAcquireSpinLock +#define KfReleaseSpinLock KeReleaseSpinLock extern ULONG Ke386CacheAlignment; diff --git a/reactos/ntoskrnl/ke/amd64/spinlock.c b/reactos/ntoskrnl/ke/amd64/spinlock.c new file mode 100644 index 00000000000..c3ac026d878 --- /dev/null +++ b/reactos/ntoskrnl/ke/amd64/spinlock.c @@ -0,0 +1,188 @@ +/* + * PROJECT: ReactOS HAL + * LICENSE: GPL - See COPYING in the top level directory + * FILE: hal/halx86/up/spinlock.c + * PURPOSE: Spinlock and Queued Spinlock Support + * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include +#define NDEBUG +#include + +#undef KeAcquireSpinLock +#undef KeReleaseSpinLock + +/* FUNCTIONS *****************************************************************/ + +/* + * @implemented + */ +KIRQL +KeAcquireSpinLockRaiseToSynch(PKSPIN_LOCK SpinLock) +{ +#ifndef CONFIG_SMP + /* Simply raise to dispatch */ + return KfRaiseIrql(DISPATCH_LEVEL); +#else + UNIMPLEMENTED; +#endif +} + +/* + * @implemented + */ +KIRQL +NTAPI +KeAcquireSpinLockRaiseToDpc(PKSPIN_LOCK SpinLock) +{ +#ifndef CONFIG_SMP + /* Simply raise to dispatch */ + return KfRaiseIrql(DISPATCH_LEVEL); +#else + UNIMPLEMENTED; +#endif +} + +/* + * @implemented + */ +VOID +NTAPI +KeReleaseSpinLock(PKSPIN_LOCK SpinLock, + KIRQL OldIrql) +{ +#ifndef CONFIG_SMP + /* Simply lower IRQL back */ + KfLowerIrql(OldIrql); +#else + UNIMPLEMENTED; +#endif +} + +/* + * @implemented + */ +KIRQL +KeAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber) +{ +#ifndef CONFIG_SMP + /* Simply raise to dispatch */ + return KfRaiseIrql(DISPATCH_LEVEL); +#else + UNIMPLEMENTED; +#endif +} + +/* + * @implemented + */ +KIRQL +KeAcquireQueuedSpinLockRaiseToSynch(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber) +{ +#ifndef CONFIG_SMP + /* Simply raise to dispatch */ + return KfRaiseIrql(DISPATCH_LEVEL); +#else + UNIMPLEMENTED; +#endif +} + +/* + * @implemented + */ +VOID +KeAcquireInStackQueuedSpinLock(IN PKSPIN_LOCK SpinLock, + IN PKLOCK_QUEUE_HANDLE LockHandle) +{ +#ifndef CONFIG_SMP + /* Simply raise to dispatch */ + LockHandle->OldIrql = KfRaiseIrql(DISPATCH_LEVEL); +#else + UNIMPLEMENTED; +#endif +} + +/* + * @implemented + */ +VOID +KeAcquireInStackQueuedSpinLockRaiseToSynch(IN PKSPIN_LOCK SpinLock, + IN PKLOCK_QUEUE_HANDLE LockHandle) +{ +#ifndef CONFIG_SMP + /* Simply raise to synch */ + LockHandle->OldIrql = KfRaiseIrql(SYNCH_LEVEL); +#else + UNIMPLEMENTED; +#endif +} + +/* + * @implemented + */ +VOID +KeReleaseQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber, + IN KIRQL OldIrql) +{ +#ifndef CONFIG_SMP + /* Simply lower IRQL back */ + KfLowerIrql(OldIrql); +#else + UNIMPLEMENTED; +#endif +} + +/* + * @implemented + */ +VOID +KeReleaseInStackQueuedSpinLock(IN PKLOCK_QUEUE_HANDLE LockHandle) +{ +#ifndef CONFIG_SMP + /* Simply lower IRQL back */ + KfLowerIrql(LockHandle->OldIrql); +#else + UNIMPLEMENTED; +#endif +} + +/* + * @implemented + */ +BOOLEAN +KeTryToAcquireQueuedSpinLockRaiseToSynch(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber, + IN PKIRQL OldIrql) +{ +#ifndef CONFIG_SMP + /* Simply raise to dispatch */ + *OldIrql = KfRaiseIrql(DISPATCH_LEVEL); + + /* Always return true on UP Machines */ + return TRUE; +#else + UNIMPLEMENTED; +#endif +} + +/* + * @implemented + */ +LOGICAL +KeTryToAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber, + OUT PKIRQL OldIrql) +{ +#ifndef CONFIG_SMP + /* Simply raise to dispatch */ + *OldIrql = KfRaiseIrql(DISPATCH_LEVEL); + + /* Always return true on UP Machines */ + return TRUE; +#else + UNIMPLEMENTED; +#endif +} + +/* EOF */ diff --git a/reactos/ntoskrnl/ke/spinlock.c b/reactos/ntoskrnl/ke/spinlock.c index d4be3b5fac3..ab2cb37e601 100644 --- a/reactos/ntoskrnl/ke/spinlock.c +++ b/reactos/ntoskrnl/ke/spinlock.c @@ -86,6 +86,7 @@ KeReleaseQueuedSpinLockFromDpcLevel(IN PKSPIN_LOCK_QUEUE LockHandle) /* PUBLIC FUNCTIONS **********************************************************/ +#ifdef _X86_ /* * @implemented */ @@ -96,6 +97,7 @@ KeInitializeSpinLock(IN PKSPIN_LOCK SpinLock) /* Clear it */ *SpinLock = 0; } +#endif /* * @implemented diff --git a/reactos/ntoskrnl/ntoskrnl-amd64hack.rbuild b/reactos/ntoskrnl/ntoskrnl-amd64hack.rbuild index e450f445c04..c8908fa403b 100644 --- a/reactos/ntoskrnl/ntoskrnl-amd64hack.rbuild +++ b/reactos/ntoskrnl/ntoskrnl-amd64hack.rbuild @@ -95,6 +95,7 @@ except.c irql.c kiinit.c + spinlock.c thrdini.c trap.S diff --git a/reactos/ntoskrnl/ntoskrnl_amd64.def b/reactos/ntoskrnl/ntoskrnl_amd64.def index 4bd04a00ff9..e69168fa2cd 100644 --- a/reactos/ntoskrnl/ntoskrnl_amd64.def +++ b/reactos/ntoskrnl/ntoskrnl_amd64.def @@ -4,16 +4,6 @@ ; EXPORTS ; -KfAcquireSpinLock -KfReleaseSpinLock -KefAcquireSpinLockAtDpcLevel -KefReleaseSpinLockFromDpcLevel -KeInitializeSpinLock -KeGetCurrentProcessorNumber -RtlConvertUlongToLargeInteger -RtlExtendedIntegerMultiply -; -; original: CcCanIWrite CcCopyRead CcCopyWrite