mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 17:05:46 +00:00
- Dehaxx0r MmInitializeMemoryManager in freeldr.
- Add slightly better bios memory map projection to the loader memory types, but this is still being investigated. - Remove unneeded code. - Change 'WINNT' to 'WINDOWS', but anyway this will be fixed later to get a real system path. svn path=/trunk/; revision=32052
This commit is contained in:
parent
7550f93c9e
commit
c9b8e73e23
2 changed files with 20 additions and 13 deletions
|
@ -97,7 +97,7 @@ BOOLEAN MmInitializeMemoryManager(VOID)
|
|||
MmUpdateLastFreePageHint(PageLookupTableAddress, TotalPagesInLookupTable);
|
||||
|
||||
// Add machine-dependent stuff
|
||||
// FIXME: this is only for i386
|
||||
#ifdef __i386__
|
||||
MmMarkPagesInLookupTable(PageLookupTableAddress, 0x00, 1, LoaderFirmwarePermanent); // realmode int vectors
|
||||
MmMarkPagesInLookupTable(PageLookupTableAddress, 0x01, 7, LoaderFirmwareTemporary); // freeldr stack + cmdline
|
||||
MmMarkPagesInLookupTable(PageLookupTableAddress, 0x08, 0x70, LoaderLoadedProgram); // freeldr image (roughly max. 0x64 pages)
|
||||
|
@ -106,9 +106,7 @@ BOOLEAN MmInitializeMemoryManager(VOID)
|
|||
MmMarkPagesInLookupTable(PageLookupTableAddress, 0x90, 0x10, LoaderOsloaderHeap); // Disk read buffer for int 13h. DISKREADBUFFER
|
||||
MmMarkPagesInLookupTable(PageLookupTableAddress, 0xA0, 0x60, LoaderFirmwarePermanent); // ROM / Video
|
||||
MmMarkPagesInLookupTable(PageLookupTableAddress, 0xFFF, 1, LoaderSpecialMemory); // unusable memory
|
||||
|
||||
// This one is strange, without it WinNT crashes with PHASE0_EXCEPTION
|
||||
MmMarkPagesInLookupTable(PageLookupTableAddress, 0x59, 0x5, LoaderFirmwarePermanent);
|
||||
#endif
|
||||
|
||||
FreePagesInLookupTable = MmCountFreePagesInLookupTable(PageLookupTableAddress, TotalPagesInLookupTable);
|
||||
|
||||
|
@ -305,16 +303,25 @@ VOID MmInitPageLookupTable(PVOID PageLookupTable, ULONG TotalPageCount, PBIOS_ME
|
|||
MemoryMapStartPage = MmGetPageNumberFromAddress((PVOID)(ULONG)BiosMemoryMap[Index].BaseAddress);
|
||||
MemoryMapEndPage = MmGetPageNumberFromAddress((PVOID)(ULONG)(BiosMemoryMap[Index].BaseAddress + BiosMemoryMap[Index].Length - 1));
|
||||
MemoryMapPageCount = (MemoryMapEndPage - MemoryMapStartPage) + 1;
|
||||
MemoryMapPageAllocated = (BiosMemoryMap[Index].Type == BiosMemoryUsable) ? LoaderFree : LoaderFirmwarePermanent;/*BiosMemoryMap[Index].Type*/;
|
||||
|
||||
switch (BiosMemoryMap[Index].Type)
|
||||
{
|
||||
case BiosMemoryUsable:
|
||||
MemoryMapPageAllocated = LoaderFree;
|
||||
break;
|
||||
|
||||
case BiosMemoryAcpiReclaim:
|
||||
case BiosMemoryAcpiNvs:
|
||||
MemoryMapPageAllocated = LoaderSpecialMemory;
|
||||
break;
|
||||
|
||||
default:
|
||||
MemoryMapPageAllocated = LoaderSpecialMemory;
|
||||
}
|
||||
DbgPrint((DPRINT_MEMORY, "Marking pages as type %d: StartPage: %d PageCount: %d\n", MemoryMapPageAllocated, MemoryMapStartPage, MemoryMapPageCount));
|
||||
MmMarkPagesInLookupTable(PageLookupTable, MemoryMapStartPage, MemoryMapPageCount, MemoryMapPageAllocated);
|
||||
}
|
||||
|
||||
// Mark the low memory region below 1MB as reserved (256 pages in region)
|
||||
//FIXME: Not needed now since we mark low 1Mb with really used and free areas
|
||||
//DbgPrint((DPRINT_MEMORY, "Marking the low 1MB region as reserved.\n"));
|
||||
//MmMarkPagesInLookupTable(PageLookupTable, 0, 256, LoaderFirmwarePermanent);
|
||||
|
||||
// Mark the pages that the lookup table occupies as reserved
|
||||
PageLookupTableStartPage = MmGetPageNumberFromAddress(PageLookupTable);
|
||||
PageLookupTablePageCount = MmGetPageNumberFromAddress((PVOID)((ULONG_PTR)PageLookupTable + ROUND_UP(TotalPageCount * sizeof(PAGE_LOOKUP_TABLE_ITEM), MM_PAGE_SIZE))) - PageLookupTableStartPage;
|
||||
|
|
|
@ -458,13 +458,13 @@ LoadAndBootWindows(PCSTR OperatingSystemName, WORD OperatingSystemVersion)
|
|||
|
||||
/* Allocate data table entries for above-loaded modules */
|
||||
WinLdrAllocateDataTableEntry(LoaderBlock, "ntoskrnl.exe",
|
||||
"WINNT\\SYSTEM32\\NTOSKRNL.EXE", NtosBase, &KernelDTE);
|
||||
"WINDOWS\\SYSTEM32\\NTOSKRNL.EXE", NtosBase, &KernelDTE);
|
||||
WinLdrAllocateDataTableEntry(LoaderBlock, "hal.dll",
|
||||
"WINNT\\SYSTEM32\\HAL.DLL", HalBase, &HalDTE);
|
||||
"WINDOWS\\SYSTEM32\\HAL.DLL", HalBase, &HalDTE);
|
||||
if (OperatingSystemVersion > _WIN32_WINNT_WIN2K)
|
||||
{
|
||||
WinLdrAllocateDataTableEntry(LoaderBlock, "kdcom.dll",
|
||||
"WINNT\\SYSTEM32\\KDCOM.DLL", KdComBase, &KdComDTE);
|
||||
"WINDOWS\\SYSTEM32\\KDCOM.DLL", KdComBase, &KdComDTE);
|
||||
}
|
||||
|
||||
/* Load all referenced DLLs for kernel, HAL and kdcom.dll */
|
||||
|
|
Loading…
Reference in a new issue