1 /* $Id: mmtypes.h,v 1.21 2004/12/22 05:06:59 royce Exp $ */
3 #ifndef _INCLUDE_DDK_MMTYPES_H
4 #define _INCLUDE_DDK_MMTYPES_H
6 #include <ddk/i386/pagesize.h>
10 * FUNCTION: Determines if the given virtual address is page aligned
12 #define IS_PAGE_ALIGNED(Va) (((ULONG)Va)&0xfff)
15 * PURPOSE: Returns the byte offset of a field within a structure
18 #define FIELD_OFFSET(Type,Field) ((LONG)(&(((Type *)(0))->Field)))
22 * PURPOSE: Returns the base address structure if the caller knows the
23 * address of a field within the structure
25 * Address = address of the field
26 * Type = Type of the whole structure
27 * Field = Name of the field whose address is none
29 #ifndef CONTAINING_RECORD
30 #define CONTAINING_RECORD(Address,Type,Field) ((Type *)(((LONG)Address) - FIELD_OFFSET(Type,Field)))
34 #define MDL_MAPPED_TO_SYSTEM_VA (0x1)
35 #define MDL_PAGES_LOCKED (0x2)
36 #define MDL_SOURCE_IS_NONPAGED_POOL (0x4)
37 #define MDL_ALLOCATED_FIXED_SIZE (0x8)
38 #define MDL_PARTIAL (0x10)
39 #define MDL_PARTIAL_HAS_BEEN_MAPPED (0x20)
40 #define MDL_IO_PAGE_READ (0x40)
41 #define MDL_WRITE_OPERATION (0x80)
42 #define MDL_PARENT_MAPPED_SYSTEM_VA (0x100)
43 #define MDL_LOCK_HELD (0x200)
44 #define MDL_SCATTER_GATHER_VA (0x400)
45 #define MDL_IO_SPACE (0x800)
46 #define MDL_NETWORK_HEADER (0x1000)
47 #define MDL_MAPPING_CAN_FAIL (0x2000)
48 #define MDL_ALLOCATED_MUST_SUCCEED (0x4000)
49 #define MDL_64_BIT_VA (0x8000)
54 * PURPOSE: Describes a user buffer passed to a system API
60 struct _EPROCESS
* Process
;
67 typedef struct _PHYSICAL_MEMORY_RANGE
{
68 PHYSICAL_ADDRESS BaseAddress
;
69 LARGE_INTEGER NumberOfBytes
;
70 } PHYSICAL_MEMORY_RANGE
, *PPHYSICAL_MEMORY_RANGE
;
72 // read file scatter / write file scatter
73 typedef union _FILE_SEGMENT_ELEMENT
{
76 }FILE_SEGMENT_ELEMENT
, *PFILE_SEGMENT_ELEMENT
;
78 typedef struct _READ_LIST
{
79 struct _FILE_OBJECT
* FileObject
;
80 ULONG NumberOfEntries
;
82 FILE_SEGMENT_ELEMENT List
[1];
83 } READ_LIST
, *PREAD_LIST
;
85 #define MmSmallSystem (0)
86 #define MmMediumSystem (1)
87 #define MmLargeSystem (2)
89 /* Used in MmFlushImageSection */
90 typedef enum _MMFLUSH_TYPE
96 typedef enum _MEMORY_CACHING_TYPE_ORIG
{
97 MmFrameBufferCached
= 2
98 } MEMORY_CACHING_TYPE_ORIG
;
100 typedef enum _MEMORY_CACHING_TYPE
104 MmWriteCombined
= MmFrameBufferCached
,
105 MmHardwareCoherentCached
,
107 } MEMORY_CACHING_TYPE
;
109 typedef struct _MMWSL
*PMMWSL
;
111 typedef struct _MMSUPPORT_FLAGS
{
112 ULONG SessionSpace
: 1;
113 ULONG BeingTrimmed
: 1;
114 ULONG SessionLeader
: 1;
116 ULONG WorkingSetHard
: 1;
117 ULONG AddressSpaceBeingDeleted
: 1;
118 ULONG Available
: 10;
119 ULONG AllowWorkingSetAdjustment
: 8;
120 ULONG MemoryPriority
: 8;
121 } MMSUPPORT_FLAGS
, *PMMSUPPORT_FLAGS
;
123 typedef struct _MMSUPPORT
125 LARGE_INTEGER LastTrimTime
;
126 MMSUPPORT_FLAGS Flags
;
127 ULONG PageFaultCount
;
128 ULONG PeakWorkingSetSize
;
129 ULONG WorkingSetSize
;
130 ULONG MinimumWorkingSetSize
;
131 ULONG MaximumWorkingSetSize
;
132 PMMWSL VmWorkingSetList
;
133 LIST_ENTRY WorkingSetExpansionLinks
;
135 ULONG NextEstimationSlot
;
137 ULONG EstimatedAvailable
;
138 ULONG GrowthSinceLastEstimate
;
139 } MMSUPPORT
, *PMMSUPPORT
;