15#define BL_HEAP_POINTER_FLAG_BITS 3
141 if (HeapLimit <= Heap->HeapEnd)
203 ULONG BucketIndex = 0;
212 while (
Size >> BucketIndex)
218 return BucketIndex - 5;
229 BlStatusPrint(
L"Heap corruption in the links surrounding %p!\r\n", BufferEntry);
238 EfiPrintf(
L"Heap corruption in the links surrounding %p!\r\n", BufferEntry);
363 FreeEntry->BufferNext.BufferFree = 1;
419 Entry->BufferNext.BufferFree = 1;
621 if ((NextEntry >= FreeEntry) &&
639 BusyEntry = FreeEntry;
651 EfiPrintf(
L"Heap extended -- trying again\r\n");
659 return &BusyEntry->
Buffer;
699 if (BusyEntry->BufferNext.BufferFree)
710 NextEntry = NextEntry->
Flink;
#define ALIGN_UP_BY(size, align)
VOID EfiPrintf(_In_ PWCHAR Format,...)
NTSTATUS MmPapAllocatePagesInRange(_Inout_ PVOID *PhysicalAddress, _In_ BL_MEMORY_TYPE MemoryType, _In_ ULONGLONG Pages, _In_ ULONG Attributes, _In_ ULONG Alignment, _In_opt_ PBL_ADDRESS_RANGE Range, _In_ ULONG Type)
NTSTATUS EfiStall(_In_ ULONG StallTime)
BL_LIBRARY_PARAMETERS BlpLibraryParameters
BOOLEAN BlBdDebuggerEnabled(VOID)
#define BL_LIBRARY_FLAG_ZERO_HEAP_ALLOCATIONS_ON_FREE
VOID BlStatusPrint(_In_ PCWCH Format,...)
#define NT_SUCCESS(StatCode)
#define InsertTailList(ListHead, Entry)
#define IsListEmpty(ListHead)
#define InitializeListHead(ListHead)
#define BL_HEAP_POINTER_FLAG_BITS
PBL_FREE_HEAP_ENTRY MmHapAddToFreeList(_In_ PBL_BUSY_HEAP_ENTRY Entry, _In_ ULONG Flags)
struct _BL_BUSY_HEAP_ENTRY * PBL_BUSY_HEAP_ENTRY
LIST_ENTRY MmHeapBoundaries
struct _BL_HEAP_BOUNDARIES * PBL_HEAP_BOUNDARIES
NTSTATUS MmHaInitialize(_In_ ULONG HeapSize, _In_ ULONG HeapAttributes)
PVOID BlMmAllocateHeap(_In_ SIZE_T Size)
struct _BL_FREE_HEAP_ENTRY BL_FREE_HEAP_ENTRY
PVOID MmHapCheckBufferLinks(_In_ PVOID BufferEntry)
VOID MmHapReportHeapCorruption(_In_ PBL_FREE_HEAP_ENTRY BufferEntry)
struct _BL_HEAP_POINTER * PBL_HEAP_POINTER
FORCEINLINE ULONG MmHapUserBufferSize(_In_ PVOID FreeEntry)
struct _BL_BUSY_HEAP_ENTRY BL_BUSY_HEAP_ENTRY
PBL_BUSY_HEAP_ENTRY MmHapFindBufferInFreeList(_In_ ULONG Size)
PBL_FREE_HEAP_ENTRY MmHapCoalesceFreeBuffer(_In_ PBL_FREE_HEAP_ENTRY FreeEntry)
PBL_FREE_HEAP_ENTRY MmHapRemoveBufferFromFreeList(_In_ PBL_FREE_HEAP_ENTRY FreeEntry)
struct _BL_HEAP_POINTER BL_HEAP_POINTER
FORCEINLINE PBL_FREE_HEAP_ENTRY MmHapDecodeLink(_In_ BL_HEAP_POINTER Link)
PVOID MmHapCheckFreeLinks(_In_ PVOID BufferEntry)
ULONG MmHapGetBucketId(_In_ ULONG Size)
NTSTATUS MmHapHeapAllocatorExtend(_In_ ULONG ExtendSize)
ULONG HapInitializationStatus
ULONG HapAllocationAttributes
PBL_FREE_HEAP_ENTRY * MmFreeList
NTSTATUS BlMmFreeHeap(_In_ PVOID Buffer)
struct _BL_HEAP_BOUNDARIES BL_HEAP_BOUNDARIES
FORCEINLINE ULONG MmHapBufferSize(_In_ PVOID FreeEntry)
struct _BL_FREE_HEAP_ENTRY * PBL_FREE_HEAP_ENTRY
void __cdecl __debugbreak(void)
#define STATUS_INTEGER_OVERFLOW
base of all file and directory entries
UCHAR Buffer[ANYSIZE_ARRAY]
BL_HEAP_POINTER BufferNext
BL_HEAP_POINTER BufferPrevious
BL_HEAP_POINTER BufferPrevious
BL_HEAP_POINTER BufferNext
BL_HEAP_POINTER FreePrevious
PBL_BUSY_HEAP_ENTRY HeapStart
struct _LIST_ENTRY * Flink
#define FIELD_OFFSET(t, f)
#define RtlZeroMemory(Destination, Length)
#define CONTAINING_RECORD(address, type, field)
#define STATUS_INVALID_PARAMETER
#define STATUS_UNSUCCESSFUL
#define STATUS_INSUFFICIENT_RESOURCES
static int Link(const char **args)
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
SIZE_T WINAPI HeapSize(HANDLE, DWORD, LPCVOID)
_Must_inspect_result_ _In_ ULONG Flags