mirror of
https://github.com/reactos/reactos.git
synced 2025-06-07 18:30:37 +00:00
- Delete the blaoted, overweight and slow nonpaged pool implementation.
- Plug-in support to use the ARM nonpaged pool instead. - This patch has been tested for over 2 months and all known regressions were fixed. - Thanks to Aleksey Bragin for providing a pool regression suite. - Thanks to Aleksey Bragin for providing initial implementation details and code from older attempts. - Thanks to http://uninformed.org/?v=4&a=2&t=txt and http://www.dfrws.org/2008/proceedings/p58-schuster_pres.pdf for allocation strategies. svn path=/trunk/; revision=42249
This commit is contained in:
parent
1eba02fc2f
commit
5899e14bd1
4 changed files with 18 additions and 1883 deletions
|
@ -45,8 +45,6 @@ MemType[] =
|
||||||
"LoaderXIPRom "
|
"LoaderXIPRom "
|
||||||
};
|
};
|
||||||
|
|
||||||
PVOID MiNonPagedPoolStart;
|
|
||||||
ULONG MiNonPagedPoolLength;
|
|
||||||
PBOOLEAN Mm64BitPhysicalAddress = FALSE;
|
PBOOLEAN Mm64BitPhysicalAddress = FALSE;
|
||||||
ULONG MmReadClusterSize;
|
ULONG MmReadClusterSize;
|
||||||
MM_STATS MmStats;
|
MM_STATS MmStats;
|
||||||
|
@ -160,18 +158,10 @@ MmInit1(VOID)
|
||||||
// Initialize ARM³ in phase 1
|
// Initialize ARM³ in phase 1
|
||||||
//
|
//
|
||||||
MmArmInitSystem(1, KeLoaderBlock);
|
MmArmInitSystem(1, KeLoaderBlock);
|
||||||
// DEPRECATED
|
|
||||||
/* Put nonpaged pool after the loaded modules */ // DEPRECATED
|
/* Put the paged pool after the loaded modules */
|
||||||
MiNonPagedPoolStart = (PVOID)((ULONG_PTR)MmSystemRangeStart + // DEPRECATED
|
MmPagedPoolBase = (PVOID)PAGE_ROUND_UP((ULONG_PTR)MmSystemRangeStart +
|
||||||
MmBootImageSize); // DEPRECATED
|
MmBootImageSize);
|
||||||
MiNonPagedPoolLength = MM_NONPAGED_POOL_SIZE; // DEPRECATED
|
|
||||||
// DEPRECATED
|
|
||||||
/* Initialize nonpaged pool */ // DEPRECATED
|
|
||||||
MiInitializeNonPagedPool(); // DEPRECATED
|
|
||||||
// DEPRECATED
|
|
||||||
/* Put the paged pool after nonpaged pool */
|
|
||||||
MmPagedPoolBase = (PVOID)PAGE_ROUND_UP((ULONG_PTR)MiNonPagedPoolStart +
|
|
||||||
MiNonPagedPoolLength);
|
|
||||||
MmPagedPoolSize = MM_PAGED_POOL_SIZE;
|
MmPagedPoolSize = MM_PAGED_POOL_SIZE;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -33,6 +33,12 @@ EiGetPagedPoolTag(IN PVOID Block);
|
||||||
ULONG NTAPI
|
ULONG NTAPI
|
||||||
EiGetNonPagedPoolTag(IN PVOID Block);
|
EiGetNonPagedPoolTag(IN PVOID Block);
|
||||||
|
|
||||||
|
PVOID
|
||||||
|
NTAPI
|
||||||
|
ExAllocateArmPoolWithTag(POOL_TYPE PoolType,
|
||||||
|
SIZE_T NumberOfBytes,
|
||||||
|
ULONG Tag);
|
||||||
|
|
||||||
static PVOID NTAPI
|
static PVOID NTAPI
|
||||||
EiAllocatePool(POOL_TYPE PoolType,
|
EiAllocatePool(POOL_TYPE PoolType,
|
||||||
ULONG NumberOfBytes,
|
ULONG NumberOfBytes,
|
||||||
|
@ -75,7 +81,7 @@ EiAllocatePool(POOL_TYPE PoolType,
|
||||||
Block = ExpAllocateDebugPool(PoolType, NumberOfBytes, Tag, Caller, TRUE);
|
Block = ExpAllocateDebugPool(PoolType, NumberOfBytes, Tag, Caller, TRUE);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
Block = ExAllocateNonPagedPoolWithTag(PoolType, NumberOfBytes, Tag, Caller);
|
Block = ExAllocateArmPoolWithTag(PoolType, NumberOfBytes, Tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((PoolType & MUST_SUCCEED_POOL_MASK) && !Block)
|
if ((PoolType & MUST_SUCCEED_POOL_MASK) && !Block)
|
||||||
|
@ -183,19 +189,8 @@ ExAllocatePoolWithTagPriority(
|
||||||
IN EX_POOL_PRIORITY Priority
|
IN EX_POOL_PRIORITY Priority
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
/* Check if this is one of the "Special" Flags, used by the Verifier */
|
|
||||||
if (Priority & 8) {
|
|
||||||
/* Check if this is a xxSpecialUnderrun */
|
|
||||||
if (Priority & 1) {
|
|
||||||
return MiAllocateSpecialPool(PoolType, NumberOfBytes, Tag, 1);
|
|
||||||
} else { /* xxSpecialOverrun */
|
|
||||||
return MiAllocateSpecialPool(PoolType, NumberOfBytes, Tag, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FIXME: Do Ressource Checking Based on Priority and fail if resources too low*/
|
|
||||||
|
|
||||||
/* Do the allocation */
|
/* Do the allocation */
|
||||||
|
UNIMPLEMENTED;
|
||||||
return ExAllocatePoolWithTag(PoolType, NumberOfBytes, Tag);
|
return ExAllocatePoolWithTag(PoolType, NumberOfBytes, Tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,6 +248,11 @@ ExFreePool(IN PVOID Block)
|
||||||
ExFreePoolWithTag(Block, 0);
|
ExFreePoolWithTag(Block, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
ExFreeArmPoolWithTag(PVOID P,
|
||||||
|
ULONG TagToFree);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
@ -291,36 +291,7 @@ ExFreePoolWithTag(
|
||||||
#endif
|
#endif
|
||||||
ExFreePagedPool(Block);
|
ExFreePagedPool(Block);
|
||||||
}
|
}
|
||||||
|
else if (Block) return ExFreeArmPoolWithTag(Block, Tag);
|
||||||
/* Check for non-paged pool */
|
|
||||||
else if (Block >= MiNonPagedPoolStart &&
|
|
||||||
(char*)Block < ((char*)MiNonPagedPoolStart + MiNonPagedPoolLength))
|
|
||||||
{
|
|
||||||
/* Validate tag */
|
|
||||||
#ifndef DEBUG_NPOOL
|
|
||||||
if (Tag != 0 && Tag != EiGetNonPagedPoolTag(Block))
|
|
||||||
KeBugCheckEx(BAD_POOL_CALLER,
|
|
||||||
0x0a,
|
|
||||||
(ULONG_PTR)Block,
|
|
||||||
EiGetNonPagedPoolTag(Block),
|
|
||||||
Tag);
|
|
||||||
#endif
|
|
||||||
/* Validate IRQL */
|
|
||||||
if (KeGetCurrentIrql() > DISPATCH_LEVEL)
|
|
||||||
KeBugCheckEx(BAD_POOL_CALLER,
|
|
||||||
0x09,
|
|
||||||
KeGetCurrentIrql(),
|
|
||||||
NonPagedPool,
|
|
||||||
(ULONG_PTR)Block);
|
|
||||||
|
|
||||||
/* Free from non-paged pool */
|
|
||||||
#ifdef DEBUG_NPOOL
|
|
||||||
if (ExpIsPoolTagDebuggable(Tag))
|
|
||||||
ExpFreeDebugPool(Block, FALSE);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
ExFreeNonPagedPool(Block);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Warn only for NULL pointers */
|
/* Warn only for NULL pointers */
|
||||||
|
@ -403,13 +374,6 @@ MiRaisePoolQuota(
|
||||||
/* Check if we still have 200 pages free*/
|
/* Check if we still have 200 pages free*/
|
||||||
if (MmStats.NrFreePages < 200) return FALSE;
|
if (MmStats.NrFreePages < 200) return FALSE;
|
||||||
|
|
||||||
/* Check that 4MB is still left */
|
|
||||||
if ((MM_NONPAGED_POOL_SIZE >> 12) < ((MiNonPagedPoolLength + 4194304) >> 12)) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Increase Non Paged Pool Quota by 64K */
|
|
||||||
MmTotalNonPagedPoolQuota += 65536;
|
|
||||||
*NewMaxQuota = CurrentMaxQuota + 65536;
|
*NewMaxQuota = CurrentMaxQuota + 65536;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -390,7 +390,6 @@
|
||||||
<file>mmsup.c</file>
|
<file>mmsup.c</file>
|
||||||
<file>mminit.c</file>
|
<file>mminit.c</file>
|
||||||
<file>mpw.c</file>
|
<file>mpw.c</file>
|
||||||
<file>npool.c</file>
|
|
||||||
<file>pagefile.c</file>
|
<file>pagefile.c</file>
|
||||||
<file>pageop.c</file>
|
<file>pageop.c</file>
|
||||||
<file>pe.c</file>
|
<file>pe.c</file>
|
||||||
|
|
Loading…
Reference in a new issue