ReactOS
0.4.16-dev-91-g764881a
fxspinlock.hpp
Go to the documentation of this file.
1
/*++
2
3
Copyright (c) Microsoft Corporation
4
5
Module Name:
6
7
FxSpinLock.hpp
8
9
Abstract:
10
11
Author:
12
13
14
Revision History:
15
16
--*/
17
18
#ifndef _FXSPINLOCK_H_
19
#define _FXSPINLOCK_H_
20
21
#define FX_SPIN_LOCK_NUM_HISTORY_ENTRIES (10)
22
23
struct
FX_SPIN_LOCK_HISTORY_ENTRY
{
24
PVOID
CallersAddress
;
25
LARGE_INTEGER
AcquiredAtTime
;
26
LONGLONG
LockedDuraction
;
27
};
28
29
typedef
struct
FX_SPIN_LOCK_HISTORY_ENTRY
*
PFX_SPIN_LOCK_HISTORY_ENTRY
;
30
31
struct
FX_SPIN_LOCK_HISTORY
{
32
MxThread
OwningThread
;
33
34
PFX_SPIN_LOCK_HISTORY_ENTRY
CurrentHistory
;
35
36
FX_SPIN_LOCK_HISTORY_ENTRY
History
[
FX_SPIN_LOCK_NUM_HISTORY_ENTRIES
];
37
};
38
39
typedef
struct
FX_SPIN_LOCK_HISTORY
*
PFX_SPIN_LOCK_HISTORY
;
40
41
class
FxSpinLock
:
public
FxObject
{
42
43
public
:
44
FxSpinLock
(
45
__in
PFX_DRIVER_GLOBALS
FxDriverGlobals,
46
__in
USHORT
ExtraSize
47
);
48
49
50
__drv_raisesIRQL
(
DISPATCH_LEVEL
)
51
__drv_maxIRQL
(
DISPATCH_LEVEL
)
52
VOID
53
AcquireLock
(
54
__in
PVOID
CallersAddress
55
);
56
57
__drv_requiresIRQL
(
DISPATCH_LEVEL
)
58
VOID
59
ReleaseLock
(
60
VOID
61
);
62
63
64
MdLock
*
65
GetLock
(
66
VOID
67
)
68
{
69
return
&
m_SpinLock
.
Get
();
70
}
71
72
VOID
73
SetInterruptSpinLock
(
74
VOID
75
)
76
{
77
m_InterruptLock
=
TRUE
;
78
}
79
80
BOOLEAN
81
IsInterruptLock
(
82
VOID
83
)
84
{
85
return
m_InterruptLock
;
86
}
87
88
protected
:
89
PFX_SPIN_LOCK_HISTORY
90
GetHistory
(
91
VOID
92
)
93
{
94
if
(
GetObjectSize
() ==
WDF_ALIGN_SIZE_UP
(
sizeof
(
FxSpinLock
),
95
MEMORY_ALLOCATION_ALIGNMENT
)) {
96
return
NULL
;
97
}
98
else
{
99
return
WDF_PTR_ADD_OFFSET_TYPE
(
100
this
,
101
COMPUTE_RAW_OBJECT_SIZE
(
sizeof
(
FxSpinLock
)),
102
PFX_SPIN_LOCK_HISTORY
);
103
}
104
}
105
106
protected
:
107
MxLock
m_SpinLock
;
108
109
KIRQL
m_Irql
;
110
111
//
112
// TRUE, this lock is being used to synchronize FxInterrupts. As such, the
113
// caller is not allowed to actually call WDFSPINLOCK APIs on the handle
114
// because it would then be acquiring a spinlock at DISPATCH_LEVEL and the
115
// interrupt could be attempting to acquire the same lock at a higher IRQL
116
// on the same processor.
117
//
118
BOOLEAN
m_InterruptLock
;
119
};
120
121
#endif
// _FXSPINLOCK_H_
BOOLEAN
unsigned char BOOLEAN
Definition:
ProcessorBind.h:185
FxObject
Definition:
fxobject.hpp:232
FxObject::GetObjectSize
USHORT GetObjectSize(VOID)
Definition:
fxobject.hpp:750
FxSpinLock
Definition:
fxspinlock.hpp:41
FxSpinLock::m_SpinLock
MxLock m_SpinLock
Definition:
fxspinlock.hpp:107
FxSpinLock::GetLock
MdLock * GetLock(VOID)
Definition:
fxspinlock.hpp:65
FxSpinLock::m_Irql
KIRQL m_Irql
Definition:
fxspinlock.hpp:109
FxSpinLock::__drv_requiresIRQL
__drv_requiresIRQL(DISPATCH_LEVEL) VOID ReleaseLock(VOID)
FxSpinLock::IsInterruptLock
BOOLEAN IsInterruptLock(VOID)
Definition:
fxspinlock.hpp:81
FxSpinLock::SetInterruptSpinLock
VOID SetInterruptSpinLock(VOID)
Definition:
fxspinlock.hpp:73
FxSpinLock::__drv_raisesIRQL
__drv_raisesIRQL(DISPATCH_LEVEL) __drv_maxIRQL(DISPATCH_LEVEL) VOID AcquireLock(__in PVOID CallersAddress)
FxSpinLock::m_InterruptLock
BOOLEAN m_InterruptLock
Definition:
fxspinlock.hpp:118
FxSpinLock::GetHistory
PFX_SPIN_LOCK_HISTORY GetHistory(VOID)
Definition:
fxspinlock.hpp:90
MxLockNoDynam::Get
MdLock & Get()
Definition:
mxlock.h:43
MxLock
Definition:
mxlock.h:102
__in
#define __in
Definition:
dbghelp.h:35
NULL
#define NULL
Definition:
types.h:112
TRUE
#define TRUE
Definition:
types.h:120
__drv_maxIRQL
#define __drv_maxIRQL(irql)
Definition:
driverspecs.h:291
KIRQL
UCHAR KIRQL
Definition:
env_spec_w32.h:591
DISPATCH_LEVEL
#define DISPATCH_LEVEL
Definition:
env_spec_w32.h:696
AcquireLock
pPkgPnp m_DeviceInterfaceLock AcquireLock(pFxDriverGlobals)
ReleaseLock
pPkgPnp m_DeviceInterfaceLock ReleaseLock(pFxDriverGlobals)
COMPUTE_RAW_OBJECT_SIZE
#define COMPUTE_RAW_OBJECT_SIZE(_rawObjectSize)
Definition:
fxhandle.h:100
PFX_SPIN_LOCK_HISTORY
struct FX_SPIN_LOCK_HISTORY * PFX_SPIN_LOCK_HISTORY
Definition:
fxspinlock.hpp:39
PFX_SPIN_LOCK_HISTORY_ENTRY
struct FX_SPIN_LOCK_HISTORY_ENTRY * PFX_SPIN_LOCK_HISTORY_ENTRY
Definition:
fxspinlock.hpp:29
FX_SPIN_LOCK_NUM_HISTORY_ENTRIES
#define FX_SPIN_LOCK_NUM_HISTORY_ENTRIES
Definition:
fxspinlock.hpp:21
void
Definition:
nsiface.idl:2307
MEMORY_ALLOCATION_ALIGNMENT
#define MEMORY_ALLOCATION_ALIGNMENT
Definition:
ntbasedef.h:90
USHORT
unsigned short USHORT
Definition:
pedump.c:61
FX_SPIN_LOCK_HISTORY_ENTRY
Definition:
fxspinlock.hpp:23
FX_SPIN_LOCK_HISTORY_ENTRY::CallersAddress
PVOID CallersAddress
Definition:
fxspinlock.hpp:24
FX_SPIN_LOCK_HISTORY_ENTRY::AcquiredAtTime
LARGE_INTEGER AcquiredAtTime
Definition:
fxspinlock.hpp:25
FX_SPIN_LOCK_HISTORY_ENTRY::LockedDuraction
LONGLONG LockedDuraction
Definition:
fxspinlock.hpp:26
FX_SPIN_LOCK_HISTORY
Definition:
fxspinlock.hpp:31
FX_SPIN_LOCK_HISTORY::CurrentHistory
PFX_SPIN_LOCK_HISTORY_ENTRY CurrentHistory
Definition:
fxspinlock.hpp:34
FX_SPIN_LOCK_HISTORY::History
FX_SPIN_LOCK_HISTORY_ENTRY History[FX_SPIN_LOCK_NUM_HISTORY_ENTRIES]
Definition:
fxspinlock.hpp:36
FX_SPIN_LOCK_HISTORY::OwningThread
MxThread OwningThread
Definition:
fxspinlock.hpp:32
MdLock
Definition:
mxlockum.h:26
_FX_DRIVER_GLOBALS
Definition:
fxglobals.h:165
_KTHREAD
Definition:
ketypes.h:1660
LONGLONG
int64_t LONGLONG
Definition:
typedefs.h:68
_LARGE_INTEGER
Definition:
typedefs.h:103
WDF_PTR_ADD_OFFSET_TYPE
#define WDF_PTR_ADD_OFFSET_TYPE(_ptr, _offset, _type)
Definition:
wdfcore.h:141
WDF_ALIGN_SIZE_UP
FORCEINLINE size_t WDF_ALIGN_SIZE_UP(_In_ size_t Length, _In_ size_t AlignTo)
Definition:
wdfcore.h:129
sdk
lib
drivers
wdf
shared
inc
private
common
fxspinlock.hpp
Generated on Sun Oct 6 2024 06:13:20 for ReactOS by
1.9.6