- Allocate enough space for the ARM3 PFN database, and fixup the calculation of the initial nonpaged pool.

- The ARM3 PFN database is more of a "shadow" database not to interfere with the real ReactOS PFN database. It starts at 0xB0000000, which is where the initial nonpaged pool started (which now starts somewhere after the ARM3 PFN database).
- No new behavior has been introduced other than additional physical memory consumption for the PFN DB pages, and updated memory layout in the ARM3 world.


svn path=/trunk/; revision=41634
This commit is contained in:
ReactOS Portable Systems Group 2009-06-27 07:14:52 +00:00
parent 2d20864907
commit fdf4fe9afa

View file

@ -52,8 +52,8 @@ ULONG MmMaxAdditionNonPagedPoolPerMb = 400 * 1024;
// immediately follows the PFN database, typically sharing the same PDE. It is // immediately follows the PFN database, typically sharing the same PDE. It is
// a very small resource (32MB on a 1GB system), and capped at 128MB. // a very small resource (32MB on a 1GB system), and capped at 128MB.
// //
// Right now, we call this the "ARM Pool" and it begins at 0xB0000000 since we // Right now, we call this the "ARM Pool" and it begins somewhere after the ARM
// don't want to interefere with the ReactOS memory manager PFN database (yet). // PFN database (which starts at 0xB0000000).
// //
// The expansion nonpaged pool, on the other hand, can grow much bigger (400MB // The expansion nonpaged pool, on the other hand, can grow much bigger (400MB
// for a 1GB system). On ARM³ however, it is currently capped at 128MB. // for a 1GB system). On ARM³ however, it is currently capped at 128MB.
@ -102,6 +102,18 @@ PVOID MmNonPagedPoolEnd = (PVOID)0xFFBE0000;
// //
ULONG MmNumberOfSystemPtes; ULONG MmNumberOfSystemPtes;
//
// This is how many pages the PFN database will take up
// In Windows, this includes the Quark Color Table, but not in ARM³
//
ULONG MxPfnAllocation;
//
// The ARM³ PFN Database
//
PMMPFN MmArmPfnDatabase;
/* PRIVATE FUNCTIONS **********************************************************/ /* PRIVATE FUNCTIONS **********************************************************/
// //
@ -275,6 +287,12 @@ MmArmInitSystem(IN ULONG Phase,
MmMaximumNonPagedPoolInBytes = MI_MAX_NONPAGED_POOL_SIZE; MmMaximumNonPagedPoolInBytes = MI_MAX_NONPAGED_POOL_SIZE;
} }
//
// Calculate the number of bytes, and then convert to pages
//
MxPfnAllocation = (MmHighestPhysicalPage + 1) * sizeof(MMPFN);
MxPfnAllocation >>= PAGE_SHIFT;
// //
// Now calculate the nonpaged pool expansion VA region // Now calculate the nonpaged pool expansion VA region
// //
@ -317,30 +335,42 @@ MmArmInitSystem(IN ULONG Phase,
} }
// //
// Non paged pool should come after the PFN database, but since we are // Normally, the PFN database should start after the loader images.
// co-existing with the ReactOS NP pool, our "ARM Pool" will instead // This is already the case in ReactOS, but for now we want to co-exist
// start at this arbitrarly chosen base address. // with the old memory manager, so we'll create a "Shadow PFN Database"
// When ARM pool becomes non paged pool, this needs to be changed. // instead, and arbitrarly start it at 0xB0000000.
//
MmArmPfnDatabase = (PVOID)0xB0000000;
ASSERT(((ULONG_PTR)MmArmPfnDatabase & ((4 * 1024 * 1024) - 1)) == 0);
//
// Non paged pool comes after the PFN database
// //
DPRINT1("System PTE VA starts at: %p\n", MmNonPagedSystemStart); DPRINT1("System PTE VA starts at: %p\n", MmNonPagedSystemStart);
DPRINT1("NP Expansion VA begins at: %p and ends at: %p\n", DPRINT1("NP Expansion VA begins at: %p and ends at: %p\n",
MmNonPagedPoolStart, MmNonPagedPoolEnd); MmNonPagedPoolStart, MmNonPagedPoolEnd);
MmNonPagedPoolStart = (PVOID)0xB0000000; MmNonPagedPoolStart = (PVOID)((ULONG_PTR)MmArmPfnDatabase +
(MxPfnAllocation << PAGE_SHIFT));
// //
// Now we actually need to get these many physical pages. Nonpaged pool // Now we actually need to get these many physical pages. Nonpaged pool
// is actually also physically contiguous (but not the expansion) // is actually also physically contiguous (but not the expansion)
// //
PageFrameIndex = MmGetContinuousPages(MmSizeOfNonPagedPoolInBytes, PageFrameIndex = MmGetContinuousPages(MmSizeOfNonPagedPoolInBytes +
(MxPfnAllocation << PAGE_SHIFT),
Low, Low,
High, High,
BoundaryAddressMultiple, BoundaryAddressMultiple,
FALSE); FALSE);
ASSERT(PageFrameIndex != 0); ASSERT(PageFrameIndex != 0);
DPRINT1("PFN DB VA begins at: %p and ends at: %p\n",
MmArmPfnDatabase,
(ULONG_PTR)MmArmPfnDatabase + (MxPfnAllocation << PAGE_SHIFT));
DPRINT1("PFN DB PA PFN begins at: %lx\n", PageFrameIndex);
DPRINT1("NP VA begins at: %p and ends at: %p\n", DPRINT1("NP VA begins at: %p and ends at: %p\n",
MmNonPagedPoolStart, MmNonPagedPoolStart,
(ULONG_PTR)MmNonPagedPoolStart + MmSizeOfNonPagedPoolInBytes); (ULONG_PTR)MmNonPagedPoolStart + MmSizeOfNonPagedPoolInBytes);
DPRINT1("NP PA PFN begins at: %lx\n", PageFrameIndex); DPRINT1("NP PA PFN begins at: %lx\n", PageFrameIndex + MxPfnAllocation);
// //
// Now we need some pages to create the page tables for the NP system VA // Now we need some pages to create the page tables for the NP system VA
@ -377,7 +407,7 @@ MmArmInitSystem(IN ULONG Phase,
// //
// Now we need pages for the page tables which will map initial NP // Now we need pages for the page tables which will map initial NP
// //
StartPde = MiAddressToPde(MmNonPagedPoolStart); StartPde = MiAddressToPde(MmArmPfnDatabase);
EndPde = MiAddressToPde((PVOID)((ULONG_PTR)MmNonPagedPoolStart + EndPde = MiAddressToPde((PVOID)((ULONG_PTR)MmNonPagedPoolStart +
MmSizeOfNonPagedPoolInBytes - 1)); MmSizeOfNonPagedPoolInBytes - 1));
while (StartPde <= EndPde) while (StartPde <= EndPde)