152 EfiPrintf(
L"Dynamic switch NOT SUPPORTED!!!\r\n");
197 (Current != MdList->First))
200 MdList->This = Current;
232 MdList->First = ListHead;
238 MdList->First = &MdList->ListHead;
295 NextEntry =
First->Flink;
317 &ListDescriptor[*Used],
322 NextEntry = NextEntry->
Flink;
347 if (MdList->This == &
Entry->ListEntry)
364 FirstEntry = MdList->First;
365 NextEntry = FirstEntry->
Flink;
366 while (NextEntry != FirstEntry)
370 NextEntry = NextEntry->
Flink;
421 ListHead = MdList->First;
422 NextEntry = ListHead->
Flink;
423 while (NextEntry != ListHead)
431 NextEntry = NextEntry->
Flink;
445 if (BasePage < FoundEndPage)
448 EfiPrintf(
L"Truncating descriptor type %lx base: %llx end: %llx\r\n",
454 FoundEndPage - BasePage);
472 EfiPrintf(
L"Truncating descriptor type %lx base: %llx end: %llx\r\n",
510 if ((PreviousEntry != MdList->First) && (
MemoryDescriptor->BasePage < PreviousEndPage))
512 EfiPrintf(
L"Overlap detected -- this is unexpected on x86/x64 platforms\r\n");
517 if ((NextEntry != MdList->First) && (NextDescriptor->
BasePage <
EndPage))
519 EfiPrintf(
L"Overlap detected -- this is unexpected on x86/x64 platforms\r\n");
554 if ((PreviousEntry != MdList->First) &&
562 EfiPrintf(
L"Previous descriptor coalescable!\r\n");
566 if ((NextEntry != MdList->First) &&
574 EfiPrintf(
L"Next descriptor coalescable!\r\n");
601 Flags &= ~BL_MM_ADD_DESCRIPTOR_COALESCE_FLAG;
612 Flags &= ~BL_MM_ADD_DESCRIPTOR_TRUNCATE_FLAG;
622 ThisEntry = MdList->This;
626 FirstEntry = MdList->First;
633 ThisEntry = FirstEntry->
Flink;
637 while (ThisEntry != FirstEntry)
653 ThisEntry = ThisEntry->
Flink;
700 BOOLEAN HaveNewList, UseVirtualPage;
706 ULONGLONG FoundBasePage, FoundEndPage, FoundPageCount,
EndPage, VirtualPage;
710 ListDescriptor =
NULL;
715 if (NewMdList !=
NULL)
725 UseVirtualPage =
FALSE;
742 UseVirtualPage =
TRUE;
747 ListHead = MdList->First;
748 NextEntry = ListHead->
Flink;
749 while (NextEntry != ListHead)
757 FoundEndPage = FoundBasePage + FoundPageCount;
758 EndPage = PageCount + BasePage;
764 if ((BasePage > FoundBasePage) || (FoundBasePage >=
EndPage))
767 if ((BasePage >= FoundEndPage) || (FoundEndPage >
EndPage))
770 if ((FoundBasePage >= BasePage) || (
EndPage >= FoundEndPage))
780 FoundPageCount = BasePage - FoundBasePage;
817 OldDescriptor.
BasePage += FoundPageCount;
841 NextEntry = NextEntry->
Flink;
861 FoundPageCount = FoundEndPage - FoundBasePage;
872 NextEntry = NextEntry->
Flink;
895 if ((OldDescriptor.
PageCount) && (HaveNewList))
901 *ListDescriptor = OldDescriptor;
925 ListDescriptor =
NULL;
988 NextEntry = MdList->First->
Flink;
995 NextEntry = MdList->This;
999 NextEntry = MdList->First->
Flink;
1005 if (Page < Current->BasePage)
1007 NextEntry = MdList->First->
Flink;
1013 ListHead = MdList->First;
1014 while (NextEntry != ListHead)
1032 if ((!(IsVirtual) || (BasePage)) &&
1033 (BasePage <=
Page) &&
1041 NextEntry = NextEntry->
Flink;
1062 if (FoundDescriptor)
1065 return FoundDescriptor;
1074 if (FoundDescriptor)
1077 return FoundDescriptor;
1086 if (FoundDescriptor)
1089 return FoundDescriptor;
1098 if (FoundDescriptor)
1101 return FoundDescriptor;
1110 if (FoundDescriptor)
1113 return FoundDescriptor;
1122 if (FoundDescriptor)
1125 return FoundDescriptor;
1134 if (FoundDescriptor)
1137 return FoundDescriptor;
1146 if (FoundDescriptor)
1149 return FoundDescriptor;
1176 BaseMin = BaseRange->Minimum;
1177 BaseMax = BaseRange->Maximum;
1180 if (BaseMin < Descriptor->BasePage)
1192 if (BaseMin > BaseMax)
1204 AlignedMin = BaseMin;
1208 if (((AlignedMin + Pages - 1) < AlignedMin) || ((AlignedMin + Pages - 1) > BaseMax))
1217 BasePage = BaseMax - Pages + 1;
1225 AlignedBase = BasePage;
1229 BaseDelta = BasePage - AlignedBase;
1230 BasePage -= BaseDelta;
1235 BasePage = AlignedMin;
1240 if (((VirtualRange->Minimum) || (VirtualRange->Maximum)) &&
1250 VirtualMin = VirtualRange->Minimum;
1251 VirtualMax = VirtualRange->Maximum;
1254 if (VirtualMin <= Descriptor->VirtualPage)
1266 if (VirtualMin > VirtualMax)
1272 VirtualMin += AlignedMin - BaseMin;
1275 if (((VirtualMin + Pages - 1) < VirtualMin) ||
1276 ((VirtualMin + Pages - 1) > VirtualMax))
1285 VirtualPage = VirtualMax - Pages + 1 - BaseDelta;
1290 VirtualPage = VirtualMin;
#define ALIGN_DOWN_BY(size, align)
#define ALIGN_UP_BY(size, align)
BL_MEMORY_DESCRIPTOR_LIST MmMdlMappedUnallocated
@ BlConventionalZeroedMemory
VOID EfiPrintf(_In_ PWCHAR Format,...)
#define BL_MM_INCLUDE_TRUNCATED_MEMORY
BL_MEMORY_DESCRIPTOR_LIST MmMdlReservedAllocated
#define BL_MM_INCLUDE_MAPPED_ALLOCATED
BL_MEMORY_DESCRIPTOR_LIST MmMdlBadMemory
PVOID BlMmAllocateHeap(_In_ SIZE_T Size)
#define BL_MM_INCLUDE_UNMAPPED_UNALLOCATED
enum _BL_MEMORY_TYPE BL_MEMORY_TYPE
BL_MEMORY_DESCRIPTOR_LIST MmMdlUnmappedAllocated
#define BL_MEMORY_CLASS_SHIFT
#define BL_MM_ADD_DESCRIPTOR_NEVER_COALESCE_FLAG
#define BL_MM_INCLUDE_MAPPED_UNALLOCATED
#define BL_MM_ADD_DESCRIPTOR_COALESCE_FLAG
#define BL_MM_INCLUDE_BAD_MEMORY
BL_MEMORY_DESCRIPTOR_LIST MmMdlTruncatedMemory
NTSTATUS EfiStall(_In_ ULONG StallTime)
#define BL_MM_ADD_DESCRIPTOR_TRUNCATE_FLAG
BL_MEMORY_DESCRIPTOR_LIST MmMdlMappedAllocated
BL_MEMORY_DESCRIPTOR_LIST MmMdlUnmappedUnallocated
#define BL_MM_INCLUDE_PERSISTENT_MEMORY
ULONG MmDescriptorCallTreeCount
enum _BL_MEMORY_CLASS BL_MEMORY_CLASS
#define BL_MM_ADD_DESCRIPTOR_NEVER_TRUNCATE_FLAG
NTSTATUS BlMmFreeHeap(_In_ PVOID Buffer)
#define BL_MM_INCLUDE_UNMAPPED_ALLOCATED
#define BL_MM_INCLUDE_RESERVED_ALLOCATED
#define BL_MM_ADD_DESCRIPTOR_UPDATE_LIST_POINTER_FLAG
BL_MEMORY_DESCRIPTOR_LIST MmMdlPersistentMemory
#define BL_MM_REMOVE_VIRTUAL_REGION_FLAG
PBL_MEMORY_DESCRIPTOR MmMdFindDescriptorFromMdl(_In_ PBL_MEMORY_DESCRIPTOR_LIST MdList, _In_ ULONG Flags, _In_ ULONGLONG Page)
NTSTATUS MmMdFreeDescriptor(_In_ PBL_MEMORY_DESCRIPTOR MemoryDescriptor)
BOOLEAN MmMdpTruncateDescriptor(_In_ PBL_MEMORY_DESCRIPTOR_LIST MdList, _In_ PBL_MEMORY_DESCRIPTOR MemoryDescriptor, _In_ ULONG Flags)
NTSTATUS MmMdAddDescriptorToList(_In_ PBL_MEMORY_DESCRIPTOR_LIST MdList, _In_ PBL_MEMORY_DESCRIPTOR MemoryDescriptor, _In_ ULONG Flags)
ULONG MmMdCountList(_In_ PBL_MEMORY_DESCRIPTOR_LIST MdList)
ULONG MmGlobalMemoryDescriptorsUsed
VOID MmMdInitializeList(_In_ PBL_MEMORY_DESCRIPTOR_LIST MdList, _In_ ULONG Type, _In_ PLIST_ENTRY ListHead)
PBL_MEMORY_DESCRIPTOR MmMdInitByteGranularDescriptor(_In_ ULONG Flags, _In_ BL_MEMORY_TYPE Type, _In_ ULONGLONG BasePage, _In_ ULONGLONG VirtualPage, _In_ ULONGLONG PageCount)
ULONG MmGlobalMemoryDescriptorCount
BL_MEMORY_TYPE MmPlatformMemoryTypePrecedence[]
ULONG MmDynamicMemoryDescriptorCount
VOID MmMdRemoveDescriptorFromList(_In_ PBL_MEMORY_DESCRIPTOR_LIST MdList, _In_ PBL_MEMORY_DESCRIPTOR Entry)
PBL_MEMORY_DESCRIPTOR MmGlobalMemoryDescriptors
BOOLEAN MmMdpCoalesceDescriptor(_In_ PBL_MEMORY_DESCRIPTOR_LIST MdList, _In_ PBL_MEMORY_DESCRIPTOR MemoryDescriptor, _In_ ULONG Flags)
NTSTATUS MmMdRemoveRegionFromMdlEx(_In_ PBL_MEMORY_DESCRIPTOR_LIST MdList, _In_ ULONG Flags, _In_ ULONGLONG BasePage, _In_ ULONGLONG PageCount, _Out_opt_ PBL_MEMORY_DESCRIPTOR_LIST NewMdList)
VOID MmMdpSwitchToDynamicDescriptors(_In_ ULONG Count)
NTSTATUS MmMdCopyList(_In_ PBL_MEMORY_DESCRIPTOR_LIST DestinationList, _In_ PBL_MEMORY_DESCRIPTOR_LIST SourceList, _In_opt_ PBL_MEMORY_DESCRIPTOR ListDescriptor, _Out_ PULONG ActualCount, _In_ ULONG Count, _In_ ULONG Flags)
VOID MmMdFreeGlobalDescriptors(VOID)
BOOLEAN MmMdpHasPrecedence(_In_ BL_MEMORY_TYPE Type1, _In_ BL_MEMORY_TYPE Type2)
VOID MmMdFreeList(_In_ PBL_MEMORY_DESCRIPTOR_LIST MdList)
BOOLEAN MmMdFindSatisfyingRegion(_In_ PBL_MEMORY_DESCRIPTOR Descriptor, _Out_ PBL_MEMORY_DESCRIPTOR NewDescriptor, _In_ ULONGLONG Pages, _In_ PBL_ADDRESS_RANGE BaseRange, _In_ PBL_ADDRESS_RANGE VirtualRange, _In_ BOOLEAN TopDown, _In_ BL_MEMORY_TYPE MemoryType, _In_ ULONG Flags, _In_ ULONG Alignment)
PBL_MEMORY_DESCRIPTOR MmDynamicMemoryDescriptors
VOID MmMdpSaveCurrentListPointer(_In_ PBL_MEMORY_DESCRIPTOR_LIST MdList, _In_ PLIST_ENTRY Current)
VOID MmMdInitialize(_In_ ULONG Phase, _In_ PBL_LIBRARY_PARAMETERS LibraryParameters)
NTSTATUS MmMdTruncateDescriptors(_In_ PBL_MEMORY_DESCRIPTOR_LIST MdList, _In_ PBL_MEMORY_DESCRIPTOR_LIST NewList, _In_ ULONGLONG BasePage)
BL_MEMORY_DESCRIPTOR MmStaticMemoryDescriptors[512]
LONG MmMdpLookupTypePrecedenceIndex(_In_ BL_MEMORY_TYPE Type)
PBL_MEMORY_DESCRIPTOR MmMdFindDescriptor(_In_ ULONG WhichList, _In_ ULONG Flags, _In_ ULONGLONG Page)
#define NT_SUCCESS(StatCode)
#define RemoveEntryList(Entry)
#define InsertTailList(ListHead, Entry)
#define InitializeListHead(ListHead)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
__kernel_entry _Inout_ _Inout_ PSIZE_T RegionSize
_In_ PVOID _Out_opt_ BOOLEAN _Out_opt_ PPFN_NUMBER Page
base of all file and directory entries
struct _LIST_ENTRY * Blink
struct _LIST_ENTRY * Flink
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define CONTAINING_RECORD(address, type, field)
#define STATUS_INVALID_PARAMETER
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _In_ PWDF_USB_CONTROL_SETUP_PACKET _In_opt_ PWDF_MEMORY_DESCRIPTOR MemoryDescriptor
int WINAPI EndPage(_In_ HDC)
_In_ IN_ADDR _In_ IN_ADDR _Out_ MULTICAST_MODE_TYPE _Inout_ ULONG _Out_writes_ SourceCount IN_ADDR * SourceList
_Must_inspect_result_ _In_ ULONG Flags
_In_opt_ PSECURITY_DESCRIPTOR _Out_ PSECURITY_DESCRIPTOR * NewDescriptor