60#define MAX_MAD_COUNT 200
70 TRACE(
"MempAddMemoryBlock(BasePage=0x%lx, PageCount=0x%lx, Type=%ld)\n",
71 BasePage, PageCount,
Type);
75 if (BasePage >= MM_MAX_PAGE)
82 if (BasePage + PageCount > MM_MAX_PAGE)
85 PageCount = MM_MAX_PAGE - BasePage;
91 ERR(
"Error: no MAD slots left!\n");
113 TRACE(
"MempSetupPagingForRegion(BasePage=0x%lx, PageCount=0x%lx, Type=%ld)\n",
114 BasePage, PageCount,
Type);
172 ERR(
"Error during MempSetupPaging\n");
183 PFN_NUMBER i, PagesCount, MemoryMapSizeInPages, NoEntries;
223 UiMessageBox(
"Can not retrieve the current memory map.");
231 TRACE(
"Got memory map with %d entries\n", NoEntries);
237 ERR(
"Error during MempSetupPaging of first page\n");
243 LastPageType =
MemoryMap[1].PageAllocated;
244 for (
i = 2;
i < NoEntries;
i++)
246 if ((
MemoryMap[
i].PageAllocated != LastPageType) ||
247 (
i == NoEntries - 1))
261 LastPageType =
MemoryMap[0].PageAllocated;
262 for (
i = 1;
i < NoEntries;
i++)
265 if (
i >= MemoryMapStartPage &&
266 i < (MemoryMapStartPage+MemoryMapSizeInPages))
273 if (
MemoryMap[
i].PageAllocated == LastPageType &&
342 TRACE(
"Memory Descriptor List prepared, printing PDE\n");
343 List_PaToVa(&LoaderBlock->MemoryDescriptorListHead);
358 PLIST_ENTRY ListHead = &LoaderBlock->MemoryDescriptorListHead;
366 PreviousEntry = ListHead;
367 NextEntry = ListHead->
Flink;
368 while (NextEntry != ListHead)
376 PreviousEntry = NextEntry;
377 PreviousDescriptor = NextDescriptor;
378 NextEntry = NextEntry->
Flink;
405 if ((NextEntry != ListHead) &&
BOOLEAN MempSetupPaging(IN PFN_NUMBER StartPage, IN PFN_NUMBER NumberOfPages, IN BOOLEAN KernelMapping)
BIOS_MEMORY_MAP MemoryMap[32]
#define DBG_DEFAULT_CHANNEL(ch)
PVOID MmAllocateMemoryWithType(SIZE_T MemorySize, TYPE_OF_MEMORY MemoryType)
PPAGE_LOOKUP_TABLE_ITEM MmGetMemoryMap(PFN_NUMBER *NoEntries)
VOID FrLdrHeapCleanupAll(VOID)
VOID UiMessageBox(_In_ PCSTR Format,...)
#define RemoveEntryList(Entry)
#define InsertHeadList(ListHead, Entry)
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
VOID List_PaToVa(_In_ LIST_ENTRY *ListEntry)
@ LoaderFirmwareTemporary
@ LoaderFirmwarePermanent
@ LoaderStartupKernelStack
@ LoaderStartupPanicStack
TYPE_OF_MEMORY MemoryType
struct _LIST_ENTRY * Flink
TYPE_OF_MEMORY MemoryType
#define CONTAINING_RECORD(address, type, field)
VOID WinLdrpDumpMemoryDescriptors(PLOADER_PARAMETER_BLOCK LoaderBlock)
MEMORY_ALLOCATION_DESCRIPTOR * Mad
PFREELDR_MEMORY_DESCRIPTOR BiosMemoryMap
BOOLEAN WinLdrSetupMemoryLayout(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock)
static const PCSTR MemTypeDesc[]
PFN_NUMBER MmLowestPhysicalPage
PFN_NUMBER MmHighestPhysicalPage
static VOID WinLdrInsertDescriptor(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock, IN PMEMORY_ALLOCATION_DESCRIPTOR NewDescriptor)
VOID MempSetupPagingForRegion(PFN_NUMBER BasePage, PFN_NUMBER PageCount, ULONG Type)
VOID MempAddMemoryBlock(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock, PFN_NUMBER BasePage, PFN_NUMBER PageCount, ULONG Type)
ULONG BiosMemoryMapEntryCount
_In_opt_ PSECURITY_DESCRIPTOR _Out_ PSECURITY_DESCRIPTOR * NewDescriptor