#include <debug.h>
#define MODULE_INVOLVED_IN_ARM3
-#include "../ARM3/miarm.h"
+#include <mm/ARM3/miarm.h>
/* GLOBALS ********************************************************************/
return UnprotectedPages ? TRUE : FALSE;
}
-VOID
FORCEINLINE
+VOID
MiProtectedPoolUnProtectLinks(IN PLIST_ENTRY Links,
OUT PVOID* PoolFlink,
OUT PVOID* PoolBlink)
/* So make it safe to access */
Safe = MiUnProtectFreeNonPagedPool(PoolVa, 1);
- if (Safe) PoolFlink = PoolVa;
+ if (Safe) *PoolFlink = PoolVa;
}
/* Are we going to need a backward link too? */
/* Make it safe to access */
Safe = MiUnProtectFreeNonPagedPool(PoolVa, 1);
- if (Safe) PoolBlink = PoolVa;
+ if (Safe) *PoolBlink = PoolVa;
}
}
-VOID
FORCEINLINE
+VOID
MiProtectedPoolProtectLinks(IN PVOID PoolFlink,
IN PVOID PoolBlink)
{
// Get the page bit count
//
i = ((SizeInPages - 1) / PTE_COUNT) + 1;
- DPRINT1("Paged pool expansion: %d %x\n", i, SizeInPages);
+ DPRINT("Paged pool expansion: %lu %x\n", i, SizeInPages);
//
// Check if there is enougn paged pool expansion space left
//
// Out of memory!
//
- DPRINT1("OUT OF PAGED POOL!!!\n");
+ DPRINT1("FAILED to allocate %Iu bytes from paged pool\n", SizeInBytes);
KeReleaseGuardedMutex(&MmPagedPoolMutex);
return NULL;
}
//
// We can only support this much then
//
- PointerPde = MiAddressToPte(MmPagedPoolInfo.LastPteForPagedPool);
+ PointerPde = MiPteToPde(MmPagedPoolInfo.LastPteForPagedPool);
PageTableCount = (PFN_COUNT)(PointerPde + 1 -
MmPagedPoolInfo.NextPdeForPagedPoolExpansion);
ASSERT(PageTableCount < i);
//
// Out of memory!
//
- DPRINT1("OUT OF PAGED POOL!!!\n");
+ DPRINT1("FAILED to allocate %Iu bytes from paged pool\n", SizeInBytes);
KeReleaseGuardedMutex(&MmPagedPoolMutex);
return NULL;
}
(FreeEntry->Size << PAGE_SHIFT));
/* Remove the item from the list, depending if pool is protected */
- MmProtectFreedNonPagedPool ?
- MiProtectedPoolRemoveEntryList(&FreeEntry->List) :
+ if (MmProtectFreedNonPagedPool)
+ MiProtectedPoolRemoveEntryList(&FreeEntry->List);
+ else
RemoveEntryList(&FreeEntry->List);
//
if (i >= MI_MAX_FREE_PAGE_LISTS) i = MI_MAX_FREE_PAGE_LISTS - 1;
/* Insert the entry into the free list head, check for prot. pool */
- MmProtectFreedNonPagedPool ?
- MiProtectedPoolInsertList(&MmNonPagedPoolFreeListHead[i], &FreeEntry->List, TRUE) :
+ if (MmProtectFreedNonPagedPool)
+ MiProtectedPoolInsertList(&MmNonPagedPoolFreeListHead[i], &FreeEntry->List, TRUE);
+ else
InsertTailList(&MmNonPagedPoolFreeListHead[i], &FreeEntry->List);
/* Is freed non paged pool protected? */
/* Mark it as special pool if needed */
ASSERT(Pfn1->u4.VerifierAllocation == 0);
- if (PoolType & 64) Pfn1->u4.VerifierAllocation = 1;
+ if (PoolType & VERIFIER_POOL_MASK)
+ {
+ Pfn1->u4.VerifierAllocation = 1;
+ }
//
// Check if the allocation is larger than one page
/* Mark it as a verifier allocation if needed */
ASSERT(Pfn1->u4.VerifierAllocation == 0);
- if (PoolType & 64) Pfn1->u4.VerifierAllocation = 1;
+ if (PoolType & VERIFIER_POOL_MASK) Pfn1->u4.VerifierAllocation = 1;
//
// Release the PFN and nonpaged pool lock
FreePages += FreeEntry->Size;
/* Remove the item from the list, depending if pool is protected */
- MmProtectFreedNonPagedPool ?
- MiProtectedPoolRemoveEntryList(&FreeEntry->List) :
+ if (MmProtectFreedNonPagedPool)
+ MiProtectedPoolRemoveEntryList(&FreeEntry->List);
+ else
RemoveEntryList(&FreeEntry->List);
}
if (FreeEntry->Size < (MI_MAX_FREE_PAGE_LISTS - 1))
{
/* Remove the item from the list, depending if pool is protected */
- MmProtectFreedNonPagedPool ?
- MiProtectedPoolRemoveEntryList(&FreeEntry->List) :
+ if (MmProtectFreedNonPagedPool)
+ MiProtectedPoolRemoveEntryList(&FreeEntry->List);
+ else
RemoveEntryList(&FreeEntry->List);
//
if (i >= MI_MAX_FREE_PAGE_LISTS) i = MI_MAX_FREE_PAGE_LISTS - 1;
/* Insert the entry into the free list head, check for prot. pool */
- MmProtectFreedNonPagedPool ?
- MiProtectedPoolInsertList(&MmNonPagedPoolFreeListHead[i], &FreeEntry->List, TRUE) :
+ if (MmProtectFreedNonPagedPool)
+ MiProtectedPoolInsertList(&MmNonPagedPoolFreeListHead[i], &FreeEntry->List, TRUE);
+ else
InsertTailList(&MmNonPagedPoolFreeListHead[i], &FreeEntry->List);
}
else
if (i >= MI_MAX_FREE_PAGE_LISTS) i = MI_MAX_FREE_PAGE_LISTS - 1;
/* Insert the entry into the free list head, check for prot. pool */
- MmProtectFreedNonPagedPool ?
- MiProtectedPoolInsertList(&MmNonPagedPoolFreeListHead[i], &FreeEntry->List, TRUE) :
+ if (MmProtectFreedNonPagedPool)
+ MiProtectedPoolInsertList(&MmNonPagedPoolFreeListHead[i], &FreeEntry->List, TRUE);
+ else
InsertTailList(&MmNonPagedPoolFreeListHead[i], &FreeEntry->List);
}
NTAPI
MiInitializeSessionPool(VOID)
{
- PMMPTE PointerPde, PointerPte, LastPte, LastPde;
+ PMMPTE PointerPte, LastPte;
+ PMMPDE PointerPde, LastPde;
PFN_NUMBER PageFrameIndex, PdeCount;
PPOOL_DESCRIPTOR PoolDescriptor;
PMM_SESSION_SPACE SessionGlobal;
/* Allocate and initialize the bitmap to track allocations */
PagedPoolInfo->PagedPoolAllocationMap = ExAllocatePoolWithTag(NonPagedPool,
BitmapSize,
- ' mM');
+ TAG_MM);
ASSERT(PagedPoolInfo->PagedPoolAllocationMap != NULL);
RtlInitializeBitMap(PagedPoolInfo->PagedPoolAllocationMap,
(PULONG)(PagedPoolInfo->PagedPoolAllocationMap + 1),
/* Allocate and initialize the bitmap to track free space */
PagedPoolInfo->EndOfPagedPoolBitmap = ExAllocatePoolWithTag(NonPagedPool,
BitmapSize,
- ' mM');
+ TAG_MM);
ASSERT(PagedPoolInfo->EndOfPagedPoolBitmap != NULL);
RtlInitializeBitMap(PagedPoolInfo->EndOfPagedPoolBitmap,
(PULONG)(PagedPoolInfo->EndOfPagedPoolBitmap + 1),