ReactOS  0.4.15-dev-2700-g4b4ffa9
fxpagedlookasidelist.hpp
Go to the documentation of this file.
1 /*++
2 
3 Copyright (c) Microsoft Corporation
4 
5 Module Name:
6 
7  FxPagedLookasideList.hpp
8 
9 Abstract:
10 
11 Author:
12 
13 Environment:
14 
15  kernel mode only
16 
17 Revision History:
18 
19 --*/
20 
21 #ifndef _FXPAGEDLOOKASIDELIST_H_
22 #define _FXPAGEDLOOKASIDELIST_H_
23 
25 
27 
28 public:
30  __in PFX_DRIVER_GLOBALS FxDriverGlobals,
32  __in FxDeviceBase* DeviceBase,
33  __in FxDeviceBase* MemoryDeviceBase
34  );
35 
36  virtual
38  NTSTATUS
39  Initialize(
40  __in size_t BufferSize,
42  );
43 
44  virtual
46  NTSTATUS
47  Allocate(
48  __out FxMemoryObject** PPMemory
49  );
50 
51 protected:
53  VOID
54  );
55 
56  virtual
57  VOID
58  Reclaim(
60  );
61 
62  virtual
63  VOID
66  )
67  {
68  if (m_BufferSize < PAGE_SIZE) {
70 
71  //
72  // For < PAGE_SIZE, we track the allocation
73  //
74  pHeader = CONTAINING_RECORD(Pool, FX_POOL_HEADER, AllocationStart);
75 
76  //
77  // If PoolTracker is on then do....
78  //
79  if (GetDriverGlobals()->IsPoolTrackingOn()) {
80  //
81  // Decommission this Paged Allocation tracker
82  //
83 #pragma prefast(suppress:__WARNING_BUFFER_UNDERFLOW, "Accessing pool's header to reclaim pool");
85  }
86 
87 #pragma prefast(suppress:__WARNING_BUFFER_UNDERFLOW, "Accessing pool's header to reclaim pool");
89  }
90  else {
91  //
92  // Page or greater size has no allocation tracking info prepended
93  // to the allocation.
94  //
96  }
97  }
98 
99  PVOID
102  );
103 
104  BOOLEAN
106  VOID
107  )
108  {
109  return m_MemoryDeviceBase != NULL ? TRUE : FALSE;
110  }
111 
112 protected:
113  //
114  // m_BufferSize is the size of the allocation that client sees.
115  // m_RawBufferSize is m_BufferSize + whatever else we need to track the
116  // allocation.
117  //
119 
121 
123 
125 };
126 
127 #endif // _FXPAGEDLOOKASIDELIST_H_
NPAGED_LOOKASIDE_LIST m_ObjectLookaside
#define _Must_inspect_result_
Definition: no_sal2.h:62
struct LOOKASIDE_ALIGN _NPAGED_LOOKASIDE_LIST NPAGED_LOOKASIDE_LIST
#define __out_bcount(x)
Definition: dbghelp.h:68
#define TRUE
Definition: types.h:120
virtual _Must_inspect_result_ NTSTATUS Allocate(__out FxMemoryObject **PPMemory)
LONG NTSTATUS
Definition: precomp.h:26
__inline VOID FxFreeToPagedLookasideList(__in PPAGED_LOOKASIDE_LIST Lookaside, __in PVOID Entry)
Definition: fxglobalskm.h:694
VOID __inline FxPoolRemovePagedAllocateTracker(__in PFX_POOL_TRACKER Tracker)
virtual VOID ReclaimPool(__inout PVOID Pool)
#define FALSE
Definition: types.h:117
PVOID InitPagedAlloc(__out_bcount(this->m_RawBufferSize) PVOID Alloc)
FxContextHeader * pHeader
Definition: handleapi.cpp:604
#define __out
Definition: dbghelp.h:62
unsigned char BOOLEAN
virtual _Must_inspect_result_ NTSTATUS Initialize(__in size_t BufferSize, __in PWDF_OBJECT_ATTRIBUTES MemoryAttributes)
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG _In_ _Out_ WDFMEMORY * Memory
Definition: wdfmemory.h:169
PVOID Alloc(IN DWORD dwFlags, IN SIZE_T dwBytes)
Definition: main.c:63
Definition: bufpool.h:50
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG PoolTag
Definition: wdfmemory.h:159
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _In_ _Strict_type_match_ POOL_TYPE _In_opt_ PWDF_OBJECT_ATTRIBUTES MemoryAttributes
Definition: wdfmemory.h:407
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define __inout
Definition: dbghelp.h:50
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
struct LOOKASIDE_ALIGN _PAGED_LOOKASIDE_LIST PAGED_LOOKASIDE_LIST
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
FxPagedLookasideListFromPool(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in ULONG PoolTag, __in FxDeviceBase *DeviceBase, __in FxDeviceBase *MemoryDeviceBase)
virtual VOID Reclaim(__in FxMemoryBufferFromLookaside *Memory)
#define __in
Definition: dbghelp.h:35
FX_POOL_TRACKER * PFX_POOL_TRACKER
Definition: fxpool.h:107
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:251