HyperDbg Debugger
Loading...
Searching...
No Matches
PlatformSpinlock.c File Reference

Implementation of cross platform APIs for kernel spinlock operations. More...

#include "pch.h"

Functions

VOID PlatformSpinlockInitialize (PKSPIN_LOCK SpinLock)
 Initialize a kernel spinlock.
VOID PlatformSpinlockAcquire (PKSPIN_LOCK SpinLock, PKIRQL OldIrql)
 Acquire a kernel spinlock, raising IRQL to DISPATCH_LEVEL.
VOID PlatformSpinlockRelease (PKSPIN_LOCK SpinLock, KIRQL OldIrql)
 Release a previously acquired kernel spinlock and restore IRQL.

Detailed Description

Implementation of cross platform APIs for kernel spinlock operations.

Author
Sina Karvandi (sina@.nosp@m.hype.nosp@m.rdbg..nosp@m.org)
Version
0.19
Date
2026-05-09

Function Documentation

◆ PlatformSpinlockAcquire()

VOID PlatformSpinlockAcquire ( PKSPIN_LOCK SpinLock,
PKIRQL OldIrql )

Acquire a kernel spinlock, raising IRQL to DISPATCH_LEVEL.

Parameters
SpinLockPointer to the KSPIN_LOCK to acquire
OldIrqlReceives the previous IRQL value to be restored on release
Returns
VOID
51{
52#if defined(_WIN32) || defined(_WIN64)
53
54 KeAcquireSpinLock(SpinLock, OldIrql);
55
56#elif defined(__linux__)
57
58# error "Not yet implemented"
59
60#else
61
62# error "Unsupported platform"
63
64#endif
65}

◆ PlatformSpinlockInitialize()

VOID PlatformSpinlockInitialize ( PKSPIN_LOCK SpinLock)

Initialize a kernel spinlock.

Parameters
SpinLockPointer to the KSPIN_LOCK to initialize
Returns
VOID
26{
27#if defined(_WIN32) || defined(_WIN64)
28
29 KeInitializeSpinLock(SpinLock);
30
31#elif defined(__linux__)
32
33# error "Not yet implemented"
34
35#else
36
37# error "Unsupported platform"
38
39#endif
40}

◆ PlatformSpinlockRelease()

VOID PlatformSpinlockRelease ( PKSPIN_LOCK SpinLock,
KIRQL OldIrql )

Release a previously acquired kernel spinlock and restore IRQL.

Parameters
SpinLockPointer to the KSPIN_LOCK to release
OldIrqlThe previous IRQL value saved during acquire
Returns
VOID
76{
77#if defined(_WIN32) || defined(_WIN64)
78
79 KeReleaseSpinLock(SpinLock, OldIrql);
80
81#elif defined(__linux__)
82
83# error "Not yet implemented"
84
85#else
86
87# error "Unsupported platform"
88
89#endif
90}