From 631c260280ff6dbb815fc561ed3bb7203728fd1d Mon Sep 17 00:00:00 2001 From: Aiken Harris Date: Thu, 11 Sep 2025 19:23:19 +0200 Subject: [PATCH] Update SpinLock and DPC to use C++ helpers --- xtoskrnl/ke/dpc.cc | 2 +- xtoskrnl/ke/spinlock.cc | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/xtoskrnl/ke/dpc.cc b/xtoskrnl/ke/dpc.cc index bda583a..2a689ff 100644 --- a/xtoskrnl/ke/dpc.cc +++ b/xtoskrnl/ke/dpc.cc @@ -114,7 +114,7 @@ XTAPI VOID Dpc::SignalCallDone(IN PVOID SystemArgument) { - RtlAtomicDecrement32((PLONG)SystemArgument); + RTL::Atomic::Decrement32((PLONG)SystemArgument); } /** diff --git a/xtoskrnl/ke/spinlock.cc b/xtoskrnl/ke/spinlock.cc index f9e4684..5fba654 100644 --- a/xtoskrnl/ke/spinlock.cc +++ b/xtoskrnl/ke/spinlock.cc @@ -28,7 +28,7 @@ VOID SpinLock::AcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_LEVEL LockLevel) { /* Acquire the queued spinlock */ - AcquireSpinLock(KeGetCurrentProcessorControlBlock()->LockQueue[LockLevel].Lock); + AcquireSpinLock(KE::Processor::GetCurrentProcessorControlBlock()->LockQueue[LockLevel].Lock); } /** @@ -46,18 +46,18 @@ VOID SpinLock::AcquireSpinLock(IN OUT PKSPIN_LOCK SpinLock) { /* Try to acquire the lock */ - while(RtlAtomicBitTestAndSet((PLONG)SpinLock, 0)) + while(RTL::Atomic::BitTestAndSet((PLONG)SpinLock, 0)) { /* Wait until locked is cleared */ while(*(VOLATILE PKSPIN_LOCK)SpinLock & 1) { /* Yield processor and keep waiting */ - ArYieldProcessor(); + AR::CpuFunc::YieldProcessor(); } } /* Add an explicit memory barrier */ - ArReadWriteBarrier(); + AR::CpuFunc::ReadWriteBarrier(); } /** @@ -93,7 +93,7 @@ VOID SpinLock::ReleaseQueuedSpinLock(IN KSPIN_LOCK_QUEUE_LEVEL LockLevel) { /* Clear the lock */ - ReleaseSpinLock(KeGetCurrentProcessorControlBlock()->LockQueue[LockLevel].Lock); + ReleaseSpinLock(KE::Processor::GetCurrentProcessorControlBlock()->LockQueue[LockLevel].Lock); } /** @@ -111,10 +111,10 @@ VOID SpinLock::ReleaseSpinLock(IN OUT PKSPIN_LOCK SpinLock) { /* Clear the lock */ - RtlAtomicAnd32((PLONG)SpinLock, 0); + RTL::Atomic::And32((PLONG)SpinLock, 0); /* Add an explicit memory barrier */ - ArReadWriteBarrier(); + AR::CpuFunc::ReadWriteBarrier(); } } /* namespace */