ReactOS 0.4.16-dev-340-g0540c21
fxspinlock.cpp File Reference
#include "fxsupportpch.hpp"
#include "fxspinlock.hpp"
Include dependency graph for fxspinlock.cpp:

Go to the source code of this file.

Functions

 __drv_raisesIRQL (DISPATCH_LEVEL) __drv_maxIRQL(DISPATCH_LEVEL) VOID FxSpinLock
 
 __drv_requiresIRQL (DISPATCH_LEVEL) VOID FxSpinLock
 

Function Documentation

◆ __drv_raisesIRQL()

__drv_raisesIRQL ( DISPATCH_LEVEL  )

Definition at line 53 of file fxspinlock.cpp.

59{
60 PFX_SPIN_LOCK_HISTORY pHistory;
61 KIRQL irql;
62
63 m_SpinLock.Acquire(&irql);
64
65 m_Irql = irql;
66
67 pHistory = GetHistory();
68
69 if (pHistory != NULL) {
71
72 //
73 // This assert should never fire here, but this helps track ownership
74 // in the case of a release without an acquire.
75 //
76 ASSERT(pHistory->OwningThread == NULL);
78
79 pCur = pHistory->CurrentHistory;
80
81 Mx::MxQueryTickCount(&pCur->AcquiredAtTime);
82 pCur->CallersAddress = CallersAddress;
83 }
84}
static __inline VOID MxQueryTickCount(__out PLARGE_INTEGER TickCount)
Definition: mxgeneralkm.h:116
static __inline MxThread MxGetCurrentThread()
Definition: mxgeneralkm.h:61
#define NULL
Definition: types.h:112
KIRQL irql
Definition: wave.h:1
UCHAR KIRQL
Definition: env_spec_w32.h:591
SINGLE_LIST_ENTRY * pCur
#define ASSERT(a)
Definition: mode.c:44
Definition: fxspinlock.hpp:23
PFX_SPIN_LOCK_HISTORY_ENTRY CurrentHistory
Definition: fxspinlock.hpp:34

◆ __drv_requiresIRQL()

__drv_requiresIRQL ( DISPATCH_LEVEL  )

Definition at line 86 of file fxspinlock.cpp.

91{
92 PFX_SPIN_LOCK_HISTORY pHistory;
93
94 pHistory = GetHistory();
95
96 if (pHistory != NULL) {
99
100 if (pHistory->OwningThread != Mx::MxGetCurrentThread()) {
101 if (pHistory->OwningThread == NULL) {
103 GetDriverGlobals(), TRACE_LEVEL_ERROR, TRACINGERROR,
104 "WDFSPINLOCK %p being released by thread 0x%p, but was "
105 "never acquired!", GetObjectHandle(), Mx::MxGetCurrentThread());
106 }
107 else {
109 GetDriverGlobals(), TRACE_LEVEL_ERROR, TRACINGERROR,
110 "WDFSPINLOCK 0x%p not owned by thread 0x%p, owned by thread 0x%p",
112 pHistory->OwningThread);
113 }
114
115 FxVerifierBugCheck(GetDriverGlobals(),
118 0x1);
119 //
120 // Will not get here
121 //
122 return;
123 }
124
125 ASSERT(pHistory->OwningThread != NULL);
126
128
129 pCur = pHistory->CurrentHistory;
130 pCur->LockedDuraction = now.QuadPart - pCur->AcquiredAtTime.QuadPart;
131
132 pHistory->CurrentHistory++;
133 if (pHistory->CurrentHistory >=
135 pHistory->CurrentHistory = pHistory->History;
136 }
137
138 pHistory->OwningThread = NULL;
139 }
140
141 m_SpinLock.Release(m_Irql);
142}
#define TRACINGERROR
Definition: dbgtrace.h:63
time_t now
Definition: finger.c:65
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
return pObject GetObjectHandle()
#define FX_SPIN_LOCK_NUM_HISTORY_ENTRIES
Definition: fxspinlock.hpp:21
#define FxVerifierBugCheck(FxDriverGlobals, Error,...)
Definition: fxverifier.h:58
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
FX_SPIN_LOCK_HISTORY_ENTRY History[FX_SPIN_LOCK_NUM_HISTORY_ENTRIES]
Definition: fxspinlock.hpp:36
uint32_t ULONG_PTR
Definition: typedefs.h:65
@ WDF_INVALID_LOCK_OPERATION
Definition: wdfbugcodes.h:68