Author: fireball
Date: Wed Jan 30 13:46:38 2008
New Revision: 32052
URL:
http://svn.reactos.org/svn/reactos?rev=32052&view=rev
Log:
- 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.
Modified:
trunk/reactos/boot/freeldr/freeldr/mm/meminit.c
trunk/reactos/boot/freeldr/freeldr/windows/winldr.c
Modified: trunk/reactos/boot/freeldr/freeldr/mm/meminit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/mm/me…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/mm/meminit.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/mm/meminit.c Wed Jan 30 13:46:38 2008
@@ -97,7 +97,7 @@
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 @@
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,15 +303,24 @@
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);
Modified: trunk/reactos/boot/freeldr/freeldr/windows/winldr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/windo…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/windows/winldr.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/windows/winldr.c Wed Jan 30 13:46:38 2008
@@ -458,13 +458,13 @@
/* 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 */