mirror of
https://github.com/reactos/reactos.git
synced 2025-04-26 00:20:34 +00:00
- Make debug pool return 8-bytes aligned pointers. The padding area (up to 7 bytes) is not being checked for overruns now. ReactOS fully boots and works with this change and a debug pool.
svn path=/trunk/; revision=40750
This commit is contained in:
parent
1428ee97e9
commit
19b430466c
1 changed files with 20 additions and 5 deletions
|
@ -24,12 +24,23 @@ BOOLEAN
|
|||
NTAPI
|
||||
ExpIsPoolTagDebuggable(ULONG Tag)
|
||||
{
|
||||
#if 0
|
||||
if (Tag == TAG('C', 'a', 'l', 'l')) return FALSE;
|
||||
if (Tag == TAG('D', 'r', 'i', 'v')) return FALSE;
|
||||
if (Tag == TAG('D', 'e', 'v', 'i')) return FALSE;
|
||||
if (Tag == TAG('A', 'd', 'a', 'p')) return FALSE;
|
||||
|
||||
return FALSE;//TRUE;
|
||||
if (Tag == TAG('S', 'e', 'S', 'd')) return FALSE;
|
||||
if (Tag == TAG('O', 'b', 'D', 'i')) return FALSE;
|
||||
if (Tag == TAG('O', 'b', 'N', 'm')) return FALSE;
|
||||
if (Tag == TAG('O', 'b', 'N', 'D')) return FALSE;
|
||||
if (Tag == TAG('O', 'b', 't', 'b')) return FALSE;
|
||||
if (Tag == TAG('O', 'b', 'S', 'c')) return FALSE;
|
||||
//if (Tag == TAG('S', 'e', 'S', 'i')) return FALSE;
|
||||
//if (Tag == TAG('S', 'e', 'A', 'c')) return FALSE;
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -37,12 +48,16 @@ PVOID
|
|||
NTAPI
|
||||
ExpAllocateDebugPool(POOL_TYPE Type, ULONG Size, ULONG Tag, PVOID Caller, BOOLEAN EndOfPage)
|
||||
{
|
||||
ULONG UserSize = Size + sizeof(EI_WHOLE_PAGE_HEADER);
|
||||
ULONG TotalSize = UserSize + 2*PAGE_SIZE;
|
||||
ULONG UserSize, TotalSize, AlignedSize;
|
||||
ULONG_PTR UserData, GuardArea;
|
||||
PEI_WHOLE_PAGE_HEADER Header;
|
||||
ULONG_PTR Buffer;
|
||||
|
||||
/* Calculate sizes */
|
||||
AlignedSize = ROUND_UP(Size, MM_POOL_ALIGNMENT);
|
||||
UserSize = AlignedSize + sizeof(EI_WHOLE_PAGE_HEADER);
|
||||
TotalSize = UserSize + 2*PAGE_SIZE;
|
||||
|
||||
/* Right now we support only end-of-page allocations */
|
||||
ASSERT(EndOfPage);
|
||||
|
||||
|
@ -70,13 +85,13 @@ ExpAllocateDebugPool(POOL_TYPE Type, ULONG Size, ULONG Tag, PVOID Caller, BOOLEA
|
|||
GuardArea = PAGE_ROUND_DOWN(Buffer + TotalSize - PAGE_SIZE + 1);
|
||||
|
||||
/* Calculate user data and header pointers */
|
||||
UserData = GuardArea - Size;
|
||||
UserData = GuardArea - AlignedSize;
|
||||
Header = (PEI_WHOLE_PAGE_HEADER)(UserData - sizeof(EI_WHOLE_PAGE_HEADER));
|
||||
|
||||
/* Fill out the header */
|
||||
Header->ActualAddress = (PVOID)Buffer;
|
||||
Header->Tag = Tag;
|
||||
Header->Size = Size;
|
||||
Header->Size = AlignedSize;
|
||||
|
||||
/* Protect the guard page */
|
||||
MmSetPageProtect(NULL, (PVOID)GuardArea, PAGE_NOACCESS);
|
||||
|
|
Loading…
Reference in a new issue