Author: fireball
Date: Sat Jan 20 01:23:58 2007
New Revision: 25538
URL:
http://svn.reactos.org/svn/reactos?rev=25538&view=rev
Log:
Unmap accessible, but completely unneeded by kernel memory too
Modified:
branches/winldr/windows/wlmemory.c
Modified: branches/winldr/windows/wlmemory.c
URL:
http://svn.reactos.org/svn/reactos/branches/winldr/windows/wlmemory.c?rev=2…
==============================================================================
--- branches/winldr/windows/wlmemory.c (original)
+++ branches/winldr/windows/wlmemory.c Sat Jan 20 01:23:58 2007
@@ -273,24 +273,32 @@
for (i=0; i<MadCount; i++)
{
+ ULONG StartPage, EndPage, Page;
+
+ StartPage = Mad[i].BasePage;
+ EndPage = Mad[i].BasePage + Mad[i].PageCount;
+
if (Mad[i].MemoryType == LoaderFirmwarePermanent ||
- Mad[i].MemoryType == LoaderSpecialMemory)
- {
- ULONG StartPage, EndPage, Page;
-
- StartPage = Mad[i].BasePage;
- EndPage = Mad[i].BasePage + Mad[i].PageCount;
+ Mad[i].MemoryType == LoaderSpecialMemory ||
+ Mad[i].MemoryType == LoaderFree ||
+ (Mad[i].MemoryType == LoaderFirmwareTemporary && EndPage <=
LOADER_HIGH_ZONE) ||
+ Mad[i].MemoryType == LoaderOsloaderStack ||
+ Mad[i].MemoryType == LoaderLoadedProgram)
+ {
//
// But, the first megabyte of memory always stays!
// And, to tell the truth, we don't care about what's higher
// than LOADER_HIGH_ZONE
- if (StartPage < 0x100)
- StartPage = 0x100;
-
- if (EndPage > LOADER_HIGH_ZONE)
- EndPage = LOADER_HIGH_ZONE;
-
+ if (Mad[i].MemoryType == LoaderFirmwarePermanent ||
+ Mad[i].MemoryType == LoaderSpecialMemory)
+ {
+ if (StartPage < 0x100)
+ StartPage = 0x100;
+
+ if (EndPage > LOADER_HIGH_ZONE)
+ EndPage = LOADER_HIGH_ZONE;
+ }
for (Page = StartPage; Page < EndPage; Page++)
{
@@ -301,9 +309,12 @@
{
KernelPT = (PHARDWARE_PTE)(PDE[Entry].PageFrameNumber << MM_PAGE_SHIFT);
- KernelPT[Page & 0x3ff].PageFrameNumber = 0;
- KernelPT[Page & 0x3ff].Valid = 0;
- KernelPT[Page & 0x3ff].Write = 0;
+ if (KernelPT)
+ {
+ KernelPT[Page & 0x3ff].PageFrameNumber = 0;
+ KernelPT[Page & 0x3ff].Valid = 0;
+ KernelPT[Page & 0x3ff].Write = 0;
+ }
}
}
}